Closed
Description
- swagger-ui version 2.7.0
I have used spring-data-rest. Sample code snippet below
@RepositoryRestResource
public interface ReservationRepository extends PagingAndSortingRepository<Reservation, Long> {
@ApiOperation(
value = "Find Reservation by LastName",
notes = "Returns a record of Reservation",
response = Reservation.class)
@ApiResponses(value = {@ApiResponse(code = 404, message = "Invalid LastName")})
@ApiImplicitParams({
@ApiImplicitParam(name = "Authorization", value = "Bearer eyJhbGciOiJSUzI1NiI...",
required = true, dataType = "string", paramType = "header")})
List<Reservation> findByLastNameIgnoreCase(
@ApiParam(name = "ln", type = "query", value = "Last Name", required = true) @Param("ln") String name);
}
The generated swagger doc snippet at http://localhost:8080/v2/api-docs is as follows. As you can see below, the parameter has the value in: "body", while I expect in: "query"
{
"/reservations/search/findByLastNameIgnoreCase": {
"get": {
"consumes": [
"application/json"
],
"description": "Returns a record of Reservation",
"operationId": "findByLastNameIgnoreCaseReservationUsingGET",
"parameters": [
{
"in": "body",
"name": "ln",
"description": "Last Name",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "Authorization",
"in": "header",
"description": "Bearer eyJhbGciOiJSUzI1NiI...",
"required": true,
"type": "string"
}
],
"produces": [
"*/*"
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/Reservation"
}
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Invalid LastName"
}
},
"summary": "Find Reservation by LastName",
"tags": [
"Reservation Entity"
]
}
}
}
This is my dependency
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.7.0</version>
</dependency>
And this points gets ApiParam.class from
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.13</version>
</dependency>
<
5279
div>