tailcallhq / tailcall

High Performance GraphQL Runtime
https://tailcall.run
Apache License 2.0
1.29k stars 254 forks source link

Federation Subgraph: add validation for used fields #2911

Closed meskill closed 22 hours ago

meskill commented 1 month ago

Resolvers on types could use different fields from the respective type inside the resolver itself.

Add a validation that every field that is used as .value.field_name inside the resolver is actually part of the type and if not generated a Validation error with info about unknown field. Make sure nested paths .value.a.b.c are covered as well.

Good Example

type User @http(path: "/users/{{.value.id}}") {
  id: ID
  name: String
}

Bad Examples

type User @http(path: "/users/{{.value.foo.id}}") {
  id: ID
  name: String
}
type User @http(path: "/users/{{.value.age}}") {
  id: ID
  name: String
}
tusharmath commented 1 month ago

/bounty $50

algora-pbc[bot] commented 1 month ago

💎 $50 bounty • Tailcall Inc.

Steps to solve:

  1. Start working: Comment /attempt #2911 with your implementation plan
  2. Submit work: Create a pull request including /claim #2911 in the PR body to claim the bounty
  3. Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts

🙏 Thank you for contributing to tailcallhq/tailcall! 🧐 Checkout our guidelines before you get started. 💵 More about our bounty program.

Attempt Started (GMT+0) Solution
🟢 @dekkku #3102
algora-pbc[bot] commented 6 days ago

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

algora-pbc[bot] commented 22 hours ago

🎉🎈 @dekkku has been awarded $50! 🎈🎊