Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: allow default values for input arguments. #1931

Open
2 tasks
laststylebender14 opened this issue May 13, 2024 · 5 comments
Open
2 tasks

bug: allow default values for input arguments. #1931

laststylebender14 opened this issue May 13, 2024 · 5 comments

Comments

@laststylebender14
Copy link
Contributor

Prerequisites

  • I have checked the existing issues to ensure this is not a duplicate.
  • I am running the latest version of Tailcall.

Describe the bug

currently the default values passed to input arguments are not used to query the data.

Expected behavior

  1. In following example, we pass 1 as default value to id.
type Query {
  user(id: Int = 1): User @http(path: "/users/{{.args.id}}")
}
  1. when we make request from playground with following query then default id should be taken into account and request with default id should be made.
# client(playground) side query.
query {
 user {
     name  
  }
}
request made to upstream : http://jsonplaceholder.typicode.com/users/1

Actual behavior

  1. In following example, we pass 1 as default value to id.
type Query {
  user(id: Int = 1): User @http(path: "/users/{{.args.id}}")
}
  1. but when we make request from playground with following query then default id is not taken into account and request without id is made.
# client(playground) side query.
query {
 user {
     name  
  }
}
request made to upstream : http://jsonplaceholder.typicode.com/users/
@tusharmath
Copy link
Contributor

/bounty 100$

Copy link

algora-pbc bot commented May 13, 2024

💎 $100 bounty • Tailcall Inc.

Steps to solve:

  1. Start working: Comment /attempt #1931 with your implementation plan
  2. Submit work: Create a pull request including /claim #1931 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.

Attempt Started (GMT+0) Solution
🟢 @ssddOnTop May 13, 2024, 1:39:44 PM #1939

@tusharmath
Copy link
Contributor

This is a simple fix. We need a way to specify default arguments in config. Store them in the blueprint, and then eventually while creating schema, copy them there.

@ssddOnTop
Copy link
Member

ssddOnTop commented May 13, 2024

/attempt

Algora profile Completed bounties Tech Active attempts Options
@ssddOnTop 43 tailcallhq bounties
Rust, Java,
C & more
Cancel attempt

@ssddOnTop
Copy link
Member

there is an issue with async-graphql as well, I raised a PR async-graphql/async-graphql#1527 there if it gets merged, I'll finish touchups for this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants