What's New in Schema Registry
Learn about the new features of Schema Registry in Cloudera Runtime 7.2.11.
Schema Registry Confluent API needs a compatibility endpoint
A new endpoint that checks compatibility between schemas is now available to the Confluent-compatible API.
The endpoint is as follows:
/api/v1/confluent/compatibility/subjects/[***SCHEMA***]/versions/[***VERSION***]
- [***SCHEMA***] is the name of the subject/schema.
- [***VERSION***] is the version that the new schema text is compared
to. The version can be
latest
or a valid version ID.
When using the endpoint, you must specify the schema, version, and the schema text that you want to compare. The schema text can be sent as a data parameter. For example:
curl -X POST "http://\'hostname\':9090/api/v1/confluent/compatibility/subjects/schemaname/versions/latest" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"schema\":\"{\\\"fields\\\":[{\\\"default\\\": \\\"yellow\\\",\\\"name\\\": \\\"color\\\",\\\"type\\\": [\\\"string\\\"]}],\\\"name\\\": \\\"schemaname\\\",\\\"type\\\": \\\"record\\\"}\"}"
The endpoint responds with a compatibility result. This can either be true
or false
.
If the schema is compatible, the endpoint returns a true
response. For
example:
{"compatible":true,"errorMessage":null,"errorLocation":null,"schema":"{\"type\":\"record\",\"name\":\"compatible\",\"fields\":[{\"name\":\"compatible\",\"type\":[\"string\"],\"default\":\"test\"}]}"}
If the schema is not compatible, the endpoint returns a false
response.
This response contains an error message as well as the location where the error was
encountered. For example:
{"compatible":false,"errorMessage":"reader union lacking writer type: STRING","errorLocation":"/fields/0/type/0","schema":"{\"type\":\"record\",\"name\":\"compatible\",\"fields\":[{\"name\":\"compatible\",\"type\":[\"string\"],\"default\":\"test\"}]}"}