-
-
Notifications
You must be signed in to change notification settings - Fork 833
Closed
Description
Issue workflow progress
Progress of the issue based on the Contributor Workflow
- 1. The issue provides a reproduction available on Github, Stackblitz or CodeSandbox
Make sure to fork this template and run
yarn generatein the terminal.Please make sure the GraphQL Tools package versions under
package.jsonmatches yours. - 2. A failing test has been provided
- 3. A local solution has been provided
- 4. A pull request is pending review
Describe the bug
@graphql-tools/git-loader can't find graphql definitions if they are in the upper directory.
This might be because git ls-tree can't search upper directory by default.
To Reproduce
Steps to reproduce the behavior:
- Create a monorepo like project structure.
├── .git
├── schemas
│ └── sample.graphql
└── packages
└── graphql-loader
└── index.js
└── package.json
- Move to
packages/graphql-loaderdir. - Run
packages/graphql-loader/index.js. The code is like below.
import { loadSchema } from '@graphql-tools/load';
import { GitLoader } from '@graphql-tools/git-loader';
(async () => {
const schema = await loadSchema('git:origin/master:./schemas/**/*.graphql', {
loaders: [new GitLoader()],
});
console.log(schema);
})();- Step 3 will throw
Error: Unable to find any GraphQL type definitions for the following pointers:. - Even if we pass
cwdoption to loadSchema, it will fail.
Expected behavior
Can load graphql definitions.
Environment:
- OS: macOS
@graphql-tools/git-loader: 7.2.20@graphql-tools/load: 7.8.12- NodeJS: 19.7.0
Additional context
Metadata
Metadata
Assignees
Labels
No labels