NoRedInk / json-elm-schema

BSD 3-Clause "New" or "Revised" License
45 stars 11 forks source link

Question: #7

Open gogocurtis opened 7 years ago

gogocurtis commented 7 years ago

This is interesting..

My intuition tells me that there should be some way to take a JsonSchema and end up with a decoder that generates a Type derived from the JsonSchema...

Is this the intention of the project or is it planned for doing validations on the api separate from the payload decode?

jwoudenberg commented 7 years ago

You mean take a normal JSON schema and decode it into an elm-schema? Definitely! @norpan laid down the foundation for that in #5. Check #3 for an idea of what this could be used for and #6 for some progress on supporting additional schema's.

Or are you talking about taking a schema and generation a decoder, elm code to decode such a schema? That could be a really interesting application too!

norpan commented 7 years ago

My intention is not to make types from schemas, maybe check out https://github.com/eeue56/json-to-elm for that.

I'm going to use this to make forms from schemas and validate them, using the Value type internally in the forms. I have user specified data (specified by writing JSON schemas) in a RethinkDB database that I want to offer forms to edit.

And yes, that includes forms to edit the JSON schema itself, maybe using the JSON schema schema :)