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

BUG Spec generator should ignore org.glassfish.jersey.media.multipart.MultiPart #4661

Open
AlexanderSchuetz97 opened this issue Apr 24, 2024 · 0 comments

Comments

@AlexanderSchuetz97
Copy link

AlexanderSchuetz97 commented Apr 24, 2024

I have a jaxrs endpoint which has to accept a complicated multipart message using Jersey.
This is the endpoint:

    @POST
    @Consumes("multipart/mixed")
    @Produces("application/json")
    @Path("tool/{id}/pipelineparams")
    @Operation(summary = "Does something",
            requestBody = @RequestBody(content = @Content(schema = @Schema(type = "string", format = "binary"))),
            responses = {
            @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = SomeModelClass.class))),
            @ApiResponse(responseCode = "422", description = "Can happen"),
            @ApiResponse(responseCode = "404", description = "Can happen"),
            @ApiResponse(responseCode = "409", description = "Can happen"),
    })
    public Response doSomething(@PathParam("id") String id,  MultiPart multiPart) throws IOException {

The swagger generator plugin will correctly understand that it should treat this endpoint as a "binary" endpoint.
(The other side will have to manually craft the message which I handwrite in the client anyways)

MultiPart is org.glassfish.jersey.media.multipart.MultiPart

For some reason the generator decides to include Model Spec of org.glassfish.jersey.media.multipart.MultiPart.
Due to me overriding the requestBody the Model of MultiPart is not used anywhere but it is still included in the spec. This is not desired as it generates a few very confusing Model Classes in any client generating a client from the spec.

This is one such model that should really not be generated:

      "MultiPart" : {
        "type" : "object",
        "properties" : {
          "bodyParts" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/BodyPart"
            }
          },
          "contentDisposition" : {
            "$ref" : "#/components/schemas/ContentDisposition"
          },
          "entity" : {
            "type" : "object"
          },
          "headers" : {
            "type" : "object",
            "additionalProperties" : {
              "type" : "array",
              "items" : {
                "type" : "string"
              }
            },
            "properties" : {
              "empty" : {
                "type" : "boolean"
              }
            }
          },
          "mediaType" : {
            "$ref" : "#/components/schemas/MediaType"
          },
          "messageBodyWorkers" : {
            "$ref" : "#/components/schemas/MessageBodyWorkers"
          },
          "parameterizedHeaders" : {
            "type" : "object",
            "additionalProperties" : {
              "type" : "array",
              "items" : {
                "$ref" : "#/components/schemas/ParameterizedHeader"
              }
            },
            "properties" : {
              "empty" : {
                "type" : "boolean"
              }
            }
          },
          "parent" : {
            "$ref" : "#/components/schemas/MultiPart"
          },
          "providers" : {
            "$ref" : "#/components/schemas/Providers"
          }
        }
      },

The genrate should completly ignore any "models" in the org.glassfish.jersey.media.multipart and treat them as If they were "InputStream".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant