spring-projects / spring-projects/spring-data-mongodb
Wrong type definition for Duration due to converter
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.7k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
When writing a duration type parameter to the database, Spring defines it as a String after using converters, it can be seen that JRS310Converters.DurationToStringConverter is being used, but I need its real type and not a modified one.
Now I have to write a strange converter that is used when writing to the database. I need exactly its type. further it is used for custom codec
@WritingConverter
class DurationToDurationConverter : Converter<Duration, Duration> {
override fun convert(source: Duration): Duration = source
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by examining JRS310Converters.DurationToStringConverter and the converter registration involved in writing Duration values. Reproduce the reported type mapping with a custom codec, then determine the expected type and add regression coverage for the database-writing path. Done means Duration is exposed to the codec with its real type rather than the converted String type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, mongodb
- Domain
- database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100