Open B1nke opened 4 years ago
I think the default for JSON Schema is x-readOnly, no? And only for Swagger/OpenAPI where it is defined we rename it.
https://github.com/RicoSuter/NJsonSchema/blob/master/src/NJsonSchema/JsonSchemaProperty.cs#L78
Is it now also in the standard for JSON Schema?
Well I'm very new to this but with some googling I ended up on a thread that said that it was in spec 3 but removed in spec 4, but it was actually not removed, just moved to jsonschema-hyperschema. Just went to the github for hyperschema and found some references for it here: https://github.com/json-schema-org/json-schema-spec/blob/master/jsonschema-hyperschema.xml
I'm using react-jsonschema-form to render data based on the schema, and it does not work for readonly
but it does for readOnly
.
Based on this: https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.9.4
it should be readOnly, not readonly.
I'm also having problems generating UI forms from the schema because of casing.
Also, for some reason ReadOnly attribute is ignored on class level?
Readonly handling on class level is currently missing. The casing needs to be checked in the static serializer class where the casing is configured per schema type.
Hi, I'm pretty new to using json shema, but from what I can see in the json hyperschema spec is that the property should be named
readOnly
and not readonly. From what I can tell fromCreateJsonSerializerContractResolver(SchemaType schemaType)
, I can probably use theSchemaType.Swagger2
to achieve the expected result, but that will also change the behavior ofRequiredAttribute
, which is not desired. Might just be a typo or does the spec perhaps say that it should be all lower letters in some case?