Skip to content

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

Open
@lightman73

Description

@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

#2588 (comment) (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...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions