GREsau / schemars

Generate JSON Schema documents from Rust code
https://graham.cool/schemars/
MIT License
799 stars 223 forks source link

Add support for multiple flatten enums #320

Closed rlebran closed 1 month ago

rlebran commented 1 month ago

Update #264 following v1 merge on master.

Fix https://github.com/GREsau/schemars/issues/165.

Use all_of when flattening multiple subschemas.

There is still a limitation when flattening required enum. We lose the information that the field is required. This is not caused by this PR. This could be fix in another PR.

We use this fix in apistos.

GREsau commented 1 month ago

Thanks for the PR! I amended it so that it no longer overwrites the allOf in the original schema. Otherwise, when flattening more than 3 enums, the 3rd and 4th would overwrite the 1st and 2nd

rlebran commented 4 weeks ago

Thank you so much for the work and the merge !