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

Regression in the getDirectives function #6435

Closed
4 tasks done
oalexander opened this issue Aug 13, 2024 · 1 comment
Closed
4 tasks done

Regression in the getDirectives function #6435

oalexander opened this issue Aug 13, 2024 · 1 comment

Comments

@oalexander
Copy link
Contributor

oalexander commented Aug 13, 2024

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

It appears that in a recent release of the utils package, there is a regression in the getDirectives function (diff). The new exported function getDirectiveExtensions can cause an undefined error while iterating over an incorrect path. In previous versions, this case was handled.

To Reproduce Steps to reproduce the behavior:

The following code throws an error:

 const objectType = new GraphQLObjectType({
            name: 'TestObject',
            fields: () => ({})
        });
      getDirectiveExtensions(objectType, undefined, ['not', 'a', 'real', 'path'])

Expected behavior

The getDirectiveExtensions (and its callers) should successfully handle an invalid path.

Environment:

  • OS:
  • @graphql-tools/...:
  • NodeJS:

Additional context

@ardatan
Copy link
Owner

ardatan commented Aug 13, 2024

Thanks for the issue! Could you create a PR with a failing test?

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