Skip to content
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

Document how to specify schema for Code Generator #1555

Open
lorensr opened this issue Apr 5, 2022 · 1 comment
Open

Document how to specify schema for Code Generator #1555

lorensr opened this issue Apr 5, 2022 · 1 comment

Comments

@lorensr
Copy link

lorensr commented Apr 5, 2022

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.

@acao
Copy link

acao commented May 4, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants