Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix generation of "schema" section for a "body" parameter to contain correct "type" & "format"#968

Merged
dilipkrish merged 1 commit into
springfox:masterfrom
acourtneybrown:master
Sep 11, 2015
Merged

Fix generation of "schema" section for a "body" parameter to contain correct "type" & "format"#968
dilipkrish merged 1 commit into
springfox:masterfrom
acourtneybrown:master

Conversation

@acourtneybrown
Copy link
Copy Markdown
Contributor

I ran into a problem where the Swagger2 JSON document generated from a SpringBoot application with the following API method:

  @RequestMapping(...)
  @ResponseStatus(...)
  public void setThreshold(..., @RequestBody int threshold) { ... }

would include the following for the @RequestBody parameter

{
  "in": "body",
  "name": "threshold",
  "description": "threshold",
  "required": true,
  "schema": {
    "type": "int"
  }
}

This JSON has "int" for the "type" property, when it should be "integer", with "format": "int32".

This pull request updates ParameterMapper to ensure that it uses io.swagger.models.properties.Property for the "schema" "type" and "format" information, similar to what is done for collections and maps in that class.

@dilipkrish dilipkrish merged commit 8242344 into springfox:master Sep 11, 2015
@dilipkrish
Copy link
Copy Markdown
Member

Thank you for catching that! and for the pr! 🍻

@dilipkrish dilipkrish added the PR label Sep 11, 2015
@dilipkrish dilipkrish added this to the 2.3.0 milestone Sep 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants