Skip to content

JAX-RS ApiResponse 'response' and 'responseContainer' annotations get duplicated #2588

@vdillon

Description

@vdillon

I used the Swagger Editor to create:

swagger: '2.0'
info:
  version: "0.0.1"
  title: Response annotation test
paths:
 /person:
    get:
      summary: Get all person api
      responses:
        200:
          description: Get all person
          schema:
            type: array
            items:          
              $ref: '#/definitions/Person'
        500:
          description: Unexpected error(s)
          schema:
            $ref: '#/definitions/ApiError'
definitions:
  Person:
    type: object
    properties:
      name:
        type: string
  ApiError:
    type: object
    properties:
      errorMsg:
        type: string

Then I generated JAX-RS Server code from the editor. Here is the APIResponses section in the PersonApi class:

   @io.swagger.annotations.ApiResponses(value = { 
        @io.swagger.annotations.ApiResponse(code = 200, message = "Get all person", response = Person.class, responseContainer = "List"),
        @io.swagger.annotations.ApiResponse(code = 500, message = "Unexpected error(s)", response = Person.class, responseContainer = "List") })

The 'response' and 'responseContainer' annotations from the 200 response block got used in the 500 ApiResponse.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions