Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SDL for rest directive #228

Merged
merged 1 commit into from
Nov 5, 2019
Merged

Add SDL for rest directive #228

merged 1 commit into from
Nov 5, 2019

Conversation

jasonpaulos
Copy link
Contributor

Since version 1.10.0 of the Apollo VS Code extension, which by default requires definitions for all directives, I believe apollo-link-rest should provide a schema definition for the @rest directive. This definition can then be used as follows in the apollo.config.js file that the VS Code extension reads:

var apolloRestSchema = require.resolve('apollo-link-rest/schema.graphql');

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

This will allow developers to validate their use of directives and provide many IntelliSense features, such as autocompletion and argument information on hover for directives. A history of the relevant VS Code changes can be found here: apollographql/apollo-tooling#1433


Here is a similar PR for apollo-client: apollographql/apollo-client#5205

@codecov-io
Copy link

codecov-io commented Aug 23, 2019

Codecov Report

Merging #228 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #228   +/-   ##
=======================================
  Coverage   92.71%   92.71%           
=======================================
  Files           3        3           
  Lines         412      412           
  Branches      123      123           
=======================================
  Hits          382      382           
  Misses         28       28           
  Partials        2        2

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4ed4e83...e25c9e0. Read the comment docs.

@jasonpaulos jasonpaulos requested a review from fbartho August 23, 2019 18:39
@fbartho fbartho added this to the 0.8.0 milestone Aug 23, 2019
Copy link
Collaborator

@fbartho fbartho left a comment

Choose a reason for hiding this comment

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

I have no problem adding this schema.graphql file into our exports. Thanks for figuring all that out!

Does this mean apollo-cli code generation will also understand the @rest(…) directive going forwards?

Additional question, if a user is using: apollo-link-rest, local state through resolvers, and an ApolloServer backend, how should they configure their apollo.config.js file?
-- Relatedly, should we add your example apollo.config.js entries into the links/rest docs? (https://github.com/apollographql/apollo-link-rest/tree/master/docs mirroring the content from: https://github.com/apollographql/apollo-link/tree/master/docs/source/links/rest.md rendered at https://www.apollographql.com/docs/link/links/rest.html)

Are there any useful unit tests that we can apply here?

@fbartho fbartho merged commit 55d7b1f into apollographql:master Nov 5, 2019
@jasonpaulos jasonpaulos deleted the client-schema-defs branch December 1, 2019 16:33
@fbartho
Copy link
Collaborator

fbartho commented Mar 5, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants