Skip to content
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

[Question]: I have an optional Parameter in my API request with default value. When I do that, in swagger, I dont see required: true for that field. #3190

Open
c6-dark opened this issue Dec 10, 2024 · 3 comments
Labels

Comments

@c6-dark
Copy link

c6-dark commented Dec 10, 2024

What are you wanting to achieve?

paths:
get:
summary: Example endpoint
parameters:
- name: optionalParam
in: query
required: false
schema:
type: string
responses:
'200':
description: Successful response

I am not getting required: false for the optional parameter. Is there a way to explicitly show required: false for optional parameters?

What code or approach do you have so far?

paths:
get:
summary: Example endpoint
parameters:
- name: optionalParam
in: query
required: false
schema:
type: string
responses:
'200':
description: Successful response

Additional context

No response

@martincostello
Copy link
Collaborator

Why would an optional parameter be required?

@c6-dark
Copy link
Author

c6-dark commented Dec 11, 2024

I meant marking it required: false explicitly in swagger

@martincostello
Copy link
Collaborator

Please provide a minimal reproducible example as a GitHub repository that shows the code you have so far to try and generate such a schema.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants