Skip to content

[Swift] Inheritance issue #2588

Open
Open
@SergeyPetrachkov

Description

@SergeyPetrachkov
Description

Hi guys, I've installed the latest generator via homebrew and now I'm trying to generate a client for my iOS app.
I appreciate structs over classes (Apple does too!), but here is one problem with inheritance, as Swift structs being value types do not support inheritance. There's a base class and a few descendants described in API yaml. Descendants do not inherit base's properties and I get invalid API client.

openapi-generator version

3.3.4 (latest available with Homebrew

OpenAPI declaration file content or url

here is a gist

Sorry, I can't provide the full spec

Command line used for generation

openapi-generator generate -l swift4 -i XXX

Suggest a fix/enhancement

I would think of either generating abstract descendants as classes or use a composition pattern and stay with structs. Though I am not sure either is easily possible

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