Graphiti icon indicating copy to clipboard operation
Graphiti copied to clipboard

Is there a way to override the name of a Value in an Enum?

Open cshadek opened this issue 1 year ago • 2 comments

A use case of this would be to use enums as camelCase in resolvers, but have the API be snake_case. Or maybe even use a totally different name in the schema. I understand that most other types in the schema allow this.

cshadek avatar Nov 10 '23 17:11 cshadek

@NeedleInAJayStack do you know if this would be difficult implement?

cshadek avatar Nov 17 '23 17:11 cshadek

Hey, I haven't looked too deeply at it, but I think you'd need to add some code here where you would accept the dictionary key instead of setting it directly from the enum value: https://github.com/GraphQLSwift/Graphiti/blob/main/Sources/Graphiti/Enum/Enum.swift#L17

NeedleInAJayStack avatar Nov 17 '23 17:11 NeedleInAJayStack