graphql-tools icon indicating copy to clipboard operation
graphql-tools copied to clipboard

Symbol-valued properties are not copied

Open gabrielschulhof opened this issue 1 year ago • 1 comments

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

mock strips property symbols.

To Reproduce Steps to reproduce the behavior:

At https://github.com/ardatan/graphql-tools/blob/master/packages/mock/src/utils.ts#L34, the code does not iterate over getOwnPropertySymbols.

Expected behavior

Objects are copied, including their symbol-keyed properties.

Environment:

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

Additional context

I don't understand why these properties are skipped. In fact, there is a test to ensure that they are skipped. It was added at https://github.com/ardatan/graphql-tools/commit/6877b9136d532b5dc70d7f431ac2e79c3c8b2b80. Would it be possible to not skip these properties?

Background: We use symbols for annotating and resolving abstract types.

gabrielschulhof avatar Sep 06 '24 20:09 gabrielschulhof