Apicurio / apicurio-registry

An API/Schema registry - stores APIs and Schemas.
https://www.apicur.io/registry/
Apache License 2.0
596 stars 264 forks source link

Cannot add additional properties to schema #5355

Open mmmmillar opened 2 hours ago

mmmmillar commented 2 hours ago

Old:

{
  "$id": "https://schemas.x.com/x.json",
  "$schema": "http://json-schema.org/draft-07/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "integer"
    }
  },
  "required": [
    "id"
  ]
}

New:

{
  "$id": "https://schemas.x.com/x.json",
  "$schema": "http://json-schema.org/draft-07/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "integer"
    },
   "new_prop": {
      "type": "integer"
    }
  },
  "required": [
    "id"
  ]
}

I have Global Rules set as following:

Screenshot 2024-10-16 at 16 57 52

Both old and new schemas should allow this input (as new_prop is not required) so I think BACKWARD should be supported:

{
    "id": 1,
        "new_prop": 2
}

When I try update I get the following:

{
    "causes": [
        {
            "description": "OBJECT_TYPE_PROPERTY_SCHEMAS_NARROWED",
            "context": "/propertySchemasAdded"
        }
    ],
    "detail": "RuleViolationException: Incompatible artifact: ac3442c0-4314-4770-92b2-5b33c73f0341 [JSON], num of incompatible diffs: {1}, list of diff types: [OBJECT_TYPE_PROPERTY_SCHEMAS_NARROWED at /propertySchemasAdded] Causes: OBJECT_TYPE_PROPERTY_SCHEMAS_NARROWED at /propertySchemasAdded",
    "title": "Incompatible artifact: ac3442c0-4314-4770-92b2-5b33c73f0341 [JSON], num of incompatible diffs: {1}, list of diff types: [OBJECT_TYPE_PROPERTY_SCHEMAS_NARROWED at /propertySchemasAdded] Causes: OBJECT_TYPE_PROPERTY_SCHEMAS_NARROWED at /propertySchemasAdded",
    "status": 409,
    "name": "RuleViolationException"
}
mmmmillar commented 2 hours ago

Error looks like it could be related to #1444