swagger-api / swagger-api/swagger-codegen
[lang php] allOf ignored
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
GetSessionListResponse.yaml
description: Response for session list
allOf:
- $ref: '../common/ApiResponse.yaml'
properties:
response:
$ref: '../../models/system/SessionList.yaml'
Variants without ref also don't works:
description: Response for session list
allOf:
- type: object
properties:
success:
type: boolean
errors:
type: array
items:
type: object
properties: {}
response:
type: object
properties: {}
- type: object
properties:
response:
type: object
properties:
memory:
type: string
ApiResponse.yaml
type: object
properties:
success:
type: boolean
errors:
type: array
items:
type: object
properties: {}
response:
type: object
properties: {}
But generated with ignored properties success and errors from allOf: - $ref: '../common/ApiResponse.yaml':
GetSessionListResponse.md
# GetSessionListResponse
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**response** | [**\Model\SessionList**](SessionList.md) | | [optional]
[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md)
But if I use --lang openapi-yaml then all ok. Generated:
components:
schemas:
GetSessionListResponse:
properties:
response:
$ref: '#/components/schemas/SessionList'
description: Response for session list
allOf:
- $ref: '#/components/schemas/ApiResponse'
And correct documentation generated in https://editor.swagger.io/

Swagger-codegen version
swagger-codegen-cli-3.0.22.jar and swagger-codegen-cli-3.0.23.jar
Swagger declaration file content or url
openapi: 3.0.1
info:
title:
version:
servers:
- url:
paths:
/system/getSessionList:
get:
responses:
"200":
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/GetSessionListResponse'
components:
schemas:
GetSessionListResponse:
description: Response for session list
allOf:
- $ref: '#/components/schemas/ApiResponse'
- type: object
properties:
response:
$ref: '#/components/schemas/SessionList'
ApiResponse:
type: object
properties:
success:
type: boolean
errors:
type: array
items:
type: object
properties: {}
response:
type: object
properties: {}
SessionList:
type: object
properties:
sessions:
type: object
additionalProperties:
$ref: '#/components/schemas/Session'
memory:
type: string
Session:
type: object
properties:
session:
type: string
Command line used for generation
docker run --rm -v ${PWD}:/local -w /local openjdk java -jar swagger-codegen-cli.jar generate --input-spec /local/openapi.yaml --lang php --output /local/out/ -c /local/openapi-codegen-php.json
docker run --rm -v ${PWD}:/local -w /local openjdk java -jar swagger-codegen-cli.jar generate --input-spec /local/openapi.yaml --lang openapi-yaml --output /local/out/ -c /local/openapi-codegen-php.json
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement
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
Reproduce the issue with openapi.yaml and the swagger-codegen-cli 3.0.22 or 3.0.23 PHP command, then compare its output with the openapi-yaml generation. Start by locating the PHP generator's handling of the GetSessionListResponse allOf schema; done means the generated PHP documentation includes the inherited success and errors properties.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, php
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100