Idea: Improvements to Default OpenAPI Descriptions
See original GitHub issue-
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.
-
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:
- Created 5 months ago
- Comments:5 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You’re right, Just tried the changes out. It works good so far. Thanks again! 💯
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: