Code Monkey home page Code Monkey logo

Comments (10)

marktani avatar marktani commented on August 31, 2024 4

Thanks a lot for your detailed description, @LawJolla.

I am curious to hear the perspective of @kbrandwijk, @schickling and @freiksenet on this topic 🙂

from graphql-binding.

LawJolla avatar LawJolla commented on August 31, 2024 2

Thanks @schickling !

Here's the minimal repo. (I kept my development / shared endpoints in the code to make it faster on everyone)

https://github.com/LawJolla/graphql-stitched-bindings-example

from graphql-binding.

schickling avatar schickling commented on August 31, 2024 1

Thanks a lot @LawJolla. @timsuchanek will look into this later this week! :)

from graphql-binding.

LawJolla avatar LawJolla commented on August 31, 2024 1

Awesome, thanks @schickling and @timsuchanek! I should be able to give it a spin today.

from graphql-binding.

maxtechera avatar maxtechera commented on August 31, 2024

I'm currently working on a very similar user case. I would like to know how to control which fields get requested when the function is used without info and some doc about fragmentReplacements.
If you can point me in the right direction I might be able to add later to docs.

from graphql-binding.

schickling avatar schickling commented on August 31, 2024

Thanks a lot describing your use case @LawJolla (and apologies for the delayed response). We'll be looking into this over the following days. Can you please provide a minimal repo to reproduce your scenario?

from graphql-binding.

timsuchanek avatar timsuchanek commented on August 31, 2024

Thanks for the example repo @LawJolla ! One question: Here you're providing a separate schema definition for the stitching. Is there a particular reason to not put this into the schema.graphql? https://github.com/LawJolla/graphql-stitched-bindings-example/blob/master/mainServer/src/index.js#L76

We're now working on a utility function that will help with your use case

addFragmentToInfo(info: GraphQLResolverInfo, fragment: string): GraphQLResolverInfo

That solves your issue like this:

addFragmentToInfo(idsAndInfo[0].info, 'fragment EnsurePostId on Image { postId }'),

from graphql-binding.

LawJolla avatar LawJolla commented on August 31, 2024

Thanks @timsuchanek , that would be perfect!

I've tried putting the extend type definition into the schema, but I've always had it kicked back. Maybe I was just doing it wrong. I'll give it a try.

But no, there's no particular reason it's there other than I couldn't get it to work in the schema and Graphql-tools shows that pattern in their old examples.

from graphql-binding.

schickling avatar schickling commented on August 31, 2024

Re extend type: If this turns out to be a bug in graphql-import, please open an issue! This should be a lot simpler this way!

@LawJolla addFragmentToInfo was merged & released yesterday. Want to give it a shot?

from graphql-binding.

LawJolla avatar LawJolla commented on August 31, 2024

Thanks for your help and I'm sorry for the long delay. I ran into errors and then had other business crap come up.

I finally got back to it and it works great. The only thing that's confusing to me is I wanted to use it as..

const info = addFragmentToInfo(...)
await db.query.type(..., info)

But once I changed it to

await db.query.type(..., addFragmentToInfo(...))

It worked perfectly. Thanks for the help!!

from graphql-binding.

Related Issues (20)

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.