Skip to content

removeDescriptions optimizer fails to remove descriptions from some nodesΒ #7658

@gibson042

Description

@gibson042

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 npm run 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

optimizeDocumentNode: true fails to remove descriptions for operation/variable/fragment/etc. nodes in request documents.

To Reproduce Steps to reproduce the behavior:

https://stackblitz.com/edit/github-kwqmz3z2?file=document.graphql

Expected behavior

The description nodes are removed, leaving only semantically meaningful syntax.

Environment:

  • @graphql-codegen/client-preset: 5.1.1
  • @graphql-codegen/visitor-plugin-common: 6.1.0
  • @graphql-tools/optimize: 2.0.0

Proposed Fix:

The visit in removeDescriptions should apply transformNode to additional kinds OperationDefinition/VariableDefinition/FragmentDefinition/etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions