swagger-api / swagger-codegen

swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
http://swagger.io
Apache License 2.0
17.02k stars 6.03k forks source link

[JAX-RS] Missing import for http PATCH #1751

Open SalehAly opened 8 years ago

SalehAly commented 8 years ago

Generated code does not contain import for patch requests. import io.swagger.jaxrs.PATCH; is missing spec file

"patch": {
        "tags": [
          "box"
        ],
        "summary": "Patches a box Meta data",
        "description": "",
        "operationId": "updateBox",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "boxId",
            "description": "Id of the box to be edited",
            "required": true,
            "type": "string"
          },
          {
            "in": "body",
            "name": "box",
            "description": "JSON Patch format of the attributes to be edited in a box",
            "required": true,
            "schema": {
              "type":"array",
              "items":{
                "$ref": "#/definitions/PatchDocument"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Box was edited and the a box object returned with the new information ",
            "schema": {
              "$ref": "#/definitions/Box"
            }
          },
          "400": {
            "description": "Bad Request"
          },
          "422": {
            "description": "Unprocessable entry"
          }
        }
      }
wsalembi commented 6 years ago

The generation seems to suppose JAX-RS 2.1 is used (https://javaee.github.io/javaee-spec/javadocs/javax/ws/rs/PATCH.html)

There is an import for javax.ws.rs.* which includes PATCH (added in 2.1)