-
-
Notifications
You must be signed in to change notification settings - Fork 37
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
Generate object literals for enums #64
Comments
I am gonna use a different name for the new constant object, is export const mapToPlanetscaleRegion = {
us_east: 'us_east',
us_west: 'us_west',
ap_northeast: 'ap_northeast',
ap_south: 'ap_south',
ap_southeast: 'ap_southeast',
eu_west: 'eu_west',
} as const |
I think I get that, its a map of identifiers to enum names (the values). Not sure its my favourite but subjective somewhat. Some considerations:
|
If we do go with a name that is different than the type name, do we want to centralize this but co-locating with the domain category or centralizing on the function category?
|
I think group by function is better: this way the name would start with lower case letter, which makes it different from a type name that is usually capitalized |
@remorses good enough for us! Left some subjective thoughts above about naming but mostly important here is having the data period so whatever you think is best ultimately! |
If you can allow a way to customize the naming pattern in the CLI/config file that would be ideal :) Customize examples:
I guess anything requiring transformations would be relegated to a config file, not on the CLI. |
You can now import |
We're currently rolling out this pattern.
This is so that frontend code can create enum members and more (such as create zod schema types based on the enum for frontend form validation).
It would be great to have Genql ship (generate) these object literals by default.
The text was updated successfully, but these errors were encountered: