tailcall
tailcall copied to clipboard
feat: Add @validate directive for custom scalar validation
Description:
Currently, Tailcall allows developers to define custom scalars. However, there's no built-in way to add validations on those custom scalars. I propose creating a @validate
directive which takes js function as input and can be applied on scalars. The js function inside @validate
should return either true
or false
. If it returns false
, the user should receive a Evaluation error when an invalid value is passed into the scalar.
Expected Behavior:
- The
@validate
directive should be applicable to custom scalar types. - The directive js function should return
true
for valid values andfalse
for invalid values. - If the directive returns
false
, a Evaluation error should be thrown to indicate the issue to the user.
Tasks:
- [ ] Implement a
@validate
directive that developers can use on custom scalars. - [ ] @validate accepts a js function as input.
- [ ] errors should follow the formatting guidelines of Tailcall Evaluation Errors
Example
scalar EvenNumber @validate(js: "isEven")
function isEven(num) {
return num % 2 === 0
}
/bounty 100
~~## 💎 $100 bounty • Tailcall Inc.~~
~~### Steps to solve:~~
~~1. Start working: Comment /attempt #1847
with your implementation plan~~
~~2. Submit work: Create a pull request including /claim #1847
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 |
---|---|---|
🔴 @webbdays | May 4, 2024, 9:22:15 AM | WIP |
🔴 @mobley-trent | May 7, 2024, 2:39:49 PM | WIP |
🔴 @beelchester | Aug 6, 2024, 3:01:42 AM | WIP |
/attempt
Algora profile | Completed bounties | Tech | Active attempts | Options |
---|---|---|---|---|
@webbdays | 2 tailcallhq bounties | Python, Rust, JavaScript & more |
Cancel attempt |
@webbdays: Reminder that in 1 days the bounty will become up for grabs, so please submit a pull request before then 🙏
The bounty is up for grabs! Everyone is welcome to /attempt #1847
🙌
/attempt #1847
Algora profile | Completed bounties | Tech | Active attempts | Options |
---|---|---|---|---|
@mobley-trent | 2 tailcallhq bounties | Python, Rust, Jupyter Notebook |
Cancel attempt |
💡 @mobley-trent submitted a pull request that claims the bounty. You can visit your bounty board to reward.
@mobley-trent are you still on this?
Feel free to pick up the issue @webbdays
Action required: Issue inactive for 30 days. Status update or closure in 7 days.
/attempt #1847
Algora profile | Completed bounties | Tech | Active attempts | Options |
---|---|---|---|---|
@beelchester | 8 tailcallhq bounties | Rust, TypeScript, Go & more |
Cancel attempt |
@beelchester: Reminder that in 1 days the bounty will become up for grabs, so please submit a pull request before then 🙏
The bounty is up for grabs! Everyone is welcome to /attempt #1847
🙌
Action required: Issue inactive for 30 days. Status update or closure in 7 days.
Issue closed after 7 days of inactivity.