[FIXED] @PathParam: No value being passed

Issue

I’m building a REST api using Quarkus and Kotlin. I’m trying to include a path parameter in my function by using the @PathParam annotation. This is what I have:

@GET
    @Produces(MediaType.APPLICATION_JSON)
    @Path("/{userId}")
    fun getUser(@PathParam userId: UUID) : GetUserResponse =
        try {
            GetUserSuccess(userRepository.find("id", userId))
        } catch (e: NotFoundException) {
            GetUserFailure(e)
        }

Unfortunately I’m getting an error stating that there’s no value being passed for parameter value.

I googled some stuff, and most of what I found is about wrong imports. I double checked that part, but I import the correct one: import javax.ws.rs.*, which also includes the PathParam.

Anyone knows what’s wrong with this?

Solution

The answer would be to change it to:

fun getUser(@PathParam("userId") userId : UUID)

Inspirerd by Paul Samsotha’s answer.

Answered By – Ricardo de Vries

Answer Checked By – Cary Denson (Easybugfix Admin)

Leave a Reply

(*) Required, Your email will not be published