Skip to content

Improve error message in AvroAliasTest #441

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

Merged

Conversation

apupier
Copy link
Contributor

@apupier apupier commented Jan 5, 2024

it gives the reason of schema incompatibility when the schema is expected to be compatible. It can help investigation on #167

difference of output when test is faling (for isntance when upgrading avro dependency to 1.9):
current main branch;

[�[1;31mERROR�[m] �[1;31m  AvroAliasTest.testAliasedRecordForwardsCompatible:69 expected:<[]COMPATIBLE> but was:<[IN]COMPATIBLE>

with this Pull Request:

[�[1;31mERROR�[m] �[1;31m  AvroAliasTest.testAliasedRecordForwardsCompatible:69->checkSchemaIsCompatible:119 Expected schema to be compatible but was not. Reason:
Data encoded using writer schema:
{
  "type" : "record",
  "name" : "Employee",
  "namespace" : "com.fasterxml.jackson.dataformat.avro.AvroTestBase",
  "fields" : [ {
    "name" : "name",
    "type" : "string"
  }, {
    "name" : "age",
    "type" : "int"
  }, {
    "name" : "emails",
    "type" : {
      "type" : "array",
      "items" : "string",
      "java-class" : "[Ljava.lang.String;"
    }
  }, {
    "name" : "boss",
    "type" : "Employee"
  } ]
}
will or may fail to decode using reader schema:
{
  "type" : "record",
  "name" : "NewEmployee",
  "namespace" : "com.fasterxml.jackson.dataformat.avro.interop.annotations.AvroAliasTest",
  "fields" : [ {
    "name" : "name",
    "type" : "string"
  }, {
    "name" : "age",
    "type" : "int"
  }, {
    "name" : "emails",
    "type" : {
      "type" : "array",
      "items" : "string",
      "java-class" : "[Ljava.lang.String;"
    }
  }, {
    "name" : "boss",
    "type" : "NewEmployee"
  } ],
  "aliases" : [ "com.fasterxml.jackson.dataformat.avro.AvroTestBase$.Employee" ]
}

it gives the reason of schema incompatibility when the schema is
expected to be compatible. It can help investigation on FasterXML#167

Signed-off-by: Aurélien Pupier <[email protected]>
@cowtowncoder cowtowncoder merged commit 955e711 into FasterXML:2.17 Jan 5, 2024
@cowtowncoder
Copy link
Member

Makes sense, thanks!

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

Successfully merging this pull request may close these issues.

2 participants