spring-data-commons
spring-data-commons copied to clipboard
KPropertyPath doesn't support Iterables
The KPropertyPath currently doesn't support references from Iterables such as List, Set, etc. to the type of the element.
data class User(
val name: String,
val addresses: List<Address>
) {
data class Address(
val street: String
)
}
val path = User::addresses / User.Address::street // a type mismatch between the expected the `Address` and offered `List<Address>` occurs here
The implementation in org.springframework.data.mapping.KPropertyPath should be able to construct paths such as addresses.street for the usage in indexes, queries and aggregations to leverage the type-safety of Kotlin for paths references in Spring Data MongoDB.
A similar implementation is offered by the now deprecated project KMongo, see KPropertyPath.kt and Properties.kt.
Care to submit a pull request?