-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
Spring generates duplicated JsonSubTypes #13150
Comments
I also came across this bug using 6.0.0. |
Hi! |
For me, this is also a problem. We make heavy use of inheritance and Jackson will serialize the values incorrect. The type value is now Foo instead foo, which is not even part of my discriminator options: |
Same problem for me, event with version 6.2.0 of the openapi-generator-maven-plugin |
if you add an
will lead to:
tested with 6.2.0 |
cc @cachescrubber (2022/02) @welshm (2022/02) @MelleD (2022/02) @atextor (2022/02) @manedev79 (2022/02) @javisst (2022/02) @borsch (2022/02) @banlevente (2022/02) @Zomzog (2022/09) |
…ustom mapping exists
I created 2 PRs to resolve this issue - the first one (#13802) adds a new configuration option to control the behaviour. This may be preferred as there may be users depending on the multiple schema mapping names. Alternatively, the second one (#13815) treats the issue as a bug, and will not add the default mapping name if a custom name or an |
I think this is the exception to the rule. I believe most people want a one to one mapping, and if the use case arises for multiple, allow people to just specify that, makes the most sense. If I specify a single mapping, why would two generate? However, I understand that this would be a breaking change for users if they relied on the side effect of producing multiple JSON sub types, but to say it isn't a bug, seems wrong. Further it is evident in the discussion here that in earlier versions it didn't always do this. So it seems like a regression happened somewhere. So with all that said, Im in favor of #13815 With all that said, thank you for the PRs! |
Hi, |
@arandth The advice I've received is that it will likely be included in the 7.0.0 release, scheduled for Q1/Q2 next year. |
Oh, that's disappointing that it takes so long to integrate a bug-fix in the tool :-( |
Thank you for the pull request. I really hope this issue is resolved soon. |
…14984) * fix #13150 Do not add schema / class name mapping where custom mapping exists * update test spec * improve import * fix import for mapped models * fix python * code clean up * fix dart client import * fix dart:core import * better import * add tests --------- Co-authored-by: Bernie Schelberg <[email protected]>
Hello, could we reopen this issue? The problem is still there, still getting duplicated update: maybe my issue was something different, however |
Can confirm, issue had returned and specifying |
Hello everyone,
When I use the openapi-generator with a discriminator and mapping, it generates two @JsonSubTypes
Generates something like this
Notice the duplication. The Foo is the class name of the class, and the lowercase foo is my mapping. Wtf is going on lol. This doesn't seem right.
The
Foo
class is defined something likeI am using version 6.0.1 and the schema version is
openapi: '3.0.0'
Here's the full spec to generate the incorrect thing:
I generated this by running
java -jar openapi-generator-cli.jar generate -i schema.yaml -o foo -g spring
The text was updated successfully, but these errors were encountered: