Describe the bug
When pointing to a schema in codegen.yml that has a pound sign in the path, graphql-codegen --config codegen.yml fails with:
Unable to find any GraphQL type definitions for the following pointers:
- #test/schema.graphql
To Reproduce
Steps to reproduce the behavior:
any schema
any operations
codegen.yml config file:overwrite: true
schema: "#test/schema.graphql"
generates:
src/generated/graphql.ts:
plugins:
- "typescript"
Expected behavior
I expected it to find the file and generate the types. Instead, it fails as described above. If you remove the pound sign from both the folder and the .yml, it works as expected. Escaping did not help.
Environment:
package.json:
{
"devDependencies": {
"@graphql-codegen/cli": "^1.12.1",
"@graphql-codegen/typescript": "1.12.1",
"graphql": "^14.6.0",
}
Additional context
This is a problem for people trying to use this with AWS Amplify. They name their folder where the schema is generated #current-cloud-backend.
same looks like for directories starting with a plus sign.
@isaiahtaylor We are working on it. Can please try the following in the meantime?
schema: "./#test/schema.graphql"
I would need the plus sign as valid char. I think the current problem relies on the ValidPath Method => https://github.com/ardatan/graphql-toolkit/blob/5071524af2d74318085c8f6c1390f96421da1f75/packages/common/src/helpers.ts#L53
It will not load any of these special signs.
Is it possible to escape it in the next release ? Maybe instead of restricting special chars maybe we could just add "\" before it (or other techniques). This would be awesome. Cheers.
We can try, we tried a regex that would fit Windows users, but it breaks for Mac/Linux users, because + and # are valid there.
@ardatan Can you please take a look? I think maybe just simplifying the Regex should work.
@dotansimha It's fixed in graphql-toolkit
https://github.com/ardatan/graphql-toolkit/commit/a8b136580d13ef933950c5a7515e735f158efb28
@ardatan can you please release new toolkit? or maybe with @kamilkisiela 's new changes?
Fixed in v1.13.1 馃帀