openapi-generator icon indicating copy to clipboard operation
openapi-generator copied to clipboard

[BUG] [Elm] Enums getting extra value with "UnknownEnumVariableName"

Open Erudition opened this issue 3 years ago • 0 comments

Bug Report Checklist

  • [X] Have you provided a full/minimal spec to reproduce the issue?
  • Using the full Stripe API spec.

  • [X] Have you validated the input using an OpenAPI validator (example)?
  • I used the CLI with validate and it found no issues.

  • [x] Have you tested with the latest master to confirm the issue still exists?
  • Yes

  • [X] Have you searched for related issues/PRs?
Description
openapi-generator version

Latest master

OpenAPI declaration file content or url

https://raw.githubusercontent.com/stripe/openapi/master/openapi/spec3.json

Generation Details
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate    -i https://raw.githubusercontent.com/stripe/openapi/master/openapi/spec3.json    -g elm    -o ./elm-stripeFix

Some enum types turn into a custom type with a bogus constructor:

type TaxExempt
    = TaxExemptUnknownEnumVariableName
    | TaxExemptExempt
    | TaxExemptNone
    | TaxExemptReverse


taxExemptVariants : List TaxExempt
taxExemptVariants =
    [ TaxExemptUnknownEnumVariableName
    , TaxExemptExempt
    , TaxExemptNone
    , TaxExemptReverse
    ]


stringFromTaxExempt : TaxExempt -> String
stringFromTaxExempt model =
    case model of
        TaxExemptUnknownEnumVariableName ->
            ""

        TaxExemptExempt ->
            "exempt"

        TaxExemptNone ->
            "none"

        TaxExemptReverse ->
            "reverse"



... but "TaxExemptUnknownEnumVariableName" does not exist, and the spec json does not seem to indicate any other values besides the valid three...

Erudition avatar Oct 10 '22 05:10 Erudition