Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check compatibility API does not support verbose mode #454

Open
charlescd opened this issue Aug 30, 2022 · 1 comment
Open

Check compatibility API does not support verbose mode #454

charlescd opened this issue Aug 30, 2022 · 1 comment

Comments

@charlescd
Copy link

What happened?

The check compatibility of a schema API does not support verbose mode.
When using the Confluent Schema Registry client against Karapace, this makes the call to the function testCompatibilityVerbose wrong. This function is based on the verbose mode: if the schema is incompatible, it returns an error list and an empty list otherwise. With Karapace, it will always return an empty list.

What did you expect to happen?

Karapace should support verbose mode.
The URL corresponding to this mode on Confluent Schema Registry is /compatibility/subjects/{subject}/versions/{version}?verbose=true

What else do we need to know?

Karapace used: latest (using the docker-compose provided) at the moment I create this issue.

Steps to reproduce:

Create a schema

curl -X POST -H "Content-Type: application/vnd.schemaregistry.v1+json" \
                    --data '{"schemaType": "JSON", "schema": "{\\"$id\\":\\"https://mycompany.com/myrecord\\",\\"$schema\\":\\"https://json-schema.org/draft/2019-09/schema\\",\\"additionalProperties\\":false,\\"description\\":\\"Json schema for MyRecord\\",\\"properties\\":{\\"id\\":{\\"type\\":\\"string\\"},\\"key3\\":{\\"type\\":[\\"string\\",\\"null\\"]},\\"name\\":{\\"type\\":[\\"string\\",\\"null\\"]}},\\"required\\":[\\"id\\",\\"key3\\"],\\"title\\":\\"MyRecord\\",\\"type\\":\\"object\\"}"}' \
                    http://localhost:8081/subjects/test-key-json-schema/versions

Result: {"id":1}

Compatibility on Karapace

curl -X POST -H "Content-Type: application/vnd.schemaregistry.v1+json" \
                    --data '{"schemaType": "JSON", "schema": "{\\"$id\\":\\"https://mycompany.com/myrecord\\",\\"$schema\\":\\"https://json-schema.org/draft/2019-09/schema\\",\\"additionalProperties\\":false,\\"description\\":\\"Json schema for MyRecord\\",\\"properties\\":{\\"id\\":{\\"type\\":\\"string\\"},\\"new\\":{\\"type\\":[\\"string\\",\\"null\\"]},\\"key3\\":{\\"type\\":[\\"string\\",\\"null\\"]},\\"name\\":{\\"type\\":[\\"string\\",\\"null\\"]}},\\"required\\":[\\"id\\",\\"key3\\",\\"new\\"],\\"title\\":\\"MyRecord\\",\\"type\\":\\"object\\"}"}' \
                   'http://localhost:8081/compatibility/subjects/test-key-json-schema/versions/1?verbose=true'

Result: {"is_compatible": false}

Compatibility on Confluent

curl -X POST -H "Content-Type: application/vnd.schemaregistry.v1+json" \
                    --data '{"schemaType": "JSON", "schema": "{\\"$id\\":\\"https://mycompany.com/myrecord\\",\\"$schema\\":\\"https://json-schema.org/draft/2019-09/schema\\",\\"additionalProperties\\":false,\\"description\\":\\"Json schema for MyRecord\\",\\"properties\\":{\\"id\\":{\\"type\\":\\"string\\"},\\"new\\":{\\"type\\":[\\"string\\",\\"null\\"]},\\"key3\\":{\\"type\\":[\\"string\\",\\"null\\"]},\\"name\\":{\\"type\\":[\\"string\\",\\"null\\"]}},\\"required\\":[\\"id\\",\\"key3\\",\\"new\\"],\\"title\\":\\"MyRecord\\",\\"type\\":\\"object\\"}"}' \
                   'http://localhost:8081/compatibility/subjects/test-key-json-schema/versions/1?verbose=true'

Result: {"is_compatible":false,"messages":["Found incompatible change: Difference{jsonPath='#/properties/new', type=REQUIRED_PROPERTY_ADDED_TO_UNOPEN_CONTENT_MODEL}"]}

@joar
Copy link

joar commented Aug 24, 2023

This is still an issue with kafka-schema-registry-maven-plugin version 6.2.0 and above.

The workaround we use at the moment is to pin kafka-schema-registry-maven-plugin to 6.1.0, but that comes with the tradeoff of not having access to the set-compatibility goal available in newer versions of kafka-schema-registry-maven-plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants