简体   繁体   中英

Testing two versions of json-schema for backwards compatibility

I have a repository that contains versioned json-schemas so for each type of schema I could have several revisions: v1, v2, v3 etc. I want to test schemas for backwards compatibility, so that any event which was valid for v1 schema is guaranteed to be valid for a v2 schema.

To do that, I need to ensure that properties are only added and never removed, non-required properties never become required and so on. Is there any library for node.js available to achieve my goal?

Naive question: is it something you need to do programmaticaly (ie regularly) or is just singular check whenever you introduce a new version?

If it's "singular", you may try to use this website on your v1. It will generate a "fake" json based on your imposed schema. Then, by passing it to your upgraded schema versions, you should be able to make sure backward compatibility is achieved.

Note I have never used the tool myself so I don't know to which extent it deals with non-"required" fields...

Sorry if I missed your point;)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM