-
Notifications
You must be signed in to change notification settings - Fork 317
Drop special behavior for @Argument Map
in favor of doing the same via @Arguments Map
#548
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
Comments
Now that The main challenge is impact on existing applications. A controller that relies on existing behavior would now get |
@Argument Map
in favor of doing the same via @Arguments Map
Note that currently you can name the argument explicitly like so: @MutationMapping
fun updateUser(@Argument("input") map: Map<String, Any) {
val name = map.get("name")
} |
When I add a name to argument with Map, it throws error. @MutationMapping
fun updateUser(@Argument("user") input: Map<String, Any>): String {
return "${input["name"]}"
}
mutation {
updateUser(user: {name:"test"})
} type Query {
getUsers: [User!]!
}
type Mutation {
updateUser(user: UserInput!): String
}
input UserInput {
name: String!
}
type User {
username: String!
name: String!
lastName: String!
}
I get this error:
But, with this works
The actual docs idicate that for Map the annotation must not have a name
So, all Map arguments for existing applications don't have name, so, a "named argument" can be a backward compatible solutions. |
This should work as I described, but it looks like we expect the |
Dropping this the dedicated resolver for @argument Map<String, Object> leaves it to ArgumentMethodArgumentResolver and ArgumentsMethodArgumentResolver to handle the case of Map<String, Object>, treating it either as a raw argument value for a named argument, or as the full raw arguments map. Closes gh-548
For me, are the same.
There any way to get the value directly in to the map?
For the request
Actual
I see more logical this
The text was updated successfully, but these errors were encountered: