gatzjames / insomnia-plugin-graphql-codegen-import

Insomnia plugin that generates GraphQL operations in your workspace
MIT License
9 stars 4 forks source link

[Schema] Support apollo federation schema directives #3

Open Just1nWang opened 2 years ago

Just1nWang commented 2 years ago

Version: 0.3.4

Version: Insomnia 2021.6.0
Release date: 2021/10/28
OS: Darwin x64 21.1.0
Electron: 11.2.3
Node: 12.18.3
V8: 8.7.220.31-electron.0
Architecture: x64
node-libcurl: libcurl/7.73.0 OpenSSL/1.1.1k zlib/1.2.11 brotli/1.0.9 zstd/1.4.9 libidn2/2.1.1 libssh2/1.9.0 nghttp2/1.42.0

Describe the bug Graphql schema include @deprecated, @extends and @external federation directives will prompt Unknown directive "@key"...

Expected behavior Support Apollo Federation Schema.

gatzjames commented 2 years ago

@Just1nWang Thanks! Any idea which directives are required by apollo federation or if there's documentation on how to support it? I was thinking about adding the ability to allow custom directives but federation might be a special case that's supported as is 🤔

renier commented 4 months ago

I think you can just ignore the directives for the purposes of generating a request. The trick is to only ignore those that are not defined in the schema file via a directive statement.