swagger-api / swagger-api/swagger-codegen
[Question] OAS 3.0 - multiple content types and schema in the response and requestBody
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
Please refer to the OAS. Codegen 3.0 does not support multiple content types with different schema in the response and requestBody
Question
May I check if the support is in the pipeline?
Swagger-codegen version
Swagger Codegen 3.0
Swagger declaration file content or url
openapi: "3.0.0"
info:
version: 1.0.0
title: Swagger Petstore
license:
name: MIT
servers:
- url: http://petstore.swagger.io/v1
paths:
/pets:
post:
summary: List all pets
operationId: listPets
tags:
- pets
parameters:
- name: limit
in: query
description: How many items to return at one time (max 100)
required: false
schema:
type: integer
format: int32
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
text/plain:
schema:
type: string
responses:
'200':
description: An paged array of pets
headers:
x-next:
description: A link to the next page of responses
schema:
type: string
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
text/plain:
schema:
type: string
components:
schemas:
Pet:
type: object
properties:
Total_Pet:
type: number
minimum: 0
maximum: 10
Suggest a fix/enhancement
For response:
CodegenResponse - a new map to store content type and its associated schema.
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 reviewing the OAS 3.0 declaration in the issue and the CodegenResponse entry point mentioned in the suggested fix. Trace how response and requestBody content types and schemas are represented, then determine what is needed for each content type to be preserved during generation. Done means both examples are supported with their associated schemas.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi
- Domain
- api, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100