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

integer backed enums are stored as integer properties as opposed to enums #184

Open
mgrider opened this issue Feb 24, 2023 · 1 comment
Open

Comments

@mgrider
Copy link
Contributor

mgrider commented Feb 24, 2023

The issue is that an OpenAPI definition containing something like:

        enum_integer:
          type: integer
          format: int32
          enum:
            - 1
            - 2

...will result in code that looks like:

    public var enumInteger: Int?

That example is from the unit tests:

enum_integer:
type: integer
format: int32
enum:
- 1
- -1

I would prefer/expect to see something more like:

    public enum EnumInteger: Int, Codable {
        case _1 = 1
        case _2 = 2
    }

I'm assuming this was a choice, probably? But maybe there could be a flag for it or something?

@mgrider
Copy link
Contributor Author

mgrider commented Feb 24, 2023

No doubt the negative number complicates things. 😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant