Skip to content

Commit

Permalink
Support more valid graphql file extensions (#309)
Browse files Browse the repository at this point in the history
There are two other commonly used graphql file extension we should
support
.gql - used by apollo and other client library to differentiate query
from schema
.graphqls - used by gqlgen and other server library to differentiate
schema from query


https://github.com/apollographql/apollo-tooling/blob/a778ca162bdd20be9e60a914887302390c274644/packages/apollo/src/commands/client/download-schema.ts#L19
  • Loading branch information
zzh8829 authored Feb 16, 2024
1 parent c14574a commit 7740a6a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ When releasing a new version:

- The new `optional: generic` allows using a generic type to represent optionality. See the [documentation](genqlient.yaml) for details.
- For schemas with enum values that differ only in casing, it's now possible to disable smart-casing in genqlient.yaml; see the [documentation](genqlient.yaml) for `casing` for details.
- Support .graphqls and .gql file extensions

### Bug fixes:
- The presence of negative pointer directives, i.e., `# @genqlient(pointer: false)` are now respected even in the when `optional: pointer` is set in the configuration file.
Expand Down
2 changes: 1 addition & 1 deletion generate/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func getQueries(basedir string, globs StringList) (*ast.QueryDocument, error) {
}

switch filepath.Ext(filename) {
case ".graphql":
case ".graphql", ".graphqls", ".gql":
queryDoc, err := getQueriesFromString(string(text), basedir, filename)
if err != nil {
return nil, err
Expand Down

0 comments on commit 7740a6a

Please sign in to comment.