-
-
Notifications
You must be signed in to change notification settings - Fork 7.2k
[Java] [Spring] Use deduction configOptions for oneOfInterfaces #20919
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
Merged
wing328
merged 33 commits into
OpenAPITools:master
from
jpfinne:useDeductionForOneOfInterfaces
Sep 21, 2025
Merged
Changes from 2 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
aef3b64
fix(java): x-discriminator-value should not produce @JsonTypeName
4199d11
fix(java): Remove unused getDiscriminatorValue()
77a34df
build at Fednot
53832b0
build at Fednot
ad9959e
build at Fednot: skip sonar
eff380a
scm for release at fednot
b3ea3d8
Merge remote-tracking branch 'origin/master'
8fb89ae
Merge remote-tracking branch 'origin/master'
jpfinne 5a29795
build fednot not 7.5.0-FEDNOT-SNAPSHOT
jpfinne 8e83bee
build fednot not 7.5.0-FEDNOT-SNAPSHOT
jpfinne e91cde1
Merge remote-tracking branch 'origin/master'
jpfinne ca5b2e6
test all vars
jpfinne 9263f4c
rollback custom pom.xml
jpfinne 47c61f3
Merge remote-tracking branch 'origin/master'
jpfinne 33a68b2
commit master
jpfinne 15064a4
commit test
jpfinne 5a82c52
Merge remote-tracking branch 'origin/master'
jpfinne 135b972
Merge branch 'master' of https://github.com/jpfinne/openapi-generator
jpfinne 1c8c322
Samples for deduction
jpfinne e7b3c16
add files for deduction
jpfinne df46ce5
small improvements
martin-mfg 3119eca
Merge pull request #2 from martin-mfg/pr_20919_improvements
jpfinne 66a6693
Merge changes from martin-mfg
jpfinne 168d3d1
Merge branch 'master' of https://github.com/jpfinne/openapi-generator…
jpfinne 7634e4c
Merge changes from martin-mfg
jpfinne 58f2588
Merge changes from martin-mfg
jpfinne 59b18e9
Merge remote-tracking branch 'origin/master'
jpfinne e2a998f
Merge remote-tracking branch 'origin/master'
jpfinne 3557514
Merge branch 'master' into useDeductionForOneOfInterfaces
jpfinne a478971
Merge master
jpfinne 0397cc2
regenerate doc
jpfinne 21f1f1c
regenerate client
jpfinne a20aad5
regenerate client
jpfinne File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
generatorName: spring | ||
outputDir: samples/openapi3/server/petstore/spring-boot-oneof-interface | ||
inputSpec: modules/openapi-generator/src/test/resources/3_0/oneof_polymorphism_and_inheritance.yaml | ||
templateDir: modules/openapi-generator/src/main/resources/JavaSpring | ||
additionalProperties: | ||
groupId: org.openapitools.openapi3 | ||
documentationProvider: springdoc | ||
artifactId: springboot-oneof | ||
snapshotVersion: "true" | ||
hideGenerationTimestamp: "true" | ||
useOneOfInterfaces: "true" | ||
useDeductionForOneOfInterfaces: "true" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Animal | ||
|
||
## Enum Variants | ||
|
||
| Name | Description | | ||
|---- | -----| | ||
| Cat | | | ||
| Dog | | | ||
|
||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Cat | ||
|
||
## Properties | ||
|
||
Name | Type | Description | Notes | ||
------------ | ------------- | ------------- | ------------- | ||
**declawed** | Option<**bool**> | | [optional] | ||
|
||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Dog | ||
|
||
## Properties | ||
|
||
Name | Type | Description | Notes | ||
------------ | ------------- | ------------- | ------------- | ||
**bark** | Option<**bool**> | | [optional] | ||
|
||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) | ||
|
||
|
26 changes: 26 additions & 0 deletions
26
samples/client/others/rust/hyper/oneOf/src/models/animal.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* ByRefOrValue | ||
* | ||
* This tests for a oneOf interface representation | ||
* | ||
* The version of the OpenAPI document: 0.0.1 | ||
* | ||
* Generated by: https://openapi-generator.tech | ||
*/ | ||
|
||
use crate::models; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | ||
#[serde(untagged)] | ||
pub enum Animal { | ||
Dog(Box<models::Dog>), | ||
Cat(Box<models::Cat>), | ||
} | ||
|
||
impl Default for Animal { | ||
fn default() -> Self { | ||
Self::Dog(Default::default()) | ||
} | ||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* ByRefOrValue | ||
* | ||
* This tests for a oneOf interface representation | ||
* | ||
* The version of the OpenAPI document: 0.0.1 | ||
* | ||
* Generated by: https://openapi-generator.tech | ||
*/ | ||
|
||
use crate::models; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] | ||
pub struct Cat { | ||
#[serde(rename = "declawed", skip_serializing_if = "Option::is_none")] | ||
pub declawed: Option<bool>, | ||
} | ||
|
||
impl Cat { | ||
pub fn new() -> Cat { | ||
Cat { | ||
declawed: None, | ||
} | ||
} | ||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* ByRefOrValue | ||
* | ||
* This tests for a oneOf interface representation | ||
* | ||
* The version of the OpenAPI document: 0.0.1 | ||
* | ||
* Generated by: https://openapi-generator.tech | ||
*/ | ||
|
||
use crate::models; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] | ||
pub struct Dog { | ||
#[serde(rename = "bark", skip_serializing_if = "Option::is_none")] | ||
pub bark: Option<bool>, | ||
} | ||
|
||
impl Dog { | ||
pub fn new() -> Dog { | ||
Dog { | ||
bark: None, | ||
} | ||
} | ||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Animal | ||
|
||
## Enum Variants | ||
|
||
| Name | Description | | ||
|---- | -----| | ||
| Cat | | | ||
| Dog | | | ||
|
||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Cat | ||
|
||
## Properties | ||
|
||
Name | Type | Description | Notes | ||
------------ | ------------- | ------------- | ------------- | ||
**declawed** | Option<**bool**> | | [optional] | ||
|
||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Dog | ||
|
||
## Properties | ||
|
||
Name | Type | Description | Notes | ||
------------ | ------------- | ------------- | ------------- | ||
**bark** | Option<**bool**> | | [optional] | ||
|
||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) | ||
|
||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wing328 any chance that this PR get merged?