spring-projects / spring-projects/spring-data-mongodb

Wrong type definition for Duration due to converter

Open
#4,146 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: pending-design-work type: enhancement
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.