sourcemeta/alterschema

Any plans for backward conversion?

Opened this issue · 5 comments

Apologies if the wrong place for a question, but did not see a different place/link to ask one.
My current requirements are to convert from Draft 6 to Draft4. Any plans for backward conversion?

Hey @tmargot ,

I considered (and attempted) to perform downgrades, but they didn't work very well apart from simple cases, as each version of JSON Schema introduced functionality that cannot be fully represented in previous versions.

My current requirements are to convert from Draft 6 to Draft4

Why do you need to downgrade on the first place? Can you show me some example schemas that you want to downgrade? Just want to understand the level of "lossy-ness" that we could in theory provide

Hi @jviotti,

Thanks for the reply, our integration platform is Boomi (https://boomi.com/) which currently only supports JSON Schema Draft 3/4 for JSON profile import. Our current integration project has NetSuite REST API as a source and the NetSuite metadata (schema) endpoint only returns Draft 6.

https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_157373386674.html#The-REST-API-Browser
https://system.netsuite.com/help/helpcenter/en_US/APIs/REST_API_Browser/record/v1/2023.2/index.html

I have looked at https://json-schema.org/draft-06/json-schema-release-notes#q:-what-are-the-changes-between-draft-04-and-draft-06 but was looking for a reliable tool instead of editing by hand.

I have attached a hand modified NetSuite Subscription schema that I removed all company specific custom fields and Ids.

I keep seeing mentions of backward compatibility between Draft 4 and 6, is this true?

I also noted that Boomi requires the user to select the object to be imported as a profile, so I had to include the following:
"$id": "https://1013642-sb3.suitetalk.api.netsuite.com/services/rest/record/v1/metadata-catalog/subscription", "title": "Subscription", "description": "A subscription in the catalog",

NS Subscription Schema Draft 6 Edited.json

I would take the opportunity to press them to support later schema versions. Let them know that draft 4 is a decade old.

I would take the opportunity to press them to support later schema versions. Let them know that draft 4 is a decade old.

Honestly, we all know, easier said than done. Just trying to work with what I got.

Hi @tmargot ,

Thanks for the detailed response.

Thanks for the reply, our integration platform is Boomi (https://boomi.com/) which currently only supports JSON Schema Draft 3/4 for JSON profile import. Our current integration project has NetSuite REST API as a source and the NetSuite metadata (schema) endpoint only returns Draft 6.

I see. Sadly not an uncommon scenario. I've seen similar cases before.

I have attached a hand modified NetSuite Subscription schema that I removed all company specific custom fields and Ids.

Note that this is also a HyperSchema document, which AlterSchema doesn't even support yet. It currently upgrades JSON Schema, but HyperSchema vocabularies remain unimplemented.

That said, I'm hoping to revamp this project soon for a lot more advanced functionality, including HyperSchema.

I have looked at https://json-schema.org/draft-06/json-schema-release-notes#q:-what-are-the-changes-between-draft-04-and-draft-06 but was looking for a reliable tool instead of editing by hand.

Do you need to be able to do it automatically or do you just need reliability?

Depending on what you need, at https://www.Intelligence.AI, we do some consultancy around JSON Schema (we are publishing an O'Reilly book covering JSON Schema too) and this could be something we can help on:

  • Help you improve those schemas, as I think you are using some invalid keywords. For example nullable is not valid on Draft6
  • Downgrading schemas is often tricky, and easier to do on a case by case basis. We can manually downgrade for you and make sure the downgraded schemas are as lossless as possible.
  • If you need to do it automatically, we could discuss us building some more custom for you to perform these transformations, based on the JSON Schema tooling we have here at Sourcemeta

Happy to discuss further via e-mail or LinkedIn.