graphql-scalars
graphql-scalars copied to clipboard
Document how to specify schema for Code Generator
Is your feature request related to a problem? Please describe.
When I look at the docs, it's missing schema field:
https://www.graphql-scalars.dev/docs/quick-start#graphql-code-generator-integration
When I try just:
schema: schema.graphql
where schema.graphql
references eg PositiveInt
, I get:
Something went wrong Failed to load schema for "./src/resolvers-types.ts"
Failed to load schema from ./schema.graphql:
Unknown type: "PositiveInt".
Error: Unknown type: "PositiveInt".
at getNamedType (/Users/me/gh/graphql/node_modules/graphql/utilities/extendSchema.js:427:13)
Describe the solution you'd like
Document what to do. Available formats:
https://www.graphql-code-generator.com/docs/config-reference/schema-field#available-formats
Describe alternatives you've considered
URL worked, but would prefer different solution: .graphql files, code files, or JS export.
try this:
schema:
- scalar PositiveInt
- schema.graphql
also note, if you're using the typescript codegen plugin, you'll also need to map custom scalars to typescript types