Jsonschema Forward compatibility fails when deleting an optional field
See original GitHub issueAccording to this, deleting an optional field is allowed in Forward compatibility.
Having this 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
}
}
}
and setting compatibility rule to Forward, and trying to add a new version:
{
"title": "Person",
"type": "object",
"properties": {
"firstName": {
"type": "string",
"description": "The person's first name."
},
"age": {
"description": "Age in years which must be equal to or greater than zero.",
"type": "integer",
"minimum": 0
}
}
}
the compatibility check is failing with error:
{causes: [{description: "OBJECT_TYPE_PROPERTY_SCHEMAS_NARROWED", context: "/propertySchemasAdded"}],…}
causes: [{description: "OBJECT_TYPE_PROPERTY_SCHEMAS_NARROWED", context: "/propertySchemasAdded"}]
detail: "io.apicurio.registry.rules.RuleViolationException
error_code: 409
message: "Incompatible artifact: person [JSON], num of incompatible diffs: {1}"
name: "RuleViolationException"
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
JSON-Schema forward compatibility doesn't allow the removal ...
I think schema validation for json-schema is bugged. I cannot remove an optional field on a FORWARD compatible schema. The long version: Looking ......
Read more >AVRO schema optional fields are not compatible
E.g. deleting an non-optional field is not a forward compatible change. The Confluent schema registry is only made to transport the writer ...
Read more >Schema Evolution and Compatibility - Confluent Documentation
Delete fields ; Add optional fields. All previous versions, Consumers. FORWARD. Add fields; Delete optional fields. Last version, Producers.
Read more >Understanding JSON Schema Compatibility - Robert Yokota
When removing a property in a backward compatible manner, the schema of “additionalProperties” in the new version of the schema must be backward ......
Read more >AWS Glue Schema Registry
You can use this choice to check compatibility against all previous schema versions when you delete fields or add optional fields. FORWARD: This...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m thinking however that my argument may not be valid if there is
"additionalProperties":false
set. EDIT: I’ve tested our current compatibility checker with"additionalProperties": false
and it works as expected.Yes, the compatibility checker must be pessimistic because it works based on general rules. There was already some interest from the community to introduce a less strict checking, but I’m not yet sure how it would look like in practice. A straightforward alternative would be to add an option to force an override, on user’s own risk, if they are 100% sure that it’s safe for their application. Registry would then need to take this into account when doing transitive checks.