GithubHelp home page GithubHelp logo

schema-stitching-examples's Introduction

schema-stitching-examples

This repo is a set of different examples illustrating different use cases of schema stitching.

schema-stitching-examples's People

Contributors

aswinmprabhu avatar wawhal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

schema-stitching-examples's Issues

[schema-extension] `city_weather` fails when selection set doesn't include `city`

Thanks for sharing these examples, they're v. useful!

I've run into an issue within my own project which I think is also present in your schema-extension example.

In short, the following operation will fail to return city_weather:

query GetUser {
    user(id: 1) {
        city_weather {
            temp
        }
    }
}

The reason this fails is because the city_weather resolver depends on parent.city but does not receive it because it's not in the selection set sent to the remote user schema.

Currently I'm just throwing an exception if city_weather is selected without city but this isn't ideal and wondered if you have any thoughts on how one might solve this?

I had thought it might be possible to create a @dependsOn directive which could add city to the query being made to the remote schema, but I don't think field directives can manipulate the parent query or resolvers.

extend type user {
    city_weather: city_weather @dependsOn(field: "city")
}

Example GraphQL server dead

The primary GraphQL endpoint used in the examples is broken:
https://bazookaand.herokuapp.com/v1alhpa1/graphql ENDPOINT DEAD
Returns Heroku's standard Application Error response.

Edit: Actually it's just a typo in a code block in the blog article v1alhpa1 โ†’ v1alpha1 = ๐Ÿ‘Œ

Start errors out, GraphQL Syntax error

For each of the examples, getting GraphQLError: Syntax Error: Expected Name, found } after running npm install followed by npm start.

(node:51878) UnhandledPromiseRejectionWarning: GraphQLError: Syntax Error: Expected Name, found }
    at syntaxError (/Users/br/Library/Mobile Documents/com~apple~CloudDocs/dev/tutorials/graphql/schema-stitching-examples/new-queries-mutations/node_modules/graphql/error/syntaxError.js:24:10)
    at expect (/Users/br/Library/Mobile Documents/com~apple~CloudDocs/dev/tutorials/graphql/schema-stitching-examples/new-queries-mutations/node_modules/graphql/language/parser.js:1299:32)
    at parseName (/Users/br/Library/Mobile Documents/com~apple~CloudDocs/dev/tutorials/graphql/schema-stitching-examples/new-queries-mutations/node_modules/graphql/language/parser.js:92:15)
    at parseFieldDefinition (/Users/br/Library/Mobile Documents/com~apple~CloudDocs/dev/tutorials/graphql/schema-stitching-examples/new-queries-mutations/node_modules/graphql/language/parser.js:809:14)
    at many (/Users/br/Library/Mobile Documents/com~apple~CloudDocs/dev/tutorials/graphql/schema-stitching-examples/new-queries-mutations/node_modules/graphql/language/parser.js:1348:16)
    at parseFieldsDefinition (/Users/br/Library/Mobile Documents/com~apple~CloudDocs/dev/tutorials/graphql/schema-stitching-examples/new-queries-mutations/node_modules/graphql/language/parser.js:799:50)
    at parseObjectTypeDefinition (/Users/br/Library/Mobile Documents/com~apple~CloudDocs/dev/tutorials/graphql/schema-stitching-examples/new-queries-mutations/node_modules/graphql/language/parser.js:757:16)
    at parseTypeSystemDefinition (/Users/br/Library/Mobile Documents/com~apple~CloudDocs/dev/tutorials/graphql/schema-stitching-examples/new-queries-mutations/node_modules/graphql/language/parser.js:663:16)
    at parseDefinition (/Users/br/Library/Mobile Documents/com~apple~CloudDocs/dev/tutorials/graphql/schema-stitching-examples/new-queries-mutations/node_modules/graphql/language/parser.js:143:16)
    at parseDocument (/Users/br/Library/Mobile Documents/com~apple~CloudDocs/dev/tutorials/graphql/schema-stitching-examples/new-queries-mutations/node_modules/graphql/language/parser.js:110:22)
    at Object.parse (/Users/br/Library/Mobile Documents/com~apple~CloudDocs/dev/tutorials/graphql/schema-stitching-examples/new-queries-mutations/node_modules/graphql/language/parser.js:38:10)
    at Object.buildSchemaFromTypeDefinitions (/Users/br/Library/Mobile Documents/com~apple~CloudDocs/dev/tutorials/graphql/schema-stitching-examples/new-queries-mutations/node_modules/graphql-tools/dist/generate/buildSchemaFromTypeDefinitions.js:20:33)
    at Object.makeExecutableSchema (/Users/br/Library/Mobile Documents/com~apple~CloudDocs/dev/tutorials/graphql/schema-stitching-examples/new-queries-mutations/node_modules/graphql-tools/dist/makeExecutableSchema.js:27:29)
    at makeRemoteExecutableSchema (/Users/br/Library/Mobile Documents/com~apple~CloudDocs/dev/tutorials/graphql/schema-stitching-examples/new-queries-mutations/node_modules/graphql-tools/dist/stitching/makeRemoteExecutableSchema.js:134:35)
    at createUserSchema (/Users/br/Library/Mobile Documents/com~apple~CloudDocs/dev/tutorials/graphql/schema-stitching-examples/new-queries-mutations/index.js:30:10)
    at <anonymous>
(node:51878) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:51878) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

The unhandled promise error is a separate issue as far as I can tell.

System: macOS Version 10.13.6 (17G3025)
Node Version: 9.4.0

I wonder if it's to do with a recent upstream node package upgrade?

Is possible to remove some queries or mutations?

Hi, I have followed your examples (good job) but I was searching for how remove some queries or mutations in a proxy server which is getting a remote schema from the main server.

Do you know if is it possible do it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.