Aiven-Open / Aiven-Open/karapace

Check compatibility API does not support verbose mode

Aberta
#454 1 comentário 4 reações 0 responsáveis Ver no GitHub
Linguagem predominante
Python
Estrelas
634
Forks
110
Merge médio
4d 7h
PRs com merge (30d)
4

Descrição

# 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}"]}`

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.