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

Support 204 (empty) response status #307

Closed
vltansky opened this issue Jan 26, 2023 · 2 comments
Closed

Support 204 (empty) response status #307

vltansky opened this issue Jan 26, 2023 · 2 comments
Labels
wontfix This will not be worked on

Comments

@vltansky
Copy link

vltansky commented Jan 26, 2023

I would expect 204 a valid empty response. Right now as I understand according to docs you can define only one valid response, while you can define multiple error responses.

OpenApi example:

        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExampleResponse"
                }
              }
            }
          },
          "204": {
            "description": "NoContent"
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseDetails"
                }
              }
            }
          },
@ecyrbe
Copy link
Owner

ecyrbe commented Jan 26, 2023

When designing an API, you usually want to return consistant results for one REST endpoint.
Because, then you'll have to handle it as an edge case.
Are you stuck with a concrete example where you need this ?
At the moment as a workaround you can make a single schema that accepts both empty result and a complete result.
Zodios client and server will let you return any OK status if it's between 200 and 299.
Just that openAPI docs will not show it.

@stale
Copy link

stale bot commented Feb 25, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Feb 25, 2023
@stale stale bot closed this as completed Mar 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants