-
Notifications
You must be signed in to change notification settings - Fork 460
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
Represent enums on method params #1679
Comments
Hi, thanks for submitting this issue! This is a good catch Update: So this is expected behavior of our code generator unfortunately. The enum you mentioned was kept around for historical purposes along with others, but we removed them to make generation consistent / less error-prone. I certainly agree that an enum would make this method easier to use, but right now our generator renders enums on method params as strings. Although we could add a one-off fix to make |
As a follow-up to my previous response, we won't be bringing back this enum yet - representing request-side enums as string pointers was a conscious design decision we made back when this library moved to pointer-based structures for params (see this RFC for more context). Fixing I'm going to keep this issue open and repurpose it as a broader request to represent request-side enum params as pointers to custom enum types, if that's all right. We have a potential workaround using generics [1] to fix this for all request-side enums, but it would require dropping Go versions <1.18 before we can implement it. [0] Because this library represents params as pointer-based structs, we had to add helper functions like [1] The good news is Go has evolved since that decision was made - the team tinkered around with using generics which would allow us to define the helper as func String[T ~string](v T) *T {
return &v
} so you can call |
Maybe it makes sense to replace |
Is your feature request related to a problem? Please describe.
No response
Describe the solution you'd like
In a previous stripe-go version, we had the following enum:
First, the
default_incomplete
value was missing.Second, it was not used in the Subscription type.
I wonder why it disappeared. Using an enum would prevent any malformed value.
Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: