[Java] [Spring] Use deduction configOptions for oneOfInterfaces#20919
[Java] [Spring] Use deduction configOptions for oneOfInterfaces#20919wing328 merged 33 commits intoOpenAPITools:masterfrom
Conversation
# Conflicts: # modules/openapi-generator-cli/pom.xml # modules/openapi-generator-core/pom.xml # modules/openapi-generator-gradle-plugin/pom.xml # modules/openapi-generator-maven-plugin/pom.xml # modules/openapi-generator-online/pom.xml # modules/openapi-generator/pom.xml # modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java # pom.xml
# Conflicts: # pom.xml
# Conflicts: # bin/configs/java-okhttp-user-defined-templates.yaml # modules/openapi-generator/src/main/resources/php-flight/register_routes.mustache # modules/openapi-generator/src/main/resources/php-flight/register_routes_test.mustache # modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java # modules/openapi-generator/src/test/resources/3_0/python/petstore-with-fake-endpoints-models-for-testing.yaml # modules/openapi-generator/src/test/resources/3_0/spring/issue_18340.yaml # samples/client/echo_api/java/okhttp-gson-user-defined-templates/.github/workflows/maven.yml # samples/client/echo_api/java/okhttp-gson-user-defined-templates/.openapi-generator/FILES # samples/client/echo_api/java/okhttp-gson-user-defined-templates/gradle/wrapper/gradle-wrapper.jar # samples/client/echo_api/java/okhttp-gson-user-defined-templates/gradle/wrapper/gradle-wrapper.properties # samples/client/echo_api/java/okhttp-gson-user-defined-templates/gradlew # samples/client/echo_api/java/okhttp-gson-user-defined-templates/gradlew.bat # samples/client/echo_api/java/okhttp-gson-user-defined-templates/info.md # samples/openapi3/client/petstore/python/tests/test_model.py # samples/server/petstore/php-flight/RegisterRoutes.php # samples/server/petstore/php-flight/Test/RegisterRoutesTest.php
# Conflicts: # modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java
small improvements
Merge master
…into useDeductionForOneOfInterfaces # Conflicts: # modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java
Merge master
Add comment to force rebuild
@martin-mfg thanks for the PR. I've merged your changes and master When this PR is merged by @wing328 I will implement the samedi Deduction mechanism for java client using Jackson |
|
Hey there, i was looking for an usage of |
|
Hi @rqton Unfortunately this PR is not merged. Not sure why because it works. In the meantime I use templateDir to override the spring oneof_interface.mustache. |
|
@jpfinne sorry for late review as there are too many PRs can you resolve the merge conflicts when you've time? I'll try to get it merged and included in the upcoming release. |
| @@ -0,0 +1,12 @@ | |||
| generatorName: spring | |||
| outputDir: samples/openapi3/server/petstore/spring-boot-oneof-interface | |||
There was a problem hiding this comment.
what about adding this to the github workflow so that it will be tested moving forward?
https://github.com/OpenAPITools/openapi-generator/blob/master/.github/workflows/samples-spring.yaml
https://github.com/OpenAPITools/openapi-generator/blob/master/.github/workflows/samples-spring-jdk17.yaml
There was a problem hiding this comment.
@wing328 I did not know about this.
Maybe something to add to https://github.com/openapitools/openapi-generator/blob/master/CONTRIBUTING.md
There was a problem hiding this comment.
@wing328 any chance that this PR get merged?
# Conflicts: # modules/openapi-generator/src/main/resources/JavaSpring/oneof_interface.mustache
|
@wing328 is there something missing in this PR? |
|
Just merged. Sorry for the delay Thanks for the PR as always |
…APITools#20919) * fix(java): x-discriminator-value should not produce @JsonTypeName * fix(java): Remove unused getDiscriminatorValue() * build at Fednot * build at Fednot * build at Fednot: skip sonar * scm for release at fednot * build fednot not 7.5.0-FEDNOT-SNAPSHOT * build fednot not 7.5.0-FEDNOT-SNAPSHOT * test all vars * rollback custom pom.xml * commit master * commit test * Samples for deduction * add files for deduction * small improvements * Merge changes from martin-mfg Merge master * Merge changes from martin-mfg Merge master * Merge changes from martin-mfg Add comment to force rebuild * Merge master * regenerate doc * regenerate client * regenerate client --------- Co-authored-by: Jean-Paul Finne <jean-paul.finne@fednot.be> Co-authored-by: martin-mfg <2026226+martin-mfg@users.noreply.github.com>
Fix #20891
Add a new configOption to the spring generator:
useOneOfInterfacesDeduction
When useOneOfInterfaces=true
it allows the generation of an additional annotation on the generated inferface
@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION)
and the necessary @JsonSubTypes
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(upcoming7.x.0minor release - breaking changes with fallbacks),8.0.x(breaking changes without fallbacks)@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)