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.

Idea: Improvements to Default OpenAPI Descriptions

See original GitHub issue
  1. Produces 200 is always set. This is a reasonable default; however, how can we handle cases where the endpoint may only return, for example, just a 201? The Swagger doc will output a 200 where that endpoint doesn’t return that. Describe() with clearDefaults=true would require you to have to describe everything again, not just the sucessful response(s), and potentially missing other defaults for an endpoint.

  2. Since endpoints are authorized by default, would it be good to add in a default for 401? AnonymousVerbs is empty unless AllowAnonymous is set for any verb. On an aside, I believe there isn’t a way yet to set Produces for different verbs, but for now, here’s an example:

if (Definition.AnonymousVerbs?.Any() != true)
{
    b.Produces(401);
}

What are your thoughts?

Issue Analytics

  • State:closed
  • Created 5 months ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
austinscommented, Apr 20, 2023

You’re right, Just tried the changes out. It works good so far. Thanks again! 💯

1reaction
dj-nitehawkcommented, Apr 20, 2023

done in 5.8.1.13-beta

however, FastEndpoints.ProblemDetails class is not the default. FastEndpoints.ErrorResponse is.

if you want to make ProblemDetails the default you’d have to do this to change the default:

app.UseFastEndpoints(config =>
{
    config.Errors.UseProblemDetails();
});
Read more comments on GitHub >

github_iconTop Results From Across the Web

OpenAPI | IntelliJ IDEA Documentation
An OpenAPI Specification (OAS) is a description format for REST APIs. Swagger is a set of tools based on this specification for writing, ......
Read more >
OpenAPI 3.0: How to Design and Document APIs ... - YouTube
The OpenAPI Specification (OAS), based on the original Swagger 2.0 specification, has emerged as the world's standard for defining and ...
Read more >
10 Essentials When Creating an Open API Specification
Best essentials when creating an OpenAPI Specification · 1. Compose a clear and concise API title · 2. Write a comprehensive API description...
Read more >
Proposal: Default responses for all endpoints #521
I suggest that we add "default responses" that can be defined as default response for All endpoints. This would avoid copy-paste for some ......
Read more >
Document a FastAPI App with OpenAPI | Linode Docs
To get an idea of what the schema looks like by default, go to the app and click the openapi. json link. The...
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