biocad / openapi3

OpenAPI 3.0 data model
BSD 3-Clause "New" or "Revised" License
39 stars 53 forks source link

Outdated documentation re sum encoding differs ToSchema/ToJSON? #59

Open brprice opened 2 years ago

brprice commented 2 years ago

There is (in the haddock documentation) a statement that the default ToSchema and ToJSON instances differ in encoding sum types: https://github.com/biocad/openapi3/blob/8119d1351e0444f3757bc6ffd381675b0d6a64c7/src/Data/OpenApi.hs#L330-L333

However, I think this is outdated and that you create a consistent schema using oneOf, as mentioned further down the documentation https://github.com/biocad/openapi3/blob/8119d1351e0444f3757bc6ffd381675b0d6a64c7/src/Data/OpenApi.hs#L362-L364

Do (default) schemas for sum types agree with aeson, or am I missing something here (I cannot come up with a case where they disagree)?

maksbotan commented 1 year ago

Thanks for the observation! Looks like the first paragraph you mentioned survived as-is from swagger2 repo, along with some other comments in this file.

Would you like to make a PR to clean the docs?