Repository navigation
fix: preserve top-level required properties on allOf schemas - #89
Closed
aksharprabhudesai wants to merge 1 commit into
Closed
aksharprabhudesai wants to merge 1 commit into
aksharprabhudesai wants to merge 1 commit into
Conversation
Contributor
|
@aksharprabhudesai thanks for working on this. We are currently close to land a different approach on generating SDKs entirely (see #87 for reference) and that would make this PR obsolete, so I'll go ahead and close this. Please stay tuned as we are will want to get as much feedback as possible on the new SDKs once they come to life! |
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.
Description
In
scripts/project-current-ucp-schemas.mjs, schema nodes are traversed and projected forquicktype. Previously,requiredwas only processed when inspectingkey === "properties", while all other occurrences were unconditionally skipped withif (key === "required") continue;.For schema nodes that declare
requiredat the top level while composing their properties insideallOf(such ascommon/types/daily_hour.jsonrequiring["day", "opens", "closes"]andcommon/types/exception_hour.jsonrequiring["valid_from", "valid_through"]),key === "properties"never matches, sooutput.requiredwas dropped from the projected schema. As a result,quicktypeemitted these fields as optional in the generated Zod models.This preserves
output.requiredwhennode.propertiesis absent or not an object, and regenerates models against the pinned 2026-08-25 spec:DailyHourElementSchema:day,opens, andclosesare now required (DailyHourElementSchemaalso stays a plainz.objectbecause thedependentRequiredrule onopens/closesbecomes vacuous).ExceptionHourElementSchema:valid_fromandvalid_throughare now required.Adds projection and Zod validation regression tests in
tests/allof-required.test.js, and updatestests/dependent-required.test.js.