Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@ApiResponse.response of primitive types is reported incorrectly #1120

Closed
tomtit opened this issue Jun 1, 2015 · 0 comments
Closed

@ApiResponse.response of primitive types is reported incorrectly #1120

tomtit opened this issue Jun 1, 2015 · 0 comments
Assignees
Labels
Milestone

Comments

@tomtit
Copy link
Contributor

tomtit commented Jun 1, 2015

Swagger version is 1.5.3-M2-SNAPSHOT (branch develop_2.0)
This test resource:

@Api
@Path("xxx")
public class ResourceXXX {

  @GET
  @Path("test")
  @ApiResponses({ @ApiResponse(code = 400, message = "Message for URL", response = URL.class),
      @ApiResponse(code = 401, message = "Message for Long", response = Long.class),
      @ApiResponse(code = 402, message = "Message for String", response = String.class) })
  public Response test() {
    return null;
  }
}

is reported as follows:

{
  "swagger" : "2.0",
  "paths" : {
    "/xxx/test" : {
      "get" : {
        "operationId" : "test",
        "parameters" : [ ],
        "responses" : {
          "400" : {
            "description" : "Message for URL",
            "schema" : {
              "$ref" : "#/definitions/string"
            }
          },
          "401" : {
            "description" : "Message for Long"
          },
          "402" : {
            "description" : "Message for String"
          }
        }
      }
    }
  },
  "definitions" : {
    "string" : {
      "type" : "object",
      "properties" : {
        "protocol" : {
          "type" : "string"
        },
        "host" : {
          "type" : "string"
        },
        "port" : {
          "type" : "integer",
          "format" : "int32"
        },
        "file" : {
          "type" : "string"
        },
        "authority" : {
          "type" : "string"
        },
        "ref" : {
          "type" : "string"
        },
        "path" : {
          "type" : "string"
        },
        "query" : {
          "type" : "string"
        },
        "userInfo" : {
          "type" : "string"
        },
        "defaultPort" : {
          "type" : "integer",
          "format" : "int32"
        },
        "content" : {
          "type" : "object"
        }
      }
    }
  }
}

As you can see URL was reported as composite class of type string, Long and String were not reported at all.

@webron webron added this to the v1.5 milestone Jun 1, 2015
fehguy added a commit that referenced this issue Jun 6, 2015
Fixed #1120: Models handling has been reworked.
@fehguy fehguy closed this as completed Jun 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants