1

I have confiured io.swagger for my spring-mvc application. The problem is that the garbage values --> ��� are in the description part of the defined parameter as shown in screen shot below.

I have defined this parameter using @ApiImplicitParam

Below is my controller


@RestController
@RequestMapping("/test")
@Api(value = "TestApi", description = "Descriotion")
public class TestController {

@RequestMapping(value = "/apiTest", method = RequestMethod.GET)
    @ApiOperation(notes = "The Test API", value = "Response")
@ApiImplicitParams(value = {
            @ApiImplicitParam(name = "employee", value = "Test description for question purposes", dataType = "string", paramType = "query")
            }
public String getTestData(HttpServletRequest request) {
    return "test";
}

}

The string the "value" of @ApiImplicitParam is giving ���, Below is the screenshot

enter image description here

Community
  • 1
  • 1
  • Are you sure that you do not have some weird characters in your source code? `value = "Test desc`, try to use some text editor to see if you have any such chars in that exact spot. – buræquete Sep 30 '19 at 05:10

2 Answers2

1

Try enabling utf-8 encoding be adding below lines in header HTML file.

<meta http-equiv="X-UA-Compatible" content="IE=edge">
 <meta http-equiv="content-type" content="text/html; charset=utf-8"/>

https://github.com/swagger-api/swagger-ui/issues/3525

Alien
  • 15,141
  • 6
  • 37
  • 57
1
  @ApiImplicitParam(name = "employee", value = "Test description for question purposes", dataType = "string", paramType = "query")
            }

You're getting a garbage value error because, In above code you've done a mistake of dataType = "string" Instead it will be like dataType = "String". The compiler doesn't understand the dataType as you've defined in your code that's why it's printing garbage values instead of an actual values.

Ravi Mengar
  • 1,181
  • 1
  • 11
  • 18