Error when piping async output to --stdin
See original GitHub issueHello,
Thanks for a very useful package. I stumbled upon a weird error when piping a schema from an async node script. I suspect the issue originates with getSchemaFromFileDescriptor.
I have no prior experience with stdin
, but, outside of keeping your code synchronous, is there a reason you didn’t use stdin.on('data')
and stdin.on('end')
events to build the schema string?
To Reproduce
- test.js:
setTimeout(() => {
console.log(`
type Starship {
id: ID!
name: String!
}
type Query {
starship: Starship
}
`)
}, 1000)
- Run
node test.js | graphql-schema-linter --stdin
- Error:
The --stdin option was specified, but not schema was provided via stdin.
No valid schema input.
Expected behaviour
Expected it to validate the schema.
Additional context
I’m using graphql-import@beta to import multiple types from a schema generated by openapi-to-graphql. I am redeclaring some types from there, so I cannot run the linter against them, as duplicate definition errors will show up.
I think it’s also a better method than requiring graphql-schema-linter
to support all schema extensions (i.e. #147, #155)
graphql-import@beta
became async
and now my pipe to graphql-schema-linter --stdin
fails.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (5 by maintainers)
Top GitHub Comments
Should be fixed in
v0.2.6
. Thanks again @dnerdy.We’ve seen an uptick in this issue recently, so I’ve gone ahead and created a PR.