Joe
Joe

Reputation: 459

File extension for GraphQL specs

I found this documentation https://the-guild.dev/graphql/modules/docs/essentials/type-definitions but I wonder if there can be any other file extensions for graphql specs.

Upvotes: 3

Views: 4671

Answers (1)

Dan Crews
Dan Crews

Reputation: 3597

Any file can have any file extension. The only thing that matters is that whatever you're injecting it into understands what to do with it. The example you linked to uses .graphql files because the library it's using (@graphql-tools/load-files) defaults to parsing the file extensions ['gql', 'graphql', 'graphqls', 'ts', 'js'], but it looks like you can pass whatever you want in there. The only thing that apparently matters for that library is that if it's not .js or .ts then it has to be utf-8 and SDL.

Upvotes: 3

Related Questions