Hello,
I had the requirements of being able to add more constraints to properties in the JSON schema. I then implemented a post processing schema generation that scans all property attributes and adds the details in the schema (see attachment). The code satisfy my requirements and probably need to be truly extended to cover all cases.
I think it would be more efficient to have it in the JsonSchemaGenerator.Generate method, perhaps with an optional setting "useDataAnnotations" to enable it.
What do you think?
Thanks,
Pedro
I had the requirements of being able to add more constraints to properties in the JSON schema. I then implemented a post processing schema generation that scans all property attributes and adds the details in the schema (see attachment). The code satisfy my requirements and probably need to be truly extended to cover all cases.
I think it would be more efficient to have it in the JsonSchemaGenerator.Generate method, perhaps with an optional setting "useDataAnnotations" to enable it.
What do you think?
Thanks,
Pedro