Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expanding the possible values of a Schema example beyond Value #54

Open
theophile-scrive opened this issue Jul 1, 2022 · 1 comment

Comments

@theophile-scrive
Copy link

theophile-scrive commented Jul 1, 2022

Hi @maksbotan!

At our workplace we use OpenAPI3 and are very grateful for the work that was put in it.
Recently we have taken to move away from using Aeson's Value, as it does not preserve key ordering. While JSON applications should not rely on it, it's actually quite useful for examples as similar fields are declared next to another, and we usually want some "Id" field to be the first one displayed. For example, last_name and first_name should be together.

Now, I'm not suggesting to break the compatibility by changing the type of _schemaExample :: Maybe Value to something incompatible, but rather open more possibilities by having something like an existentially-quantified type:

data Jsonable = forall a. ToJSON a => Jsonable a

_schemaExample :: Maybe JSONable

and use directly encode in the library to render the ByteString.

How does this sound? I can submit a PR if you agree on the design. :)

@theophile-scrive
Copy link
Author

@maksbotan friendly ping :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant