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

Pass default argument and input values to resolvers #59

Open
yvele opened this issue Oct 7, 2019 · 14 comments
Open

Pass default argument and input values to resolvers #59

yvele opened this issue Oct 7, 2019 · 14 comments
Labels
bug Something isn't working

Comments

@yvele
Copy link

yvele commented Oct 7, 2019

AWS AppSync allows to define default values in schema like that

type Foo {
  bar(
    arg: Int = 20
  ): Bar!
}

or that

type Foo {
  bar(
    arg: Int! = 20
  ): Bar!
}

But either way when the value is not explicitly defined, the default value is not passed to the resolver.

The default argument and input values defined in the schema should be passed to the resolvers.

As a workaround I'm forced to define default values at the schema level and at the resolver level. This leads to redundancy and to possible out of sync default values.

PS: In the GraphQL specs

If no value is provided for a defined input object field and that field definition provides a default value, the default value should be used. If no default value is provided and the input object field’s type is non‐null, an error should be thrown. Otherwise, if the field is not required, then no entry is added to the coerced unordered map.

See Also https://stackoverflow.com/questions/51302462/how-to-pass-default-graphql-arguments-to-aws-appsync-resolver

@tinnou
Copy link
Contributor

tinnou commented Oct 18, 2019

Thank you for reporting the issue, this is a known issue and I will make sure the team sees this.

@yelhow
Copy link

yelhow commented Nov 12, 2019

@tinnou Any update on this.

@arsenipachkovski
Copy link

I also have a problem with defaultValue.
When I make an introspection query, defaultValue of my fields are null

So I get this:

{
  "description": "Input type of myMutation.",
  "inputFields": [
	{
	  "defaultValue": null,
	  "description": "foo description.",
	  "name": "foo"
	}
  ]
}

Instead of this:

{
  "description": "Input type of myMutation.",
  "inputFields": [
	{
	  "defaultValue": "bar",
	  "description": "foo description.",
	  "name": "foo"
	}
  ]
}

@morficus
Copy link

morficus commented Feb 5, 2020

@tinnou - ping. any word on when this bug might be addressed?

@tinnou tinnou added the bug Something isn't working label Feb 8, 2020
@tinnou
Copy link
Contributor

tinnou commented Feb 8, 2020

@tinnou - ping. any word on when this bug might be addressed?

This bug has not been prioritized yet. Stay tuned.

@mmierzwa
Copy link

Any updates on this topic?

@hutber
Copy link

hutber commented Oct 6, 2020

I would love to be able to use defaults, that is certain!!

@morficus
Copy link

morficus commented Dec 5, 2020

@tinnou ping. any word on if this bug has been prioritized as yet?

@MontoyaAndres
Copy link

Any update?

@vicary
Copy link

vicary commented Sep 7, 2021

I believe users expect a public product by Amazon to be spec compliant.

@jaismith
Copy link

jaismith commented Feb 1, 2023

bumping as this is still an issue several years later, is this on the backlog to fix?

@tqhoughton
Copy link

Nearly 4 years later and AppSync still doesn't forward default arguments and inputs to resolvers, is there some unexpected complexity to implementing this or has it just not been prioritized?

@aaronkaka
Copy link

We have run into this, and requesting that the fix be prioritized.

@Kikimora
Copy link

Is this problem present with JS resolvers as well? Because if it is then I would stay away from AppSync.

In my eyes presence of this single problem is enough to qualify entire product as immature. Not being able to fix it in 4 years tells me the product never be mature. I spent last 2 days evaluating AppSync for an uprooting project. Now I doubt I would use it :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests