Object query parameters are not listed in the generated OpenAPI file

536 views Asked by At

I'm trying to list the object query parameters in an OpenAPI file generated by swagger-maven-plugin. I have the following endpoint which contains two objects RecargaCupoFilter and Pageable, each object has its own parameters.

@GetMapping(value = "/wallet/recharge", produces = {"application/json; charset=UTF-8"})
@ApiOperation(value = "Allow to query recharge history", produces = "application/json")
@PreAuthorize("isAuthenticated() and (#filter.username == authentication.name or hasAnyRole('ROLE_COORDINADOR_CUPO', 'ROLE_ADMINISTRADOR'))")
@ApiPageable
public ResponseEntity<List<OperacionDTO>> consultarRecargas(RecargaCupoFilter filter, Pageable pageable) {
    pageable = PaginationUtil.ensurePageMaxSize(pageable);
    Page<OperacionDTO> page = cupoService.consultarRecargaCupo(filter, pageable);
    HttpHeaders headers = PaginationUtil
            .generatePaginationHttpHeaders(ServletUriComponentsBuilder.fromCurrentRequest(), page);
    return ResponseEntity.ok().headers(headers).body(page.getContent());
}

When I try to generate an OpenAPI file I get the following:

  /api/wallet/recharge:
    get:
      summary: "Allow to query recharge history"
      description: ""
      operationId: "BilleteraResource_consultarRecargas_GET"
      produces:
      - "application/json; charset=UTF-8"
      parameters:
      - name: "filter"
        in: "query"
        required: true
      - name: "sort"
        in: "query"
        description: "Criterios de ordenamiento, con formato: propiedad(,asc|desc).\
          \ El orden por defecto es ascendente. Se soportan mĂșltiples criterios de\
          \ ordenamiento."
        required: false
        type: "array"
        items:
          type: "string"
        collectionFormat: "multi"
      responses:
        200:
          description: "successful operation"
          schema:
            type: "array"
            items:
              $ref: "#/definitions/OperacionDTO"

I expect to have something like the file generated by SpringFox.

  /api/wallet/recharge:
    get:
      tags:
        - billetera-resource
      summary: Allow to query recharge historyo
      operationId: consultarRecargasUsingGET
      produces:
        - application/json;charset=UTF-8
        - application/json
      parameters:
        - name: offset
          in: query
          required: false
          type: integer
          format: int64
        - name: pageNumber
          in: query
          required: false
          type: integer
          format: int32
        - name: pageSize
          in: query
          required: false
          type: integer
          format: int32

PS: I'm using swagger-maven-plugin because it generates the OpenAPI file in Maven build phase without execute the app.

0

There are 0 answers