Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #2011
Closed
Open
Issue created Jan 28, 2019 by Administrator@rootContributor5 of 5 checklist items completed5/5 checklist items

[BUG][PHP] oneOf produces type `OneOfModelAModelB` in Model $openAPITypes

Created by: sakari

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?script-client-produces-a-wrong-object-for-a-string-enum-type-that-is-used-with-ref))
Description

PHP model is generated with OneOfModelAModelB as type for $openAPITypes for

foo: 
  oneOf:
    - $ref: 'modelA'
    - $ref: 'modelB'
openapi-generator version

master at 046db19a

Suggest a fix

I think that it would be possible to create a type string like oneOf[ModeA, ModelB] in AbstractPhpCodegen.getTypeDeclaration and then deal with that in deserialiser like is done with map[K, V] types. Ie match the type string to oneOf[there and try to deserialize all the enclosed options until a valid deserialization is found.

If this seems like a legit approach I might be willing to do it as I need some reasonable way to handle this. Or if this has been considered before but the plan lacks implementation that would be something I could do also.

Assignee
Assign to
Time tracking