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

Support validation against multiple schemas. #31

Merged
merged 5 commits into from
Dec 7, 2016

Conversation

rwe
Copy link
Contributor

@rwe rwe commented Nov 28, 2016

This is a backwards-compatible change which supports multiple option groups being passed in. Tags must be unique and can refer to different schemas.

This is useful for codebases that interact with multiple GraphQL endpoints. In our case, we have multiple backend services exposing their own GraphQL schemas, and this allows us to lint their usage via backend-specific tags.

For example:

const FooQuery = Foo.gql`{ foos(first: 10) { id } }`;
const BarQuery = Bar.gql`{ bars(last: 10) { name } }`;

via the configuration:

module.exports = {
  "parser": "babel-eslint",
  "rules": {
    "graphql/template-strings": ['error', {
      env: 'apollo',
      tagName: 'Foo.gql',
      schemaJson: require('./foo-schema.json')
    }, {
      env: 'relay',
      tagName: 'Bar.gql',
      schemaJson: require('./bar-schema.json')
    }]
  },
  plugins: [
    'graphql'
  ]
}

If #26 and #28 can be merged in first, I'd be happy to rebase this against those changes.

@jackyzhen
Copy link

I have this exact use case. Please merge!

@stubailo
Copy link
Contributor

stubailo commented Dec 6, 2016

Hi, sorry for the long delay - I was on vacation! If you could rebase over the other PRs then I can merge. Looks like a good change!

@rwe
Copy link
Contributor Author

rwe commented Dec 7, 2016

@stubailo - No worries, vacation is a good thing! Hope it was great. This has been rebased against master.

@stubailo stubailo merged commit 96307ab into apollographql:master Dec 7, 2016
@stubailo
Copy link
Contributor

stubailo commented Dec 7, 2016

Out in 0.4.0, thanks a bunch!

@rwe rwe deleted the multi-tags branch December 10, 2016 21:38
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