PROPERTY_REMOVED_FROM_CLOSED_CONTENT_MODEL for optional field

Viewed 12

Use draft-7 json schema CLOSED_CONTENT_MODEL and BACKWARD compatibility and confluent schema registry 7.2.1-post.

deps:
    implementation 'com.github.victools:jsonschema-generator:4.26.0'
    implementation 'io.confluent:kafka-schema-registry:7.2.1'

schema example

{
    "type" : "object",
    "properties" : {
      "name" : {
        "type" : "string",
        "description" : "String"
      },
      "timeDescription" : {
        "type" : "string",
        "description" : "String"
      },
    },
    "required" : [ "name"],
    "additionalProperties" : false
}

I am trying to find incompatibilities between schema via {{base_url}}/compatibility/subjects/subject/versions/latest?verbose=true (timeDescription is absent but not required)

{
    "type" : "object",
    "properties" : {
      "name" : {
        "type" : "string",
        "description" : "String"
      },
    },
    "required" : [ "name"],
    "additionalProperties" : false
}

and see 
```json
{
    "is_compatible": false,
    "messages": [
        "Found incompatible change: Difference{jsonPath='#/properties/timeDescription', type=PROPERTY_REMOVED_FROM_CLOSED_CONTENT_MODEL}"
    ]
}

How to disable incompatibilities for case when optional field exists in one schema and absent in another?

Thanks for your answers.

1 Answers

It is not possible to enable or disable compatibilities. You might need select different Schema type.

Related