-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
[Rust-Axum][Breaking Change] Improve the oneOf
model generator
#20336
Open
Victoria-Casasampere-BeeTheData
wants to merge
8
commits into
OpenAPITools:master
Choose a base branch
from
Victoria-Casasampere-BeeTheData:rust-axum-oneOf-enum
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
1984c1c
Improve the implementation of oneOf
Victoria-Casasampere-BeeTheData 4bca943
Fixed 2.0 schemas; possible freeze present
Victoria-Casasampere-BeeTheData 1e841f0
Fix generate-samples.sh freezing
Victoria-Casasampere-BeeTheData 7ddc1ba
Fix validation of primitive types
Victoria-Casasampere-BeeTheData b8a0ea6
Move oneOf handling to its own method
Victoria-Casasampere-BeeTheData 7ed195a
Fix formatting and add comments
Victoria-Casasampere-BeeTheData 874e41d
Remove allOf based discriminator handling
Victoria-Casasampere-BeeTheData c488a48
Implement a test for v3 oneOf
Victoria-Casasampere-BeeTheData 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
generatorName: rust-axum | ||
outputDir: samples/server/petstore/rust-axum/output/rust-axum-oneof | ||
inputSpec: modules/openapi-generator/src/test/resources/3_0/rust-axum/rust-axum-oneof.yaml | ||
templateDir: modules/openapi-generator/src/main/resources/rust-axum | ||
generateAliasAsModel: true | ||
additionalProperties: | ||
hideGenerationTimestamp: "true" | ||
packageName: rust-axum-oneof | ||
globalProperties: | ||
skipFormModel: "false" | ||
enablePostProcessFile: true |
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
86 changes: 86 additions & 0 deletions
86
modules/openapi-generator/src/test/resources/3_0/rust-axum/rust-axum-oneof.yaml
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,86 @@ | ||
openapi: "3.0.4" | ||
info: | ||
title: "test" | ||
version: "0.0.1" | ||
paths: | ||
"/": | ||
post: | ||
operationId: foo | ||
requestBody: | ||
required: true | ||
content: | ||
"application/json": | ||
schema: | ||
"$ref": "#/components/schemas/Message" | ||
responses: | ||
"200": | ||
description: Re-serialize and echo the request data | ||
content: | ||
"application/json": | ||
schema: | ||
"$ref": "#/components/schemas/Message" | ||
components: | ||
schemas: | ||
Message: | ||
type: object | ||
additionalProperties: false | ||
discriminator: | ||
propertyName: op | ||
oneOf: | ||
- "$ref": "#/components/schemas/Hello" | ||
- "$ref": "#/components/schemas/Greeting" | ||
- "$ref": "#/components/schemas/Goodbye" | ||
title: Message | ||
Hello: | ||
type: object | ||
additionalProperties: false | ||
title: Hello | ||
properties: | ||
op: | ||
type: string | ||
enum: | ||
- Hello | ||
default: Hello | ||
d: | ||
type: object | ||
properties: | ||
welcome_message: | ||
type: string | ||
required: | ||
- welcome_message | ||
required: | ||
- op | ||
- d | ||
Greeting: | ||
type: object | ||
additionalProperties: false | ||
title: Greeting | ||
properties: | ||
d: | ||
type: object | ||
properties: | ||
greet_message: | ||
type: string | ||
required: | ||
- greet_message | ||
required: | ||
- d | ||
Goodbye: | ||
type: object | ||
additionalProperties: false | ||
title: Goodbye | ||
properties: | ||
op: | ||
type: string | ||
enum: | ||
- Goodbye | ||
d: | ||
type: object | ||
properties: | ||
goodbye_message: | ||
type: string | ||
required: | ||
- goodbye_message | ||
required: | ||
- op | ||
- d |
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.
This was annoying to me, it broke string formatting, which made debugging slightly harder.