Skip to content

feat(EDPR-1216): convert a Map source to the @Source parameter type - #2387

Open
berngp wants to merge 1 commit into
masterfrom
feature/EDPR-1216-source-map
Open

berngp wants to merge 1 commit into
masterfrom
feature/EDPR-1216-source-map

Conversation

@berngp

@berngp berngp commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Pull request checklist

  • Please read our contributor guide
  • Consider creating a discussion on the discussion forum
    first
  • Make sure the PR doesn't introduce backward compatibility issues
  • Make sure to have sufficient test cases

Pull Request type

  • Bugfix
  • Feature
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Other (please describe):

Changes in this PR

Why

A SourceArgumentResolver accepts only a source that is an instance of the parameter type. When a parent data fetcher returns a Map for an object type, a method with @Source Show show fails with "Invalid source type".

What

A Map source is now converted to the parameter type with the InputObjectMapper, the same mapper that @InputArgument uses. A source that is an instance of the parameter type is still passed as is. Any other source still fails with the same error.

How

A SourceArgumentResolver takes an InputObjectMapper (default DefaultInputObjectMapper) and uses InputObjectMapperConverter for a Map source. DgsInputArgumentConfiguration gives it the InputObjectMapper bean.

New tests cover both Kotlin and Java.

Implications

A Map source for a parameter type that the mapper cannot build now fails with the mapper error, not "Invalid source type".

Why: SourceArgumentResolver accepts only a source that is an instance
of the parameter type. When a parent data fetcher returns a Map for an
object type, a method with `@Source Show show` fails with "Invalid
source type".

What: a Map source is now converted to the parameter type with the
`InputObjectMapper`, the same mapper that `@InputArgument` uses.
A source that is an instance of the parameter type is still passed
as is. Any other source still fails with the same error.

How: `SourceArgumentResolver` takes an `InputObjectMapper` (default
`DefaultInputObjectMapper`) and uses `InputObjectMapperConverter` for a
Map source. `DgsInputArgumentConfiguration` gives it the `InputObjectMapper`
bean.

New tests cover both Kotlin and Java.

Implications: a Map source for a parameter type that the mapper cannot
build now fails with the mapper error, not "Invalid source type".
@berngp
berngp force-pushed the feature/EDPR-1216-source-map branch from cb6f1fe to e274cc5 Compare December 1, 2026 00:36

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants