I search a tool which permit to generate JSONPatch from two JSONSchema. Example:
JSONSchema A:
{
"$id": "https://example.com/person.schema.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Person",
"type": "object",
"properties": {
"firstName": {
"type": "string",
"description": "The person's first name."
},
"lastName": {
"type": "string",
"description": "The person's last name."
},
"age": {
"description": "Age in years which must be equal to or greater than zero.",
"type": "integer",
"minimum": 0
}
}
}
Where JSON object can be:
{"firstName": "John", "lastName": "Doe", "age": 42 }
JSONSchema B (without age):
{
"$id": "https://example.com/person.schema.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Person",
"type": "object",
"properties": {
"firstName": {
"type": "string",
"description": "The person's first name."
},
"lastName": {
"type": "string",
"description": "The person's last name."
}
}
}
Generated JSONPatch should be:
[
{ "op": "remove", "path": "/age" }
]
To obtain after apply patch, object:
{"firstName": "John", "lastName": "Doe" }
There are some tools for that ?
NB: I can find some tools like this or this but these generate JSONPatch from objects not from JSONSchemas.