ifDirective on enum value not working
See original GitHub issueI have the following scenario:
gql file:
directive @lookup on ENUM
directive @lookupItem(id:Int! ,name: String!) on ENUM_VALUE
enum Color @lookup{
RED @lookupItem(id:1 ,name: "Red")
GREEN @lookupItem(id:2 ,name: "Green")
}
handlebars file:
{{#each enums}}
{{#ifDirective this "lookup"}}
export const {{../name}}Lookup = {
{{#each ../values }}
{{value}}: { {{#ifDirective this "lookupItem"}}id:{{id}},name:'{{name}}'{{/ifDirective}} } ,
{{/each}}
}
{{/ifDirective}}
{{/each}}
gql-gen.json:
{
"flattenTypes": true,
"primitives": {
"String": "string",
"Int": "number",
"Float": "number",
"Boolean": "boolean",
"ID": "string"
}
}
output file:
export const ColorLookup = {
RED: {},
GREEN: {}
};
expected output:
export const ColorLookup = {
RED: {id:1,name:'Red'},
GREEN: {id:2,name:'Green'}
};
What I did wrong? Please help.
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
If statement not working as expected on combined enum value
Seems the [Flags] attribute wasn't set on the enum as I originally thought. Adding this attribute now makes the enum work in either...
Read more >Enumerations — The Swift Programming Language (Swift 5.7)
An enumeration defines a common type for a group of related values and enables you to work with those values in a type-safe...
Read more >ENUM - MariaDB Knowledge Base
If a DEFAULT clause is missing, the default value will be: NULL if the column is nullable;; otherwise, the first value in the...
Read more >Enum Statement - Visual Basic - Microsoft Learn
Declares an enumeration and defines the values of its members. ... The following example shows how to use the Enum statement.
Read more >11.3.5 The ENUM Type
The numbers are translated back to the corresponding strings in query results. and these potential issues to consider: If you make enumeration values...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@kabytaa great 😃 we’ll release a stable version with this fix soon (and then i’ll close the issue). Until then you can use the alpha 😃
Great, it works now. Thanks