Skip to content

[fix][Java] Added missing cli option to enable Jackson annotation #21101

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

peace317
Copy link

The option "jackson" is used in most java generators and it seems to be "true" per default except in the jaxrs-cxf-client generator. This option could not be set in the config-options of a maven-plugin, because it was not be added to the cli-options.
This was not be covered by junit tests, as they set this option in the generator. I added an integration test for that purpose.

fix #5077

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in Git BASH)
    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.
  • File the PR against the correct branch: master (upcoming 7.x.0 minor release - breaking changes with fallbacks), 8.0.x (breaking changes without fallbacks)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@wing328
Copy link
Member

wing328 commented Apr 18, 2025

if i understand it correctly, not all Java generators (client, spring, jaxrs, etc) support this option, right?

@peace317
Copy link
Author

@wing328 The option is defined in AbstractJavaCodegen so I would guess most of the java generators use this option. Some of the generators set this property explicitly to true (e.g. SpringCodegen) or you are able to configure it implicitly like with the serializationLibrary for the JavaClientgenerator, but you're not able to configure this option explicitly in for example the maven plugin. Thus for the jaxrs-cxf-client your left with enums without jackson annotations and not beeing able to set it anyway

@wing328
Copy link
Member

wing328 commented Apr 21, 2025

but you're not able to configure this option explicitly in for example the maven plugin

hmm..... adding an option is more for documentation purpose.

without the option, it should still work because options are essentially just additional properties that one can set anything (even though the option is not added explicitly)

@peace317
Copy link
Author

@wing328 I didn't know that. With <additionalProperties>jackson=true</additionalProperties> I could get the same result.
But since in #5077 nobody had an idea how to get to that result, maybe make it an option with proper documentation is not a bad idea. Maybe it's also a question why this property is not true by default like in other generators. I could make the changes. It's up to you

@wing328
Copy link
Member

wing328 commented Apr 23, 2025

@peace317 thanks again for the PR

i agreed with improving the documentation but as this option is not supported by ALL java related generators. we need to make it clear on that in the option description.

Maybe it's also a question why this property is not true by default like in other generators

my guess is that previously some users do not want to have jackson annotation by default

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 this pull request may close these issues.

[Bug][Java] jaxrs-cxf-client missing annotation when generating Enum
3 participants