Repository navigation
♻️ refactor: nullable PATCH fields via VoidableProps (sdk#139) [skip ci] - #372
Merged
Merged
Conversation
ApiAppreciationPatch, ApiPersonPatch (and ApiRepresentativePatch through it) and ApiAgentContactPatch now accept null on fields backed by nullable columns; required fields stay Partial-only. ApiActivityLogPatch has no nullable fields and stays Partial. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ch, revert format churn (sdk#139) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…l fields in tests (sdk#139) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #139
PATCH types built with plain
Partial<>couldn't express clearing a nullable column withnull.ApiAppreciationPatch: unchanged.dateDue/dateDeliveryalready acceptnull;opportunityIdis anullable:falserelation in beApiPersonPatch(andApiRepresentativePatchvia it):avatarUrl,middleName,phone,landline,emailacceptnull(nullable columns in beperson.entity.ts);lastNamestays non-null to matchApiAgentContactPatch;iddropped from the body type (it's the route param)ApiAgentContactPatch: optional fields acceptnull;firstName,lastName,roledon'tApiActivityLogPatch: unchanged —date/hoursare required,nullis meaninglessUses the existing
Partial<VoidableProps<T, K>>pattern (organization/communication) rather than blanketVoidableProps<T>, so clients can't null a NOT NULL column (which would 500 on write).be follow-up needed (not in this PR): be's generated/hand-written Ajv schemas coerce
nullto""/0andupdate-agent-contact.tsignores falsy address clears, so be must accept and store real NULLs before clients rely on these clears. Out of scope:addresson person stays non-clearable;ApiPersonGetstill types nullable columns asstring.Type tests:
src/types/api/patch-voidable.test.ts.[skip ci]in the title: merge without triggering the publish workflow.🤖 Generated with Claude Code