tailcall icon indicating copy to clipboard operation
tailcall copied to clipboard

Create a `@call` operator

Open tusharmath opened this issue 1 year ago • 8 comments

The @call operator will allow our users to call the resolver by name that is specified in the root Query and Mutation. Here is an example of how it would work.

schema {
  query: Query
}

type Query {
  posts: [Post] @http(path: "/path")
  user(id: Int): User @http(path: "/user/{{args.id}}")
}

type Post {
  id: Int
  title: String
  userId: Int
  user: User @call(query: "user", args: {id: "{{value.userId}}"})
}

The @call will simply call the resolver that's set in Query.user field with the arguments specified via args.

This feature gives us the ability to define functions using the Tailcall DSL, which means we can add some form of reusability and modularity.

Technical Requirements

  • The function can only be called if the input and output type match exactly. In the above example Query::user returns a User and Post::user also returns a User so it's compatible with its return type. Similarly, we can see that the args are also exactly the same.

tusharmath avatar Dec 30 '23 10:12 tusharmath

/bounty 250

tusharmath avatar Dec 30 '23 10:12 tusharmath

💎 $250 bounty created by tailcallhq 🙋 If you'd like to work on this issue, comment below to get assigned 👉 To claim this bounty, submit a pull request that includes the text /claim #846 somewhere in its body

📝 Before proceeding, please make sure you can receive payouts in your country. 💵 Payment arrives in your account 2-5 days after the bounty is rewarded. 💯 You keep 100% of the bounty award. 👍 If you go above and beyond by cleaning up or enhancing aspects beyond the scope of the PR, a tip may be awarded as a token of appreciation. 🙏 Thank you for contributing to tailcallhq/tailcall!. 🙋‍♂️ Join our discord channel if you need help.

👉 Add a bountyShare on socials

algora-pbc[bot] avatar Dec 30 '23 10:12 algora-pbc[bot]

/attempt #846 Can I get this assigned?

Khalid6468 avatar Dec 30 '23 10:12 Khalid6468

@Khalid6468: The Tailcall Inc. team prefers to assign a single contributor to the issue rather than let anyone attempt it right away. We recommend waiting for a confirmation from a member before getting started.

algora-pbc[bot] avatar Dec 30 '23 10:12 algora-pbc[bot]

hey @tusharmath . Previously assigned work is done now I am waiting for your confirmation to start working on this one.

Rutik7066 avatar Dec 30 '23 10:12 Rutik7066

/attempt #846 Putting myself on the queue 🤚🏽

wesleymatosdev avatar Dec 30 '23 13:12 wesleymatosdev

@ologbonowiwi: The Tailcall Inc. team prefers to assign a single contributor to the issue rather than let anyone attempt it right away. We recommend waiting for a confirmation from a member before getting started.

algora-pbc[bot] avatar Dec 30 '23 13:12 algora-pbc[bot]

@Khalid6468 All the best! Looking forward to your PR.

tusharmath avatar Dec 31 '23 06:12 tusharmath

@Khalid6468 could you please share your status on this?

If it's not much it's might be better to reassign to @ologbonowiwi that made some progress on this

meskill avatar Jan 03 '24 17:01 meskill

@meskill I haven't made much progress on this one so far and its taking some time to understand the codebase and get familiar. I went through different operator implementations and just started working on the implementation for this one. You can reassign it as it might take a day or two more for me to complete this and it would just be duplication of effort.

Khalid6468 avatar Jan 04 '24 05:01 Khalid6468

💡 @ologbonowiwi submitted a pull request that claims the bounty. You can visit your bounty board to reward.

algora-pbc[bot] avatar Jan 29 '24 17:01 algora-pbc[bot]

Action required: Issue inactive for 30 days. Status update or closure in 7 days.

github-actions[bot] avatar Feb 28 '24 20:02 github-actions[bot]

We started to review/make some changes again yesterday.

wesleymatosdev avatar Feb 28 '24 20:02 wesleymatosdev

@ologbonowiwi: Your claim has been rewarded! We'll notify you once it is processed.

algora-pbc[bot] avatar Mar 04 '24 11:03 algora-pbc[bot]

🎉🎈 @ologbonowiwi has been awarded $250! 🎈🎊

algora-pbc[bot] avatar Mar 04 '24 16:03 algora-pbc[bot]