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
  • Merge requests
  • !2021

[PHP] Provide oneOf types in php code generation

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/smartlyio/oneof-codegen into master Jan 30, 2019
  • Overview 0
  • Commits 2
  • Pipelines 0
  • Changes 4

Created by: sakari

(this is fairly work in progress but I would like to get feedback if this is at all sensible approach to this before going much further)

Fixes https://github.com/OpenAPITools/openapi-generator/issues/2011

For Models openAPITypes map the idea is to encode oneOf values as string oneOf[type1, .., typeN] in the property dataType template variable

For Models that consist of a oneOf block like

model:
  oneOf:
    - $ref: modelA
    - type: array
      items: string

We generate a new template variable oneOfTypes containing the list of options which in turn get used to generate a new method Model::oneOf which return a list

['\fully\qualified\name\modelA', 'string[]']

@jebentier @dkarlovi @mandrean @jfastnacht @ackintosh @ybelenko @renepardon @wing328

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/smartlyio/oneof-codegen