Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add strict object additionalProperties: false mapping #71

Merged
merged 2 commits into from
Nov 21, 2022

Conversation

samchungy
Copy link
Contributor

@samchungy samchungy commented Nov 21, 2022

According to the Open API Specification:

additionalProperties - Value can be boolean or object. Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. Consistent with JSON Schema, additionalProperties defaults to true.

According to the Zod Readme:

.passthrough
By default Zod object schemas strip out unrecognized keys during parsing.

This means that we should see alot more of this in the schema if this bit of the code was working:

image

Since this defaults to true we don't need this passthrough code. Instead I'll add the option to map strict objects.

@samchungy samchungy changed the title feat: Add strict support feat: Add strict object support Nov 21, 2022
@samchungy samchungy changed the title feat: Add strict object support feat: Add strict object additionalProperties: false mapping Nov 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants