yonaskolb / SwagGen

OpenAPI/Swagger 3.0 Parser and Swift code generator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

When enum case is unrecognised and `enumUndecodableCase`=true, how can I know the value?

Ricardo1980 opened this issue · comments

Hello,

When using the option enumUndecodableCase, we will use the unknown case when a value is not recognised by the data mapping generated code.
#141
#135

How can I know the value that was not recognised? Is there any way?

Right now we have:

struct PaymentMethod {
    enum Type {
        case creditCard
        case unknown
    }

    let type: Type
}

Would be possible to have something similar to this?

struct PaymentMethod: String {
    enum Type {
        case creditCard
        case unknown(_ value: String)
    }

    let type: Type
}

Thanks a lot.