-
Notifications
You must be signed in to change notification settings - Fork 212
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
Add Sequence Schemas to JSON Schema generation #795
base: master
Are you sure you want to change the base?
Add Sequence Schemas to JSON Schema generation #795
Conversation
e11d828
to
702fb6a
Compare
Does this work correctly with inlined sequence scehmas? e.g. |
Oh that's a good point. I didn't know that Malli inlined those schemas. Is there a way to apply that inlining upfront? |
I don't think there is. Some options: 1) resolve locally
2) just mark them as "arrays of anything"
3) schema simplifier
@frenchy64 had one (partial) solution for this, with the first version of the recursive regex. |
here's one old test to this: https://github.com/miikka/boolean-simplifier meander has good tools for rewriting code. |
After thinking about it for a little while, I feel like 1) is the way to go. 2) is basically what Malli has now which is unintuitive ("why doesn't json schema transformation work?"). 3) doesn't work because 1) can be done in a single pass in What do you think? |
I realize now that I basically said the same thing as you regarding 1). lol Sorry about that. I don't think it's hacky. I don't know that there's a good abstraction that doesn't require a full rewrite of the existing json schema architecture. |
If you think you can make it work with 1, let's go with that. |
I spent some time on this, and I don't know that the "resolve locally" solution is possible. I find myself building an ad-hoc version of "schema simplifier", which I don't have the skill or time to develop the skill to properly implement. Given that, how would you feel about some sort of "NOT CURRENTLY WORKING" warning when converting a sequence schema to json schema? They currently just return |
Thanks for giving it a shot. I think a reasonable default would be a vector of anything. At least it's of right type. When we have a generic simplifier, we can make this better. |
could you change these to return "vector of anything"? |
ping @NoahTheDuke |
Yeah, I'll do that tonight/tomorrow. |
Closes #793
Tried to stick with how things work in the existing code. Looks like Malli's generated JSON Schema isn't up to date with the most recent JSON Schema specs, so I'm not entirely sure I did this right.