-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
Use enum type for discriminator #13846
Merged
wing328
merged 18 commits into
OpenAPITools:master
from
bernie-schelberg-mywave:issue12412
Jul 4, 2023
Merged
Changes from 13 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
9f35097
Fix #12412 Use enum type for discriminator
bernie-schelberg-mywave 74093a7
Rename variable
bernie-schelberg-mywave d53f07f
Fix required property in test resource
bernie-schelberg-mywave 0cf0de7
Add example of enum mapping to samples
bernie-schelberg-mywave 2519d25
Merge branch 'master' into issue12412
bernie-schelberg-mywave e07aca2
Generate samples
bernie-schelberg-mywave c8b4a9f
Merge branch 'master' into issue12412
bernie-schelberg-mywave 0e08a4a
Generate samples after merging master
bernie-schelberg-mywave d1964ab
Merge branch '7.0.x' into issue12412
bernie-schelberg-mywave e0f1b1c
Regenerate samples
bernie-schelberg-mywave 7857121
Fix raw use of parameterized class
bernie-schelberg-mywave 77cc895
Add test showing serialization and deserialization of classes with en…
bernie-schelberg-mywave 268da29
Remove old generated files
bernie-schelberg-mywave 135f677
Merge branch '7.0.x' into issue12412
bernie-schelberg-mywave 0b0a69f
Merge branch 'master' into issue12412
bernie-schelberg-mywave bb7bbd9
Generate samples
bernie-schelberg-mywave 82e05e3
Merge branch 'master' into issue12412
bernie-schelberg-mywave ac76b0c
Generate samples
bernie-schelberg-mywave 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 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 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 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 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 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 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 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 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 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 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
15 changes: 15 additions & 0 deletions
15
...enapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/Apple.md
This file contains 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,15 @@ | ||
# openapi.model.Apple | ||
|
||
## Load the model package | ||
```dart | ||
import 'package:openapi/api.dart'; | ||
``` | ||
|
||
## Properties | ||
Name | Type | Description | Notes | ||
------------ | ------------- | ------------- | ------------- | ||
**seeds** | **int** | | | ||
|
||
[[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.
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.
The mapping to the enum value might cause problems with the auto generated JsonSubType.
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 actually generated a sample Project:
@welshm Isn't there another issue / pr dealing with duplicated JsonSubTypes?
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.
@bernie-schelberg-mywave Could you please add a enum based discriminator to Ione of the generated sample projects (for example
bin/configs/spring-boot-oneof.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.
I'm running openapi-generator version 6.2.0 and the above is the current behaviour when you add a mapping to the discriminator. Both the derived classes and the mapping values are added as JsonSubTypes.
The documentations seems to indicate that this is the expected behaviour.
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.
@cachescrubber Yes, there's another project for duplicated JsonSubTypes: #13815
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.
Done (added enum based discriminator to samples)