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

Provide a DSL to derive both Schema and JSON instances #130

Open
fizruk opened this issue Oct 17, 2017 · 1 comment
Open

Provide a DSL to derive both Schema and JSON instances #130

fizruk opened this issue Oct 17, 2017 · 1 comment

Comments

@fizruk
Copy link
Member

fizruk commented Oct 17, 2017

It is currently impossible to derive ToSchema, ToJSON or FromJSON from any other class.
However, as @kosmikus has pointed out during HaskellXtogether it should be possible to provide a new DSL to derive all of those (and maybe more?).

I personally rely mostly on Generic-based instances and that just works, but the problem of mismatching instances still persists for hand-written instances (which do happen on occasion). So a unifying DSL would indeed resolve that issue.

Some potential problems:

  • what about other common classes, such as ToHttpApiData/FromHttpApiData, ToForm/FromForm?
  • what about other interfaces, such as ToRow/FromRow (from postgresql-simple), CSV, XML, etc.?
  • unifying DSL might degrade JSON encoding/decoding performance, should we care?

What would you like to use a unifying DSL for? Any ideas are welcome!

@kosmikus
Copy link

See my BOB 2017 talk (slides, video) for some more background on this (although unrelated to Swagger).

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

2 participants