Netflix / dgs-framework

GraphQL for Java with Spring Boot made easy.
https://netflix.github.io/dgs
Apache License 2.0
3.03k stars 286 forks source link

Set InputArgumentResolver to highest priority so it is matched first #1884

Closed srinivasankavitha closed 2 months ago

srinivasankavitha commented 2 months ago

This fixes issues with resolving MultipartFile with @InputArgument.

Pull Request type

Changes in this PR

Without the ordering on InputArgumentResolver, the HandlerMethodArgumentResolverAdapter for RequestParamMethodArgumentresolver was match due to this logic: https://github.com/spring-projects/spring-framework/blob/main/spring-web/src/main/java/org/springframework/web/method/annotation/RequestParamMethodArgumentResolver.java#L142

This breaks the use of @InputArgument MultipartFile inputFile in DGS data fetchers. The InputArgumentResolver handles this correctly and we should match that resolver. It was working previously prior to spring-graphql intgeration since we were getting lucky with the order.

kilink commented 2 months ago

I don't think it was random before, it was just that DgsInputArgumentConfiguration was getting imported before this configuration. It looks like for the Spring GraphQL configuration we import this stuff before DgsAutoConfiguration, causing the breakage.

srinivasankavitha commented 2 months ago

Yeah it wasn't random in that it was non-deterministic. It's more the fact that it happened to work because of the autoconfig order, but once we changed that we introduced new behavior which was unexpected because it's not explicit that the InputArgument resolver should always run first.