Open
Description
Description
Registry
Version: 3.0.6
Persistence type: sql
Error when putting a new version of an Avro Schema that changes an optional field from string
to int
: com.microsoft.kiota.ApiException: the server returned an unexpected status code and no error class is registered for this code 422
From this content:
"{\"type\":\"record\",\"name\":\"ExampleType\",\"fields\":[{\"name\":\"sdfgfsdgsdg\",\"type\":\"string\"},{\"name\":\"field2\",\"type\":\"int\"},{\"name\":\"field3\",\"type\":\"int\",\"default\":\"\"}]}"
to this (notice the change in field3
's type)
"{\"type\":\"record\",\"name\":\"ExampleType\",\"fields\":[{\"name\":\"sdfgfsdgsdg\",\"type\":\"string\"},{\"name\":\"field2\",\"type\":\"int\"},{\"name\":\"field3\",\"type\":\"string\",\"default\":\"\"}]}"
Environment
Apicurio-registry's image in a docker compose:
...
backend:
image: quay.io/apicurio/apicurio-registry:latest-release
container_name: apicurio-registry
environment:
APICURIO_DATASOURCE_URL: 'jdbc:postgresql://database-apicurio:5432/apicurio-registry'
APICURIO_DATASOURCE_USERNAME: apicurio-registry
APICURIO_DATASOURCE_PASSWORD: password
APICURIO_STORAGE_KIND: "sql"
APICURIO_STORAGE_SQL_KIND: "postgresql"
QUARKUS_HTTP_PORT: 8081
LOG_LEVEL: "DEBUG"
QUARKUS_OIDC_TLS_VERIFICATION: "none"
QUARKUS_HTTP_CORS_ORIGINS: '*'
QUARKUS_PROFILE: "prod"
APICURIO_RULES_GLOBAL_VALIDITY: "SYNTAX_ONLY"
APICURIO_REST_DELETION_ARTIFACT_ENABLED: "true"
APICURIO_REST_DELETION_ARTIFACT_VERSION_ENABLED: "true"
ports:
- 8081:8081
...
Steps to Reproduce
- Create an Avro schema with first version with this content
"{\"type\":\"record\",\"name\":\"ExampleType\",\"fields\":[{\"name\":\"sdfgfsdgsdg\",\"type\":\"string\"},{\"name\":\"field2\",\"type\":\"int\"},{\"name\":\"field3\",\"type\":\"int\",\"default\":\"\"}]}"
- Create a backwards compatibility rule for the previous schema
- Create a new schema version with content
"{\"type\":\"record\",\"name\":\"ExampleType\",\"fields\":[{\"name\":\"sdfgfsdgsdg\",\"type\":\"string\"},{\"name\":\"field2\",\"type\":\"int\"},{\"name\":\"field3\",\"type\":\"string\",\"default\":\"\"}]}"
Expected vs Actual Behaviour
An error thrown due to compatibility violation.
Logs
Apicurio Registry SDK stacktrace:
com.microsoft.kiota.ApiException: the server returned an unexpected status code and no error class is registered for this code 422
at com.microsoft.kiota.ApiExceptionBuilder.withMessage(ApiExceptionBuilder.java:45)
at io.kiota.http.vertx.VertXRequestAdapter.throwIfFailedResponse(VertXRequestAdapter.java:370)
at io.kiota.http.vertx.VertXRequestAdapter.send(VertXRequestAdapter.java:170)
at io.apicurio.registry.rest.client.groups.item.artifacts.item.versions.VersionsRequestBuilder.post(VersionsRequestBuilder.java:114)
at io.apicurio.registry.rest.client.groups.item.artifacts.item.versions.VersionsRequestBuilder.post(VersionsRequestBuilder.java:93)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
No status
Activity