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

openapi spec for non 200 responses #127

Open
jhsc opened this issue May 1, 2024 · 1 comment
Open

openapi spec for non 200 responses #127

jhsc opened this issue May 1, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@jhsc
Copy link

jhsc commented May 1, 2024

To Reproduce
Not sure if this is a bug, or just not implemented yet but I noticed that when the openapi spec is generated there is no error responses. It just generated 200's responses, but in the case we want to have non 200 responses included in the openapi spec how would this be possible? Is there documentation how to generate error responses for handlers?

Expected behavior
For example I have this

"/login": {
      "post": {
        "description": "Authenticates User",
        "operationId": "POST /login:Handler",
        "requestBody": {
          "$ref": "#/components/requestBodies/LoginReq"
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LoginResp"
                }
              }
            },
            "description": "OK"
          },
          "default": {
            "description": ""
          }
        },
        "summary": "Login",
        "tags": [
          "Login"
        ]
      }
    }

I would want to add to the responses spec

"responses": {
          "200": {
            ......
            },
           "401": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadResp"
                }
              }
            },
          },

Framework version (please check if it happens with the last Fuego version before posting):
github.com/go-fuego/fuego v0.13.1

Go version (please check if it happens with the last Go version before posting):
1.22.1

@jhsc jhsc added the bug Something isn't working label May 1, 2024
@EwenQuim
Copy link
Member

We'll work on this after #64 ! In the meantime you can still build a response by using the operation given by fuego.Get

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants