Skip to content

[REQ] Swift - add unknownDefaultCase #19095

@Erokha

Description

@Erokha

Is your feature request related to a problem? Please describe.

Hi, thanks for your tool, it's amazing!
After using it for a while I found out that there is no way to generate fallback case in OneOf enums. And after adding one more case to OneOf, older clients will fail to decode it

Describe the solution you'd like

I think that it might be useful to have a flag for generating additional default unknown case in OneOf. For example

oneOfUnknownDefault = false

public enum CalypteWidget: Codable, JSONEncodable, Hashable {
    case value1(Value1)
    case value2(Value2)

    ...
}

oneOfUnknownDefault = true

public enum CalypteWidget: Codable, JSONEncodable, Hashable {
    case value1(Value1)
    case value2(Value2)
    case unknownDefault

    ...
}

I've already created pull request draft for it - #19094

Describe alternatives you've considered

Additional context

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