question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how to implement a repeated request parameter

See original GitHub issue

I must be missing something completely. My usecase is a simple GET endpoint taking a list of Long ids and returning associated data. I modelled the input parameter “ids” as

data class ProductImagesRequest(@QueryParam("multiple ids.") val ids:List<Long>)

When calling it with parameters like ?ids=1&ids=2&ids=3 I get this error:

com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.util.ArrayList<java.lang.Long>` out of VALUE_STRING token

Why would a request parameter be deserialized from xml or json?

I love this library BTW, it’s a very elegant solution!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:25

github_iconTop GitHub Comments

3reactions
sheepdreamofandroidscommented, Feb 27, 2020

Laying traps for unsuspecting developers so you can get PR’s of them. Genius!

I’m not exactly bristling with free time myself, but let me look at it.

0reactions
sheepdreamofandroidscommented, Mar 21, 2020

Thanks so much for the help. Now it works. The real culprit though was the fact that we are using gson for JSON serialization instead of jackson.

Read more comments on GitHub >

github_iconTop Results From Across the Web

spring mvc: parse repeated request param - Stack Overflow
In my case a Javascript element sends the ids of multiple rows in order for the server to do something with all these...
Read more >
Parse multiple repeated request parameters. Use ... - GitHub
to return an array in this case with the multiple repeated values. Currently it returns only the last value (i.e. param2).
Read more >
parameters • Akka HTTP - Documentation
This page explains how to extract multiple query parameter values from the request, or parameters that might or might not be present.
Read more >
Spring @RequestParam Annotation - Baeldung
Simply put, we can use @RequestParam to extract query parameters, form parameters, and even files from the request.
Read more >
Query Parameters - FastAPI
You can declare multiple path parameters and query parameters at the same time, FastAPI knows which is which. And you don't have to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found