Comments (5)
Sounds about right! Is Stitching starting to make more sense now with some concrete examples? I personally find it to be fairly intuitive given that the subservices are all plain GraphQL, versus Federation where there’s a bunch of magic happening at every layer of the stack to bring it all together.
from schema-stitching-handbook.
I guess I don’t follow the problem here. Looks like you haven’t converted the example into typescript, which I assume you are using? These examples are plain JavaScript. You’d need to add casting information as appropriate to your version of TypeScript. I’m intentionally using JavaScript as a lowest-common denominator.
Please let me know if I’m missing something else here that is technically inaccurate in the example.
from schema-stitching-handbook.
@gmac Thanks for the clarification. I assumed that it was compatible with Typescript out of the box. Will fix it on my end then 👍
from schema-stitching-handbook.
@gmac Btw, I just had to mark the return type as AsyncExecutor
and the error above went away 🎉
import { AsyncExecutor } from '@graphql-tools/delegate';
const makeRemoteExecutor = function(url:string) : AsyncExecutor {
return async ({ document, variables }) => {
const query = typeof document === 'string' ? document : print(document);
const fetchResult = await fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
query, variables
})
});
return fetchResult.json();
};
};
from schema-stitching-handbook.
@gmac Stitching - Yes, Typemerging - In Progress . While I understood the concepts properly with both of ur help and have it setup as part of the stack, I am working to see how I can fit it for my usecases. Will share my progress as I go along.
from schema-stitching-handbook.
Related Issues (16)
- NestJS support HOT 7
- Thank you HOT 8
- Pulling my hairs HOT 13
- Complex authorization with schema stitching HOT 12
- Proxied services occasionally don't respond HOT 1
- Possible bug in subscription? HOT 6
- Remote schema fetching errors HOT 1
- A complex example using type-graphql HOT 1
- Example of a remote schema with a local delegation to a mutation? HOT 3
- Types merge (array of string to another type) HOT 1
- Type Transformation in Stitched Schema Example HOT 1
- Not able to create batchDelegateToSchema with stitching directive SDL HOT 1
- Fetch merged type in parallel HOT 1
- Outdated example: latest GraphQL-tools not supporting subscription
- Passing headers from Gateway to subservices HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from schema-stitching-handbook.