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

Add ability to generate int enums #1347

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

holykol
Copy link

@holykol holykol commented Oct 2, 2020

This PR adds @intEnum directive, which, when applied, changes enums to be generated with int values.
Sample generated code: https://gist.github.com/holykol/c8056f4bb80c0b17e3478a85cbd27be2

I have:

  • Added tests covering the bug / feature (see testing)
    Updated any relevant documentation Any suggestions for where to put documentation for this new feature?

closes #366

@coveralls
Copy link

coveralls commented Oct 2, 2020

Coverage Status

Coverage decreased (-0.2%) to 66.055% when pulling 2a8c8ce on holykol:int-enums into 3a31a75 on 99designs:master.

@tarrencev
Copy link

would love this!

@mpieczaba
Copy link

Looking forward to the merge...

@kateile
Copy link

kateile commented May 23, 2022

Any progress on this?

@flymedllva
Copy link

flymedllva commented Jul 12, 2022

I think what's missing is a directive to set the digits for the value by itself. For the same proto, we can set numbers randomly. This would be useful along with using the goModel directive on proto types

As an example

directive @intEnum on ENUM

type TestType @goModel(model: "package.Type") {
    testStatus: TestStatus!
}

enum TestStatus @intEnum {
    NULL # 0
    CREATE @intEnum(value: 50) # 50
    MODIFY # 1
    DELETE @intEnum(value: 100) # 100
}

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

Successfully merging this pull request may close these issues.

Enum with int values
6 participants