Forum Discussion

Alex_I1's avatar
Alex_I1
New Member
27 days ago

Required: false?

Hello, everyone!

We are using Swashbuckle and ASP.NET Core. The question is, is it possible to make Swagger to generate explicit "Required: false" property for our optional query params? For some reason we can only get "Required: true" for mandatory params, but for optional nothing is being generated

Example of our code that generates "Required: true":

[FromQuery][Required] string? key = "key")

Final Schema:

name: key 

in: query

required: true

schema:

type: string

No RepliesBe the first to reply