-
Notifications
You must be signed in to change notification settings - Fork 240
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
PR #582 in combination with @JsonTypeInfo.defaultImpl generates an "incomplete" Tagged Union #613
Comments
Thanks for precise description. I think easiest fix in typescript-generator would be to disable this new feature when Moreover users can have explicit sub-classes for all types (unlike you) but still have also So I am thinking about adding some configuration parameter which would disable this feature globally for |
Without considering the complexity and maintainability of your proposed solutions, I think the "for some classes" could be a better way. It removes one decision point when integrating typescript-generator. My guesstimation is that overall use of Many kudos for all work with this fantastic tooling! |
In a9bf79c I added |
Released in 2.29.814. |
We ran into breaking changes when upgrading to v2.28.785, due to the new feature in #582. When using JsonTypeInfo in combination with a default class implementation (defaultImpl), then the resulting Tagged Union will capture all the @JsonSubTypes (as a result of #582) but miss the ones covered by the fallback defaultImpl. Not a bug, but perhaps a missing feature?
The short version
In v2.27.744, the provided example generates:
In v2.28.785, the provided example generates:
Issue: Valid values for INamedEntity.type are the enums in INamedEntityType, not "DefaultEntity" | "FACILITY"
The verbose version
The issue is a result of having a default fallback implementation (defaultImpl = DefaultEntity.class in the example) in combination with JsonTypeInfo.Id.NAME and JsonTypeInfo.As.EXISTING_PROPERTY. The example has an enum as the name property but I assume the issue will be present also with a String.
Is there a way of keeping the pre-2.28.785 behaviour, or perhaps have the type attribute include all the enum values? Creating an object in the TypeScript domain that implements INamedEntity will, for obvious reasons fail, when setting type='NORP'.
A complete example is provided here: https://github.com/avtalsbanken/typescript-generator
Code from the example repo included below:
The text was updated successfully, but these errors were encountered: