Giter Club home page Giter Club logo

Comments (5)

gmac avatar gmac commented on May 19, 2024 1

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.

gmac avatar gmac commented on May 19, 2024

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.

tvvignesh avatar tvvignesh commented on May 19, 2024

@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.

tvvignesh avatar tvvignesh commented on May 19, 2024

@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.

tvvignesh avatar tvvignesh commented on May 19, 2024

@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)

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.