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
  • #7549
Closed
Open
Issue created Sep 30, 2020 by Administrator@rootContributor4 of 4 checklist items completed4/4 checklist items

[BUG] [Swift5] support for oneOf, anyOf, allOf, and discriminator directives

Created by: lightman73

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output? The generated code should support the oneOf, anyOf, allOf directives
Description

If one has a response type defined as :

responses:
    '200':
        content:
            application/json:
                schema:
                    oneOf:
                        - $ref: '#/schemas/someObject1'
                        - $ref: '#/schemas/someObject2'

the generated Swift client has this requestBuilder definition:

let requestBuilder: RequestBuilder<OneOfsomeObject1someObject2>.Type = YourAPI.requestBuilderFactory.getBuilder()

but there is no trace of the OneOfsomeObject1someObject2 type definition in the generated code, thus making it not working.

Is there any way to get a working client for an openApi definition that uses oneOf (or anyOf, allOf) ?

openapi-generator version

5.0.0-SNAPSHOT, compiled from git.

Generation Details

openapi-generator generate -I defs.yaml -g swift5 ./output_dir

Related issues/PRs

https://github.com/OpenAPITools/openapi-generator/issues/2588#issue-429102544 (really old one, possibly relating to the old Swift 4 generator, gives a little suggestion, but not much)

@jgavris @ehyche @Edubits @jaz-ah @4brunu could one you look into the issue and see if there is any way to solve it ? Even a simple idea to point me in the right direction to implement the missing feature would be great...

Assignee
Assign to
Time tracking