Skip to content
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

[Avro] Unit test for untyped map schema fails in 2.13 branch #281

Closed
MichalFoksa opened this issue May 22, 2021 · 0 comments · Fixed by #282
Closed

[Avro] Unit test for untyped map schema fails in 2.13 branch #281

MichalFoksa opened this issue May 22, 2021 · 0 comments · Fixed by #282

Comments

@MichalFoksa
Copy link
Contributor

MichalFoksa commented May 22, 2021

Unit test TestSimpleGeneration#testSchemaForUntypedMap fails in 2.13 branch.

UnsupportedOperationException exception is thrown instead of expected InvalidDefinitionException exception.

[ERROR] Errors:
[ERROR]   TestSimpleGeneration.testSchemaForUntypedMap:166 » UnsupportedOperation Maps w...

Stack trace:

java.lang.UnsupportedOperationException: Maps with non-stringable keys are not supported yet

	at com.fasterxml.jackson.dataformat.avro.schema.MapVisitor.builtAvroSchema(MapVisitor.java:40)
	at com.fasterxml.jackson.dataformat.avro.schema.VisitorFormatWrapperImpl.getAvroSchema(VisitorFormatWrapperImpl.java:68)
	at com.fasterxml.jackson.dataformat.avro.schema.AvroSchemaGenerator.getGeneratedSchema(AvroSchemaGenerator.java:20)
	at com.fasterxml.jackson.dataformat.avro.AvroMapper.schemaFor(AvroMapper.java:187)
	at com.fasterxml.jackson.dataformat.avro.schema.TestSimpleGeneration.testSchemaForUntypedMap(TestSimpleGeneration.java:166)

In 2.13 UnknownSerializer calls visitor.expectObjectFormat(typeHint) whereas in 2.12, UnknownSerializer calls visitor.expectAnyFormat(typeHint).

It is since FasterXML/jackson-databind@f19e26e

I think the whole fix is to update exception evaluation.

cowtowncoder pushed a commit that referenced this issue May 26, 2021
…f `InvalidDefinitionException`. Reason in 2.13 in that `ToEmptyObjectSerializer` is used to serialize `java.util.Map` which calls `visitor.expectObjectFormat(typeHint)` and thus different exception is thrown at the end and when schema is requested from mapper. (#282)

Co-authored-by: Michal Foksa <Michal.Foksa@external.t-mobile.at>
cowtowncoder added a commit that referenced this issue May 28, 2021
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 a pull request may close this issue.

2 participants