Immutable schema model
Having spent the last few days hacking on Swashbuckle, I was wondering whether or not anybody had floated the idea of refactoring or deprecating the current schema models in favor of immutable ones?
The mutability and lack of deep copying functionality makes things like caching inline or primitive type schemas a non-starter. It could also allow for more robust validation at construction time.
Tell me more.... we are going to have to do some non-trivial changes in OpenAPI 3.1 because the way we handle JSON Schema is changing a lot for 3.1.
Can you show what kind of inline caching you would like to do?
@MaggieKimani1 Could you confirm that the schemas created by JSONSchema.NET are immutable?
@jcracknell the JSON schema object exposed by the JsonSchema.Net library is completely immutable; you can't directly add or update its keywords/properties. You can however use the JsonSchemaBuilder object to build inline schemas. You can find more information in their docs here https://docs.json-everything.net/schema/basics/