Open furstenheim opened 1 year ago
what does additionalProperties mean here, that the schema might have those properties?
Additional properties validates everything that is not covered by properties (and patternProperties, but those I've never had to use)
https://json-schema.org/understanding-json-schema/reference/object.html#additional-properties
It is a validator on those properties. If it said "additionalProperties": false
it would mean that there is no other property beyond he described ones (as false never succeeds as a json schema).
In this case, it adds a condition to any other property.
Having the same issues :I
I am also in need of this functionality, here is a good api that zod uses record schema. It would be nice to have an equivalent in yup so that types can be restored for this use case.
Write a title that summarizes the specific problem I would like to get something like additionalProperties in JSON schema and then be able to use InferType on it
Describe what you are trying to accomplish AND what you have tried
This is related to this issue https://github.com/jquense/yup/issues/130. Basically, I would like to describe in yup the "additionalProperties" in a json schema.
Say:
I understand the proposed solution using lazy
However, when I do
InferType<typeof schema>
, I get unknown (which is expected).I would like to get something like:
Help Others Reproduce
Write a runnable test case using the code sandbox template: https://codesandbox.io/s/yup-test-case-gg1g1