-
-
Notifications
You must be signed in to change notification settings - Fork 347
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
fix: request bodies should take required property into account #1277
Merged
soartec-lab
merged 2 commits into
orval-labs:master
from
AllieJonsson:fix/optional-request-body
Mar 29, 2024
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,223 @@ | ||
openapi: '3.0.0' | ||
info: | ||
version: 1.0.0 | ||
title: Swagger Petstore | ||
license: | ||
name: MIT | ||
servers: | ||
- url: http://petstore.swagger.io/v1 | ||
paths: | ||
/pets: | ||
post: | ||
summary: Create a pet | ||
operationId: createPets | ||
tags: | ||
- pets | ||
parameters: | ||
- name: limit | ||
in: query | ||
description: How many items to return at one time (max 100) | ||
required: false | ||
schema: | ||
type: string | ||
- name: sort | ||
in: query | ||
description: | | ||
Which property to sort by? | ||
Example: name sorts ASC while -name sorts DESC. | ||
required: true | ||
schema: | ||
type: string | ||
enum: | ||
- name | ||
- -name | ||
- description: Header parameters | ||
in: header | ||
name: X-EXAMPLE | ||
required: true | ||
schema: | ||
type: string | ||
enum: | ||
- ONE | ||
- TWO | ||
- THREE | ||
requestBody: | ||
$ref: '#/components/requestBodies/RequiredPetBody' | ||
responses: | ||
'200': | ||
description: Created Pet | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/Pet' | ||
put: | ||
summary: Update a pet | ||
operationId: updatePets | ||
tags: | ||
- pets | ||
parameters: | ||
- name: limit | ||
in: query | ||
description: How many items to return at one time (max 100) | ||
required: false | ||
schema: | ||
type: string | ||
- name: sort | ||
in: query | ||
description: | | ||
Which property to sort by? | ||
Example: name sorts ASC while -name sorts DESC. | ||
required: true | ||
schema: | ||
type: string | ||
enum: | ||
- name | ||
- -name | ||
- description: Header parameters | ||
in: header | ||
name: X-EXAMPLE | ||
required: true | ||
schema: | ||
type: string | ||
enum: | ||
- ONE | ||
- TWO | ||
- THREE | ||
requestBody: | ||
$ref: '#/components/requestBodies/OptionalPetBody' | ||
responses: | ||
'200': | ||
description: Updated Pet | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/Pet' | ||
/cookies: | ||
post: | ||
summary: Create a cookie | ||
operationId: createCookies | ||
tags: | ||
- cookies | ||
parameters: | ||
- name: limit | ||
in: query | ||
description: How many items to return at one time (max 100) | ||
required: false | ||
schema: | ||
type: string | ||
- name: sort | ||
in: query | ||
description: | | ||
Which property to sort by? | ||
Example: name sorts ASC while -name sorts DESC. | ||
required: true | ||
schema: | ||
type: string | ||
enum: | ||
- name | ||
- -name | ||
- description: Header parameters | ||
in: header | ||
name: X-EXAMPLE | ||
required: true | ||
schema: | ||
type: string | ||
enum: | ||
- ONE | ||
- TWO | ||
- THREE | ||
requestBody: | ||
required: true | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/Cookie' | ||
responses: | ||
'200': | ||
description: Created Cookie | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/Cookie' | ||
put: | ||
summary: Update a cookie | ||
operationId: updateCookies | ||
tags: | ||
- cookies | ||
parameters: | ||
- name: limit | ||
in: query | ||
description: How many items to return at one time (max 100) | ||
required: false | ||
schema: | ||
type: string | ||
- name: sort | ||
in: query | ||
description: | | ||
Which property to sort by? | ||
Example: name sorts ASC while -name sorts DESC. | ||
required: true | ||
schema: | ||
type: string | ||
enum: | ||
- name | ||
- -name | ||
- description: Header parameters | ||
in: header | ||
name: X-EXAMPLE | ||
required: true | ||
schema: | ||
type: string | ||
enum: | ||
- ONE | ||
- TWO | ||
- THREE | ||
requestBody: | ||
required: false | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/Cookie' | ||
responses: | ||
'200': | ||
description: Updated Cookie | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/Cookie' | ||
components: | ||
requestBodies: | ||
OptionalPetBody: | ||
description: A JSON object containing pet information | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/Pet' | ||
RequiredPetBody: | ||
description: A JSON object containing pet information | ||
required: true | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/Pet' | ||
schemas: | ||
Pet: | ||
type: object | ||
properties: | ||
id: | ||
type: integer | ||
format: int64 | ||
Cookie: | ||
type: object | ||
properties: | ||
id: | ||
type: integer | ||
format: int64 |
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.
We will continue to maintain the tests, so we would like to keep them to a minimum as much as possible. Is it possible to slim down to a minimized case that only checks the request body?
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.
Absolutely, I'll fix!