swagger-api / swagger-api/swagger-codegen

PHP Client SDK generates classes only for the first specified media type

Open
#11,124 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

API spec contains multiple media types for the same response (application/json and application/xml). However, generated PHP Client SDK creates only classes that work with xml models.
netbeans64_XNioYEHSES

Swagger-codegen version

v. 3.0.27 for OpenAPI 3.0

Swagger declaration file content or url

responses:
'200':
description: successful operation
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Pet'
application/xml:
schema:
type: array
items:
$ref: '#/components/schemas/Pet'

Suggest a fix/enhancement

Response for applications/json stands first, so I assume this might be the possible reason.
opera_kFYh4pmxnT

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 provided OpenAPI 3.0 response containing both application/json and application/xml, then generate the PHP Client SDK with swagger-codegen v3.0.27 and compare the resulting models. Done means the generated SDK supports classes for both media types rather than only the first or XML models.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, php
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.