Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@graphql-tools/git-loader can't find definitions if they are in the upper directory #5101

Closed
4 tasks
Tracked by #5201 ...
inokawa opened this issue Mar 7, 2023 · 2 comments
Closed
4 tasks
Tracked by #5201 ...

Comments

@inokawa
Copy link

inokawa commented Mar 7, 2023

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 generate in the terminal.

    Please make sure the GraphQL Tools package versions under package.json matches 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:

  1. Create a monorepo like project structure.
├── .git
├── schemas
│   └── sample.graphql
└── packages
    └── graphql-loader
        └── index.js
        └── package.json
  1. Move to packages/graphql-loader dir.
  2. 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);
})();
  1. Step 3 will throw Error: Unable to find any GraphQL type definitions for the following pointers:.
  2. Even if we pass cwd option 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

@ardatan
Copy link
Owner

ardatan commented Mar 7, 2023

Would you create a PR for a reproduction or maybe you can tackle this issue?

@ardatan
Copy link
Owner

ardatan commented Apr 23, 2023

Closing the issue due to the inactivity. We can reopen it when you create a PR for a reproduction or a failing test. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants