Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Swift4] Can't get a model with an array of base class working #8054

Open
urispmts opened this issue Apr 22, 2018 · 0 comments
Open

[Swift4] Can't get a model with an array of base class working #8054

urispmts opened this issue Apr 22, 2018 · 0 comments

Comments

@urispmts
Copy link

Description

A model property typed as an array of polymorphic models stores the base class struct.

My yaml defines these three models:

  • section_base (with section_type as a discriminator)
  • images_section (with allOf referencing section_base)
  • texts_section (with allOf referencing section_base)

In addition, I have a model named doc that includes an array of section_base.

Getting a response from the server, the parsing works, but only for the base model (section_base struct) and not for the other section types.

Is it supported? Am I doing something wrong?

Swagger-codegen version

2.4.0-SNAPSHOT

Swagger declaration file content or url

...

  section_base:
    type: object
    discriminator: section_type
    required:
      - section_type
    properties:
      uid:
        type: string
      section_type:
        type: string
      title:
        type: string
  images_section:
    allOf:
      - $ref: '#/definitions/section_base'
      - type: object
        properties:
          desc:
            type: string
  texts_section:
    allOf:
      - $ref: '#/definitions/section_base'
      - type: object
        properties:
          prefix:
            type: string

...

Command line used for generation

-l swift4

Related issues/PRs

#6941

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant