swagger-api / swagger-ui

Swagger UI is a collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.
https://swagger.io
Apache License 2.0
26.66k stars 8.97k forks source link

Checking - DefaultValue for RequestBody is not working #3637

Closed VibhutiVohra closed 7 years ago

VibhutiVohra commented 7 years ago
I have an API that takes a String input json as RequestBody. The input Json String is then validated against a Java pojo. If the input string matches the pojo then we proceed with the API call. I want the swagger model to show the json corresponding to the pojo. Tried the defaultValue of ApiParam but it does not work. Please help @ApiParam(value="CheckCardEligibilityRequest", defaultValue = "I give json here..." ) String checkCardEligibilityRequestV1Json, @RequestHeader(value = "uuid", required = false) String uuid, @RequestHeader(value = "Accept", required = true) String accept, @RequestHeader(value = "Content-Type", required = true) String contentType) ....
Q A
Bug or feature request?
Which Swagger/OpenAPI version?
Which Swagger-UI version?
How did you install Swagger-UI?
Which browser & version?
Which operating system?

Demonstration API definition

your: "API definition goes here"

Configuration (browser query string, constructor, config.yaml)

{
  "your": { "constructorConfig": "here" }
}

?yourQueryStringConfig=here

Expected Behavior

Current Behavior

Possible Solution

Context

shockey commented 7 years ago

Hey @VibhutiVohra, please fill out the Q&A section and provide an API definition that demonstrates your problem, so we can reproduce the issue. Thanks!

VibhutiVohra commented 7 years ago
Q A
Bug or feature request?  Bug
Which Swagger/OpenAPI version?  Springfox-swagger2 , version 2.5.0
Which Swagger-UI version?  2.5.0
How did you install Swagger-UI?  using it in Java
Which browser & version?  tried in chrome 60.0.31

Which operating system? Windows

API definition @RequestMapping(value = "/wallet/walletProvisioning/accounts/eligibility", method = RequestMethod.POST) @ApiOperation("The purpose of this message is to check with the issuer whether the supplied RPAN is eligible for requesting a tokenized card. The issuer can also provide assets, and terms and conditions to override the default pre-configured values. Note that no risk checks will be performed as part of this call.") @ApiResponses(value = { @ApiResponse(code = 400, message = "### Request was not processed.\n" + "|Type|Code|Details|\n|----------|----------|--------------------|\n|"

shockey commented 7 years ago

@VibhutiVohra, thanks! unfortunately, Swagger-UI 2.x is no longer under development, so this isn't something we will fix.

there's a ticket open on Springfox's side to update to Swagger-UI's 3.x series: https://github.com/springfox/springfox/issues/1870

i'm going to close this issue, feel free to reply if you have any other concerns!