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

relationship to NoRedInk/json-elm-schema #41

Open
ericgj opened this issue Jan 3, 2018 · 2 comments
Open

relationship to NoRedInk/json-elm-schema #41

ericgj opened this issue Jan 3, 2018 · 2 comments
Assignees
Labels

Comments

@ericgj
Copy link

ericgj commented Jan 3, 2018

Wondering if there was any talk of merging these efforts down the line, or if you see the two as having distinct features.

From a quick look, it seems yours is further along in terms of the json-schema spec, and has unicode support; but json-elm-schema has EncodingProgram that enables a node-based CLI for generating JSON from Elm-defined schemas. Did you have any plans to do JSON Schema generation like this? It shouldn't be too hard I guess since you do have Json.Schema.Builder.encode. Maybe I'll give it a try.

I do like the fact that your library has less dependencies, and seems to have support for "tuple typing" (that's the difference between withItem and withItems yes?), and building $refs.

EDIT: I now see Json.Schema.Builder.encode generates Elm, not JSON. So my question remains, any plans to do JSON generation? It is a key feature in my case, where I want the canonical representation to be in Elm and to generate the JSON files for the server side, rather than the other way around.

@1602
Copy link
Collaborator

1602 commented Jan 9, 2018

if there was any talk of merging these efforts

There's currently no such conversation going. I guess at some point we should be starting one.

any plans to do JSON generation

Are you talking about serialising Schema as JSON value? There's Json.Schema.Definitions.encode function which takes Schema and returns Value. There's one problem with this function remaining though: json schema allows additional properties to be present along with standard keywords, and this is not allowed by encode function which acts as a whitelist and only leaves standard keywords.

the difference between withItem and withItems yes?

yep, it's like array treatment as a list (of same type, withItem) and a tuple (any types withItems).

@1602 1602 added the question label Jan 9, 2018
@1602 1602 self-assigned this Jan 9, 2018
@norpan
Copy link

norpan commented Apr 20, 2018

I've been doing some things for NoRedInk/json-elm-schema and although there is a schema decoder there, I think the philosophy of the two are different. The NoRedInk version is focused on generating JSON schemas that are correct, in some sense, whereas this library is focused on working with existing JSON schemas from the outside, which may be incomplete and inconsistent.

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

No branches or pull requests

3 participants