Skip to content

OpenApi Handler - Overriding all Mutations to Queries results in invalid schema #4889

Closed
@madorb

Description

@madorb

Issue workflow progress

Progress of the issue based on the Contributor Workflow

Make sure to fork this template and run yarn generate in the terminal.

Please make sure Mesh 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

Attempting to override the classification of all operations from an OpenAPI handler from Mutation to Query results in an invalid schema - reports as Type Mutation must define one or more fields.

As long as there is at least one mutation left, this works as expected, but removing all mutations results in this error.

To Reproduce
Steps to reproduce the behavior:

Add an openapi handler that contains queries and mutations, and re-classify all mutations to queries e.g.

        selectQueryOrMutationField:
            - fieldName: 'searchLocation'
              type: Query

Expected behavior

Similar to #1474 the Mutation field should be removed if there are no mutations left after reclassification.

Environment:

  • OS: macos
  • @graphql-mesh/openapi: 0.33.39
  • NodeJS: 16.18.0

Additional context

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