Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional list query parameter defaults to list with a single element #10804

Open
mancze opened this issue May 7, 2024 · 0 comments
Open

Optional list query parameter defaults to list with a single element #10804

mancze opened this issue May 7, 2024 · 0 comments

Comments

@mancze
Copy link

mancze commented May 7, 2024

Expected Behavior

Query parameter defined as @QueryValue(value = "v", defaultValue = "") List<String> values should default to an empty list when parameter is not present. This was working in Micronaut 3, but doesn't in Micronaut 4.

Alternatively, there should be a documented way how to declare such parameter if this syntax turns out to be insufficient (e.g. to be able to distinguish between ?v= (parameter specified, but without value) vs ? (no parameter specified).

Actual Behaviour

List with a single element of an empty string is passed as an argument.

Steps To Reproduce

  1. Run example app
  2. Execute curl http://localhost:8080/list-nullable
  3. Expected output (empty list is passed to the method):
values == null: false
values: []
values.size(): 0

Environment Information

No response

Example Application

https://github.com/mancze/micronaut-sandbox/tree/repro/optional-list-query-parameter

Version

4.3.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant