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

Fix a bug that the payload is always required 'true' in swagger documents. #825

Merged
merged 1 commit into from Oct 14, 2016

Conversation

@ikawaha
Copy link
Contributor

@ikawaha ikawaha commented Oct 14, 2016

https://github.com/goadesign/goa/blob/master/goagen/gen_swagger/swagger.go#L882

    if action.Payload != nil {
        payloadSchema := genschema.TypeSchema(api, action.Payload)
        pp := &Parameter{
            Name:        "payload",
            In:          "body",
            Description: action.Payload.Description,
            Required:    true,            // ←★ always true even if optional payloads be used.
            Schema:      payloadSchema,
        }
        params = append(params, pp)
    }
@tchssk
Copy link
Member

@tchssk tchssk commented Oct 14, 2016

Oh I forgot to fix gen_swagger in #507😅

@raphael
Copy link
Member

@raphael raphael commented Oct 14, 2016

Looks great, thank you! Do you think you could also make a PR to the v1 branch? thanks!

@raphael raphael merged commit 272b900 into goadesign:master Oct 14, 2016
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@ikawaha ikawaha deleted the ikawaha:fix/gen_swagger/optional_payload branch Oct 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants