question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Required string query parameters are displayed as Nullable

See original GitHub issue

I am using latest version of Nswag (V13.xx) along with OpenApiDocument.

The string query parameters are displayed as Nullable on Swagger document when using both [Required] [FromQuery] attributes or only the [Required] attribute. Below is the code sample:

public ActionResult<List<Dictionary<string, string>>> Get([Required] [FromQuery] string format) { .... }

Is there another way to make Nswag to no display the string query parameter as Nullable?

Thanks

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

8reactions
RicoSutercommented, Nov 4, 2019

Use [BindRequired] and not [Required]

0reactions
RicoSutercommented, Nov 12, 2019

Updated wiki - please also improve the wiki if you have time and it makes sense, etc.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nullable Types in query string always show as required #555
We are using nullable query string parameters on our controller methods. When using the command line generator, these parameters always show ...
Read more >
c# - Query parameter always required
Query parameter always required · make it optional: string type = null ,. – abdusco · Make the parameter optional: ([FromRoute] int imageId,...
Read more >
How to set default query string parameter value for webapi?
May I know how to set a default query string value for webapi in . NET 6? "errors":{"name":["The name field is required."]}
Read more >
Using Optional and Nullable Properties in API Requests
Learn how optional and nullable properties can be used flexibly in combinations in each parameter of your API requests made from a SDK....
Read more >
Handling query string parameters with no value in ASP.NET ...
Handling query string parameters with no value in ASP.NET Core - Thomas Levesque's . NET Blog.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found