Skip to content

Documenting multipart/form-data JAX-RS endpoint triggers jersey validation error #3009

@zsoltherpai

Description

@zsoltherpai

I use jersey (2.27) and implemented a file upload using multipart/form-data. I use swagger jax-rs2 (2.0.5) to document it.

The documentation of InputStream and FormDataBodyPart reveals the objects internals by default, so I used @parameter to override the schema, eg:
@parameter(schema = @Schema(type = "string", format = "binary", description = "blob"))

This triggers a validation error at jersey start on either InputStream or FormDataBodyPart parameter:
[[FATAL] No injection source found for a parameter of type ....
Very weirdly the issue is not completely deterministic, but a few clean / builds / test trigger it.

If I remove the @parameter(schema = ...) annotation, jersey initialization is solid again. Apparently swagger's @parameter annotation interferes with Jersey.

As a workaround I annotated the parameters with @parameter(hidden = true) and documented the parameters in the @operation annotation, that doesn't seem to cause any issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions