Closed floratmin closed 4 months ago
@floratmin as const
is actually recursive so I think the issue probably comes from your type transformation.
I can try to help you on that but it doesn't seem to be an issue with the lib.
@floratmin Just realized that you miss a const
keyword just before your 500
constant:
schema: {
readonly $id: "myschema",
readonly title: "MySchema",
readonly type: "object",
readonly required: readonly ["myprop"],
readonly properties: {
myprop: { const: 500 } // <= here
},
readonly additionalProperties: false
};
Wether your props are readonly or not should not be an issue after v3. I have tried and it works fine. Closing the issue.
When a schema has a property with
const
value, then the inferred type should also be const. E.g.:This works if I use
Schema
directly. But if I make some type transformations this gets lost and the type ofmyprop
becomesnumber
, because there is noreadonly
annotation for this property.