[0.14] Unable to specify headers when using schema from url
See original GitHub issueIs your feature request related to a problem? Please describe.
Tried updating from 0.13.0 to 0.14.0.
There are no docs for introspection Pugin and how to provide auth header.
Had this npm script for introspection:
"gql-gen:introspect": "gql-gen --schema http://localhost:4000 --header \"Authorization:[key]\" --template graphql-codegen-introspection-template --out ./src/app/graphql/generated/gql-gen-schema.json"
CLI suggested following config:
schema:
- "http://localhost:4000"
documents: []
config: {}
generates:
./src/app/graphql/generated/gql-gen-schema.json:
config: {}
plugins:
- "introspection"
require: []
Describe the solution you’d like Add Docs for Introspection Plugin option and Auth header yaml config syntax.
Describe alternatives you’ve considered
roll back to 0.13.0
Additional context
Also some frustration stitching together the new yaml config.
Before I had the above introspect script and this generate script:
"gql-gen:generate": "gql-gen --schema ./src/app/graphql/generated/gql-gen-schema.json --template graphql-codegen-apollo-angular-template --out ./src/app/graphql/generated/gql-types.ts src/app/graphql/graphql-queries/*.graphql"
Was trail and error to merge it into codegen.yml config:
schema:
- http://localhost:4000
# not sure about Auth header syntax here
- headers:
Authorization:
- "Bearer [key]"
generates:
./src/app/graphql/generated/gql-gen-schema.json:
plugins:
- "introspection"
generates:
./src/app/graphql/generated/gql-types.ts:
config:
noGraphqlTag: true
schema:
- ./src/app/graphql/generated/gql-gen-schema.json
documents: ./src/app/graphql/graphql-queries/*.graphql
plugins:
- typescript-common
- typescript-client
- typescript-apollo-angular
And not even sure if this is correct.
Congrats for launching docs and site looks great!
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (4 by maintainers)
Top GitHub Comments
Done in: https://github.com/dotansimha/graphql-code-generator/pull/874
Docs for URL schema available now in: https://graphql-code-generator.com/docs/getting-started/schema-field#url
Fixed in 0.14.2 🎉