Skip to content

SpringMVC template is ignoring the required attribute in swagger definition when generating @RequestHeader annotation #719

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

Closed
swinz opened this issue May 4, 2015 · 1 comment

Comments

@swinz
Copy link
Contributor

swinz commented May 4, 2015

Given a param definition like this:

  ifNoneMatchHeaderParameter:
    name: If-None-Match
    in: header
    description: https://tools.ietf.org/html/rfc7232#section-3.2
    required: false
    type: string
    format: https://tools.ietf.org/html/rfc7232#section-3.2

the current code generated (SpringMVC) for the RequestHeader is this:

@RequestHeader("ifNoneMatch")

Since RequestHeader has a default value (for required attribute), thus we get a required header when the swagger def defined it as not required. Instead, I think we want this:

@RequestHeader(value="ifNoneMatch", required=false)

The Pull req for this minor change is in #718

@wing328
Copy link
Contributor

wing328 commented Jul 23, 2015

Closing the issue as the PR got merged.

@wing328 wing328 closed this as completed Jul 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants