OpenAPITools / OpenAPITools/openapi-generator
[BUG] JAVA OpenApi generator - multiple content types with different MIME types
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Hello everyone,
are multiple content types with different MIME types supported by JAVA OpenApi generator, as in the example below?
We are using version 6.0.1 of the generator.
Generating gives the warning:
[WARNING] Multiple schemas found in the OAS 'content' section, returning only the first one (application/text)
---
openapi: 3.0.3
info:
title: An API
version: 'v1'
tags:
- name: Response
paths:
/response/{p1}:
get:
tags:
- Response
parameters:
- $ref: '#/components/parameters/p1'
summary: Get the response
operationId: getResponse
responses:
'200':
description: Returns a Response
content:
application/text:
schema:
type: string
application/json:
schema:
$ref: '#/components/responses/ResponseDto'
components:
parameters:
p1:
in: path
name: p1
description: xxx
example: xxx
required: true
schema:
type: string
responses:
ResponseDto:
description: Returns the Response
content:
application/json:
schema:
$ref: '#/components/schemas/ResponseDto'
schemas:
ResponseDto:
properties:
value:
example: x
type: string
API generated for this:
@RequestMapping(
method = RequestMethod.GET,
value = "/response/{p1}",
produces = "application/json"
)
ResponseEntity<String> getResponse(
@PathVariable("p1") String p1
);
If multiple content types with different MIME types are supported, can you please provide a working example.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the Java OpenAPI generator at version 6.0.1 with the OpenAPI document and response definition shown in the issue, then inspect the generated getResponse method and the warning about multiple schemas. Compare the generated produces value with both declared MIME types; done means the supported behavior is established and covered by a reproducible example or regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- backend-api-design, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100