Open brprice opened 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
oneOf
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)?
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.
swagger2
Would you like to make a PR to clean the docs?
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-L364Do (default) schemas for sum types agree with aeson, or am I missing something here (I cannot come up with a case where they disagree)?