Custom Value Objects as parameters in abstract Repository methods

I'm trying to use strong types in my code, e.g. instead of using String in lots of places, using small classes like (Kotlin):

UserId(val value: String)

I'd like to use these all the way down to abstract Repository methods in order to maintain the type-checking benefit, for example:

interface UserRepository : Neo4jRepository<User, Long> {
    fun findUserByUserId(userId: UserId)

However, when I do something like this, I get the following error:

org.neo4j.driver.exceptions.ClientException: Property values can only be of primitive types or arrays thereof

I had a quick dig through the classes in the stack trace, and I couldn't see anywhere that parameter values are converted in any way at all. (It looks like it would likely be in GraphRepositoryQuery.resolveParams() if it was anywhere.)

Is there some way to achieve what I'm trying to do?

If not, is it worth adding as a feature request for SDN? (I could possibly even have a crack at implementing it, with some guidance.)

Perhaps there's some way to get my types included in the ParameterConversion used by BoltRequest?

I assume for your constellation there is a lack of functionality in Neo4j-OGM, but I have to check this later this week.
If you really want to use the UserId as the id for the User you can also define the repository as <User, UserId>. This will ensure that you do not have the faulty state of calling findById(Long) but you can use findById(UserId) (and also all other methods that are referring to the id).
All that is needed is a @Convert annotation on the id field with your UserIdTo[String/Long/other neo4j primitive] converter.
But this will only work after we pulled in this PR (GH-787 - Use converter for id based loading. by meistermeier · Pull Request #788 · neo4j/neo4j-ogm · GitHub).

Thanks for the reply, Gerrit.

The UserID example may have been a bit of a red herring, as the ID isn't the only property that I'm trying to do this for. (And I'm not trying to use it as the ID.)

At any rate, some of the places where I'm trying to use these types rely on custom queries with parameters, so the @Convert on a field solution won't work.

Any ideas on how I could make this work, either with or without changes to neo4j-ogm?

I will try to find out if a solution could be to call a globally registered converter (Spring bean) for your type.