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

[REQ] Swift - add unknownDefaultCase #19095

Open
Erokha opened this issue Jul 5, 2024 · 0 comments
Open

[REQ] Swift - add unknownDefaultCase #19095

Erokha opened this issue Jul 5, 2024 · 0 comments

Comments

@Erokha
Copy link

Erokha commented Jul 5, 2024

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

@Erokha Erokha changed the title [REQ] Add unknownDefaultCase [REQ] Swift - add unknownDefaultCase Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant