OpenAPITools / OpenAPITools/openapi-generator

[BUG][JAVA] Multipart Content-ID header missing from client library generation

Open
#15,499 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

given a multipart endpoint description like this:

requestBody:
  content:
    multipart/form-data:
      schema:
        type: object
        properties:
          json_metadata:
            $ref: '#/components/schemas/myschema'
          files:
            type: array
            items:
              type: file
              format: binary
      encoding:
        json_metadata:
          contentType: application/json
        files:
          contentType: application/octet-stream
          headers:
            Content-Id:
              schema:
                type: string

When Generating a client in java (or any language/generator that I tried, for that matter), I do not see any reference to the Content-Id header. it does not appear to be set or available to set. Am I missing something?

openapi-generator version

6.6.0

OpenAPI declaration file content or url

https://www.3gpp.org/ftp/Specs/archive/OpenAPI/Rel-15/TS29518_Namf_Communication.yaml

Generation Details

java -jar openapi-generator-cli-6.6.0.jar generate -i ./my-api.yaml -g java --global-property skipFormModel=false

Steps to reproduce

specify a Content-Id header in a multipart request. generate a client. there will be no reference to Content-Id in any of the generated code.

Related issues/PRs
Suggest a fix

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 with the linked TS29518_Namf_Communication.yaml and reproduce generation using openapi-generator-cli 6.6.0 with the Java generator and skipFormModel=false. Trace how the multipart encoding and its Content-Id header are represented in the generated client; done means the generated code includes a way to set or emit that header.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi
Domain
api, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.