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 response may be declared even though Result is empty #3289

Closed
najeira opened this issue May 19, 2023 · 1 comment · Fixed by #3290
Closed

OpenAPI response may be declared even though Result is empty #3289

najeira opened this issue May 19, 2023 · 1 comment · Fixed by #3290

Comments

@najeira
Copy link
Contributor

najeira commented May 19, 2023

When the Result is empty and HTTP Response is StatusOK, OpenAPI responses section gets declared even though SkipResponseBodyEncodeDecode is false.

design

package design

import (
	. "goa.design/goa/v3/dsl"
)

var _ = Service("testService", func() {
	Method("empty", func() {
		Result(Empty) // empty
		HTTP(func() {
			POST("/empty")
			Response(StatusOK) // OK not NoContent
		})
	})
})

got

openapi: 3.0.3
info:
    title: Goa API
    version: "1.0"
servers:
    - url: http://localhost:80
      description: Default server for testService
paths:
    /empty:
        post:
            tags:
                - testService
            summary: empty testService
            operationId: testService#empty
            responses:
                "200":
                    description: OK response.
                    content:
                        application/json:
                            schema:
                                type: string
                                format: binary
components: {}
tags:
    - name: testService

expect

part of responses:

            responses:
                "200":
                    description: OK response.
@raphael
Copy link
Member

raphael commented May 20, 2023

Good catch, thank you for the PR!

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

Successfully merging a pull request may close this issue.

2 participants