-
-
Notifications
You must be signed in to change notification settings - Fork 143
AvroSchema: Does not include base class for records with subclasses #589
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
Comments
I think a slightly more extensive example would be useful to show how types in question are used (which specific class is schema being generated etc). |
In my case, I am using Jakarta annotations and the respective introspector (see edit above). But any introspector would do. The problem is that the introspector is requested to return the subclasses and does so correctly: Line 45 in 605e79f
The base class is no longer considered, what is correct if it is abstract. However, a non-abstract class should be considered. |
Ah. Good to know the issue. @MichalFoksa WDYT? Sounds like it could be an easy fix if you agree this is something to fix. |
Hi there, |
@MichalFoksa sounds good. Depending on whether change is backwards-compatible, can target different branch: if compatible and appears safe, 2.18 (I am thinking of nominating 2.18 as our first ever LTS branch so trying to get safe fixes merged there, get eventually released); if not API compatible or risky, 2.x (for 2.20). |
…s is not abstract or interface) into union of types.
…ckson.dataformat.avro.schema.RecordVisitor_schemaCreationTest.Cat"
Uh oh!
There was an error while loading. Please reload this page.
I think I encountered an issue in the schema generation of records that are unions:
jackson-dataformats-binary/avro/src/main/java/com/fasterxml/jackson/dataformat/avro/schema/RecordVisitor.java
Line 53 in 605e79f
Given the following example (using Jakarta annotations and the introspector that follows with it):
where the class
Sub
is correctly identified, a value ofSuper
is not allowed in the created union.To avoid this issue,
unionSchemas
should also includetype
, iftype
is non-abstract.The text was updated successfully, but these errors were encountered: