OpenAPITools / OpenAPITools/openapi-generator

[BUG] Java Jersey3 client throw exception when post multipart/form-data body

Open
#14,337 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Bug Report Checklist
  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

I tried to generate Java Jersey 3 client based on json file (attached below), when I test operation "/import" that POST multipart/form-data, the following error is thrown:
client.ApiException: multipart/form-data not yet supported for serializeToString (http signature authentication)

openapi-generator version

6.3.0-SNAPSHOT

OpenAPI declaration file content or url

openapi: 3.0.3
info:
  contact:
    email: email@email.com
    name: name
    url: https://whatever.com
  description: Internal API
  title: Internal API
  version: 1.0.0
  x-audience: business-unit-internal
  x-api-id: 3addb128-c3fb-4bfe-a5d9-c84b3bd58ca2
servers:
  - description: Local environment
    url: http://localhost:9090/api

paths:
  /authenticated/imports:
    post:
      description: Import
      operationId: import
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - payload
              properties:
                payload:
                  format: binary
                  type: string
      responses:
        204:
          description: Importing completed.
Generation Details
Steps to reproduce

Generate Jersey3 client, and call operation "import".

Related issues/PRs

Similar issue found for Jersey2: https://github.com/OpenAPITools/openapi-generator/pull/12563

Suggest a fix

Apply same fix as done for Jersey2: https://github.com/OpenAPITools/openapi-generator/pull/12563

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the generated Jersey3 client’s multipart/form-data handling for the import operation with the Jersey2 fix in PR 12563. Reproduce the call from the supplied OpenAPI declaration and confirm that the generated client no longer throws the serializeToString exception for multipart requests.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.