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

Remove required and defaultValue attributes from Argument annotation #150

Closed
bclozel opened this issue Sep 24, 2021 · 1 comment
Closed
Assignees
Labels
in: core Issues related to config and core support in: web Issues related to web handling type: enhancement A general enhancement
Milestone

Comments

@bclozel
Copy link
Member

bclozel commented Sep 24, 2021

Currently, the @Argument annotation allows to specify whether the input argument is required and set a default value if none was provided.

We've found that this can lead to confusing situations, since that information is supposed to be present already at the schema level.

For example, a greeting query that requires a name input argument:

type Query {
    greeting(name: String!): String!
}

And here's a query schema that does not require it but specifies a default value:

type Query {
    greeting(name: String = "Spring"): String!
}

The existing attributes on @Argument add a duplicate layer and go against the "schema first" principle behind Spring GraphQL.

@bclozel bclozel added type: enhancement A general enhancement in: core Issues related to config and core support in: web Issues related to web handling labels Sep 24, 2021
@bclozel bclozel added this to the 1.0.0-M3 milestone Sep 24, 2021
@bclozel bclozel self-assigned this Sep 24, 2021
@yingzhuo
Copy link

Thanks! Doc: Default Variables

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues related to config and core support in: web Issues related to web handling type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants