Skip to content

[Java] Support enums in query params #1347

@cbornet

Description

@cbornet

In Java generation, enums are generated when they are part of a definition object but not when they are a direct method property.
For instance:

"/pet/findByStatus": {
      "get": {
        "tags": [
          "pet"
        ],
        "summary": "Finds Pets by status",
        "description": "Finds Pets by status",
        "operationId": "findPetsByStatus",
        "produces": [
          "application/json",
          "application/xml"
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "description": "Status value that for filter",
             "type": "string",
             "enum": ["available", "pending", "sold"]
            }
         ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/Pet"
              }
            }
          }
        }

Generates "status" as a String not as an enum.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions