relay-tools / vscode-apollo-relay

Simple configuration of vscode-apollo for Relay projects.
MIT License
49 stars 13 forks source link

support __clientField directive #27

Closed mattkrick closed 4 years ago

mattkrick commented 4 years ago

Thank you so much for this repo! relay support was the only thing keeping me tied to webstorm.

this adds support for the __clientField directive.

alloy commented 4 years ago

Hey, thanks! Man, I really need to figure out a way to get better notifications for repos I care more about, sorry for letting this sit.

alloy commented 4 years ago

@mattkrick I had to revert the change, because it's causing many tests to fail in a way that makes me worried that this might also happen when people would install it:

  ● RelayCompatMissingConnectionDirective › Should allow non connectionfields without @connection directive

    Name "__clientField" must not begin with "__", which is reserved by GraphQL introspection.

      36 | 
      37 | function validateDocuments(source: string) {
    > 38 |   return validate(schema, parse(source), [RelayCompatMissingConnectionDirective])
         |          ^
      39 | }
      40 | 
      41 | describe(RelayCompatMissingConnectionDirective, () => {

      at assertValidSchema (node_modules/graphql/type/validate.js:71:11)
      at Object.validate (node_modules/graphql/validation/validate.js:54:35)
      at validateDocuments (tests/RelayCompatMissingConnectionDirective-test.ts:38:10)
      at Object.<anonymous> (tests/RelayCompatMissingConnectionDirective-test.ts:94:20)

Can you redo the PR in a way that leaves the test suite green and ensure this actually works with the latest version of vscode-apollo? (I’m not sure how the graphql-js copy that resides in vscode-apollo could be configured to allow this legacy name.)