Skip to content

Error updating an Avro field type: the server returned an unexpected status code and no error class is registered for this code 422 #5995

Open
@jonsnowseven

Description

@jonsnowseven

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

  1. 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\":\"\"}]}"
  2. Create a backwards compatibility rule for the previous schema
  3. 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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    • Status

      No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions