swagger-api / swagger-api/swagger-codegen
[PHP] Namespace missing for AllOf, OneOf Models
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Expecting the package namespace on $swaggerTypes and $swaggerModelName but it's missing for AllOf, OneOf references.
protected static $swaggerTypes = [
'date_restriction_ref' => '\MyApp\Model\DateRestrictionType',
'date_restriction_type' => 'AllOfSpecialDateRestrictionType'
];
protected static $swaggerModelName = 'AllOfSpecialDateRestrictionType';
Swagger-codegen version
3.0.4
Swagger declaration file content or url
openapi: "3.0.0"
info:
description: "test"
version: 1.0.0
title: Test AllOf, OneOf
components:
schemas:
Special:
type: object
properties:
dateRestrictionRef:
$ref: "#/components/schemas/DateRestrictionType"
dateRestrictionType:
allOf:
- $ref: "#/components/schemas/DateRestrictionType"
- type: object
properties:
propone:
type: boolean
DateRestrictionType:
type: string
enum:
- One
- Two
- Three
Command line used for generation
docker run -it -v $(pwd):/opt/gen swaggerapi/swagger-codegen-cli-v3:latest generate --invoker-package MyApp --model-package "Model" --api-package "Api" -i /opt/gen/spec.yaml -l php -o /opt/gen/client
Steps to reproduce
Generate using above yaml and command. Note in AllOfSpecialDateRestrictionType.php and Special.php class names are missing the namespace
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
Generate the PHP client from the supplied OpenAPI YAML using the documented Docker command, then inspect AllOfSpecialDateRestrictionType.php and Special.php. Compare the names in $swaggerTypes and $swaggerModelName with the namespaced DateRestrictionType reference; done means AllOf and OneOf model references include the package namespace.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, openapi, php
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100