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

Specify additional known responses other than 200 OK in swagger schema #85

Open
thhermansen opened this issue Oct 26, 2023 · 0 comments

Comments

@thhermansen
Copy link

Tripletex's schema describes 200 OK responses, like this:

image

but it is lacking in regards to describing the other expected responses like 401, 422 etc. This results in generated clients1 not knowing of all responses an operation may yield, in this case it has no knowledge of any errors:

image

If I understand swagger's doc2 correctly it would be appropriate to include other common responses too:

Note that an API specification does not necessarily need to cover all possible HTTP response codes, since they may not be known in advance. However, it is expected to cover successful responses and any known errors. By "known errors" we mean, for example, a 404 Not Found response for an operation that returns a resource by ID, or a 400 Bad Request response in case of invalid operation parameters.

Footnotes

  1. Example https://openapi-ts.pages.dev/

  2. https://swagger.io/docs/specification/2-0/describing-responses/:

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

No branches or pull requests

1 participant