Skip to content

Add SDL for client directives#5205

Merged
hwillson merged 2 commits intoapollographql:masterfrom
jasonpaulos:client-schema-defs
Sep 4, 2019
Merged

Add SDL for client directives#5205
hwillson merged 2 commits intoapollographql:masterfrom
jasonpaulos:client-schema-defs

Conversation

@jasonpaulos
Copy link
Copy Markdown
Contributor

@jasonpaulos jasonpaulos commented Aug 19, 2019

Since apollographql/apollo-tooling#1433 was merged for the Apollo VS Code extension, which by default requires definitions for all directives, I believe apollo-client should provide definitions for its custom directives. These definitions can be used as follows in the apollo.config.js file that the VS Code extension reads:

var apolloClientSchema = require.resolve('apollo-client/schema.graphql');

module.exports = {
  client: {
    name: 'Space Explorer [web]',
    service: 'apollographql-8341',
    includes: [
      'src/**/*.{ts,tsx,js,jsx,graphql,gql}',
      apolloClientSchema
    ]
  }
};

While the above pull request makes an exception for apollo-client by automatically including a version of the apollo-client directives defined here, I believe that the definitions should ideally live in this repository so that they can grow with the apollo-client codebase. Additionally, the presence of a schema.graphql file will allow users to include the directives as shown above, in case they want to override the Apollo directives provided by the extension.

To my understanding, the addition of schema.graphql will increase the apollo-client package size, but should not result in an increase to the bundle size of any app using apollo-client, since schema.graphql is used only during build time.

I'm curious to hear any feedback 🙂


Here is a similar PR for apollo-link-rest: apollographql/apollo-link-rest#228

Copy link
Copy Markdown
Member

@hwillson hwillson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jasonpaulos!

@hwillson hwillson merged commit 36aa292 into apollographql:master Sep 4, 2019
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Feb 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants