Overriding default scalars
See original GitHub issueI have a custom resolver for GraphQL’s ID
scalar, which sends strings to the client but resolves to integers for the server.
I have tried specifying a custom type inside gql-gen.json
, however I still get string
inside the generated types.
Is there a way to override the types for default scalars such as ID
?
// gql-gen.json
{
"generatorConfig": {
"scalars": {
"ID": "number"
}
}
}
# schema.graphql
type MyType {
id: ID!
}
// types.ts
export interface MyType {
id: string;
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Overriding standard ID scalar - graphql - Stack Overflow
So have to parse uuid from string everywhere I use ID type. I wonder is it possible to override ID type with my...
Read more >Custom scalar types in Apollo Kotlin - Apollo GraphQL Docs
To interact with custom scalars in your Apollo Kotlin app, ... you can also do this with a built-in scalar (such as ID...
Read more >Scalars - Hot Chocolate - ChilliCream GraphQL Platform
String is for example automatically mapped to a StringType in the schema. We can override these mappings by explicitly specifying type bindings.
Read more >Override scalar style for particular properties - Google Groups
override the default style on `DumperOptions` but that means all scalars use the literal style and I really only want to use it...
Read more >Custom Scalars and Enums – GraphQL Tools
The GraphQL specification includes the following default scalar types: Int , Float , String , Boolean and ID . While this covers most...
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
I can confirm that it works for me now with the alpha branch
Found an issue about CLI’s
gql-gen.json
handling. Thank you!