-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
JSON Schema Draft07 ->Draft2019 #5
Comments
Not sure I understand... The code only sets $schema if it's draft4 or if it's not set, otherwise it would be left as is. See https://github.com/ajv-validator/json-schema-migrate/blob/master/src/index.ts#L83
yes. I did think about implementing the migration matrix, but with the addition of 2020-12 it becomes much more code, maybe there is some smarter way to define this transformation declaratively, rather than further complicating the code. It makes sense to support: draft4 -> 7, 2019, 2020 // this is what is supported now Happy to support the implementation ajv-cli would then have to support --from-spec parameter and while you are at it, you could throw in: JTD -> 7, 2019, 2020 // always possible, with or without discriminator keyword |
First Part
Hi, it seems that I'm just a little bit confused because the tool only goes up from
The If I run But if I have an JSON Schema like:
and I'm calling the So it seems to update parts of the schema, but totally ignores to update
As I said, I'm by no means an JSON Schema expert. So there might be a reason why one does not simply want to update the
Second PartI know, I'm repeating myself. I'm not an JSON Schema expert ;). But why can the update process not be sequential? Like
Kind regards, |
that’s reasonable, but it just assumes that you pass draft-04 schema that may have custom $schema, so if it’s anything but draft-04 URI it doesn’t change it. I am not saying it’s correct :)
that’s not a terrible idea, actually. |
On your example, it also assumes your schema is valid (and it’s not). Either way, it’s worth redefining this package. |
Hi @epoberezkin , I'm in a similar boat, trying to migrate from I'm also relatively new to json-schemas, is there a different way to migrate? I noticed this comment seems to resolve the migration error, is there more to it than that? For reference, I'm trying to update ansible-schemas. |
Hi everyone,
Problem Statement 🛑
I've used the code example, which works as expected. But if I use
migrate.draft2019
from your example, no$schema
is set. Is this expected behavior?Another problem would be, that I need to migrate a lot of
draft07
to at leastdraft2019
. But I guess your are only handlingdraft-04
to newer ones?What I have tried 🛠
ajv-cli migrate
nodejs
code using yourjson-schema-migrate
.Behavior
$id
fields (e.g. removing#
and/
).$schema
field.Wishes 🎁
draft07
todraft2019
I'm not an JSON Schema expert, so I'm really not sure if this all is expected behavior or not.
Kind regards,
Daniel
The text was updated successfully, but these errors were encountered: