ardatan/graphql-mesh

Unable to use encapsulate transform with OpenAPI adapter

Closed this issue · 3 comments

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

To Reproduce Steps to reproduce the behavior:
Setup a basic project with an openapi subgraph and use the encapsulation transform. It will not encapsulate the fields correctly like is suggested here.

https://codesandbox.io/p/devbox/romantic-snowflake-k8dsq1

Expected behavior

It should create a wrapper type of name petstoreQuery that has the fields, and the Query root type should be set to that.
Environment:

  • OS: MacOS 14.4
  • @graphql-mesh/...:
    • compose-cli: 1.1.4
    • @omnigraph/openapi: 0.107.4
  • NodeJS: 22.9.0

Additional context

Thanks for creating the issue!
Could you update the sandbox? I think you forgot to save it.

Ah I see what I'm missing here. It looks like it just hides the existing fields of the Query type using the @hidden directive instead of removing them all together. This seems to be working as intended, but maybe it's worth updating the docs to be a bit more clear?