-
Notifications
You must be signed in to change notification settings - Fork 213
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
Convert JSON schema to malli #915
base: master
Are you sure you want to change the base?
Convert JSON schema to malli #915
Conversation
This allows a very basic json-schema->malli conversion and will most likely need to be adequated to: - cleanup TODOS; - ensure function names are sane; - ensure all json-schema features are supported (at least for one specific version, i.e. draft-7).
Also, remove duplication.
Also, reorganize functions to simplify processing, reduce duplication and avoid special casing. Lastly, make schema->malli the first entry point since anything can be a schema. It then delegates to types, aggregates or `$ref`s.
Also, adds top-level enums (and consts) and prepares for better range checks in int/number.
This allows us to see the whole spec at once and fix a bug w/ custom registry definitions
...in json-schema. Also removes the leading `:` which the definitions keys also didn't have. This allows the refs and definitions keys to match and be standards-compliant.
Perhaps this really needs to be fixed at a lower level, but I noticed that at times I was getting definitions whose values where just refs back to the same definition. These seemed to come in addition to the correct result that had the actual definition in it. So this just filters out the circular ones.
...in json-schema-test/references-test. Fix was in 23488b2.
...including one commented-out failing test that should pass once issue metosin#464 is fixed.
The simplest failing test case:
Some other nice small examples here: |
I've been playing around with this branch and how to test it. Adding to deps.edn test alias:
Then to use it:
Lots of things don't pass even for this one file, which is probably unsurprising as there are lots of weird edge cases in the tests. I've been making changes to try to fix problems as I encounter them Here is the where I got to: But it still doesn't work with vega-lite |
Thanks a lot for your contributions @timothypratley ! This is a weird period for me because I just moved (so I'm still settling down at home) and I haven't managed to spend time on open source at work. I'll get back on this as soon as I can though, starting with crystallizing the failing test cases you've provided into unit tests! |
I would have loved to have support for json-schema to use on https://github.com/compose-spec/compose-spec/blob/master/schema/compose-spec.json |
Still heavily WIP.
Built on top of #211