-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
[Java][Spring][Issue: 18929] fix missing JsonIgnoreProperties import in oneOf interface file #18930
base: master
Are you sure you want to change the base?
[Java][Spring][Issue: 18929] fix missing JsonIgnoreProperties import in oneOf interface file #18930
Conversation
Can you generate the samples and include as part of this review?
|
Hi @welshm , I ran the scripts locally before committing and it lead to no changes within the repository. I assume that was the expected outcome? I will run them again in the evening, to make sure I did not miss anything. |
I will have to check if there are any samples that include Jackson. If there are, I would expect changes. |
@welshm , I only got to it today. There were some Jackson samples, anyway I added an example for the scenario I was fixing, and (re)generated the sample files. They are part of the second commit. |
import java.util.Objects; | ||
import com.fasterxml.jackson.annotation.JsonSubTypes; | ||
import com.fasterxml.jackson.annotation.JsonTypeInfo; | ||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the annotation which is missing without my fix, and which is the cause of the bug. This sample proves the code is generated correctly.
0d8e6a1
to
02d9562
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Java change looks good - I think you need to rebase or merge master branch to remove other changes unrelated to this PR
@@ -2388,7 +2388,7 @@ private boolean shouldBeImplicitHeader(CodegenParameter parameter) { | |||
@Override | |||
public void addImportsToOneOfInterface(List<Map<String, String>> imports) { | |||
if (additionalProperties.containsKey(JACKSON)) { | |||
for (String i : Arrays.asList("JsonSubTypes", "JsonTypeInfo")) { | |||
for (String i : Arrays.asList("JsonSubTypes", "JsonTypeInfo", "JsonIgnoreProperties")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wing328 FYI as this will affect all Java codegen.
This is copying the behaviour that already exists in Java client though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the overrides from JavaClient and JavaHelidon, which were duplicates of this exact implementation. I presume this is what led to the bug in the first place - someone edited only the override in specialization and forgot about the parent method.
@@ -6,6 +6,7 @@ use super::configuration::Configuration; | |||
pub struct APIClient { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might need to rebase / merge main - I wouldn't expect to see any changes for Rust
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes for Rust (among others) are caused by me adding new sample configs - the bugfixed scenario was previously not present in any of the examples.
Rebased onto upstream master, force pushed to remote as a part of good practice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rebased again, resolved conflict.
02d9562
to
03561af
Compare
Change LGTM - approved from wrong account 🤦 |
03561af
to
170a3e5
Compare
170a3e5
to
b30b92e
Compare
@ondrej-simon thanks for the PR. can you please PM me via Slack to discuss this PR when you've time ? https://join.slack.com/t/openapi-generator/shared_invite/zt-12jxxd7p2-XUeQM~4pzsU9x~eGLQqX2g |
9d51e87
to
69867ac
Compare
69867ac
to
75983de
Compare
Unfortunately some build checks have failed. Seems like I may have uncovered another bug caused by this complicated scenario, which comes to filename generation. An interface CreateParkAnimalCarerPersonResponsibleForDtoOneOfDto is generated, but it is placed into CreateParkAnimalCarerPersonResponsibleForDtoOneOfDtoDto.java file, there is "DtoDto" in the file name, twice instead of once, hence why build does not work. Is it possible to get some assistance with this? I do not know what to look for in the project. |
No idea off the top of my head :( |
I would see if the MODEL_NAME_SUFFIX is being set in the test and if so, does changing it impact the file name and then try to trace it from there.
If I had to guess, it's adding Dto for the when it's generating the model type and then adding Dto again as a model name suffix
|
Fixes #18929
@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) @martin-mfg (2023/08)
PR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*
.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
master
(upcoming 7.7.0 minor release - breaking changes with fallbacks),8.0.x
(breaking changes without fallbacks)