Skip to content

Query array arguments type conversion does not work #7056

Open
@vsapronov

Description

@vsapronov

Expected Behavior

I have the following endpoint in my controller:

@Controller
public class MyController {
    @Get("/dates")
    public MutableHttpResponse<?> echoQueryController(
        @QueryValue(value = "date_array") @Format("yyyy-MM-dd") LocalDate[] dateArray
    ) {
        System.out.println(dateArray.length);
        return HttpResponse.status(HttpStatus.BAD_REQUEST); // this is for testing only!!!
    }
}

When calling this endpoint via HTTP GET to url: /dates?date_array=2022-01-01&date_array=2022-02-02 I would expect dateArray to be an array of two dates correspondingly.

Actual Behaviour

The dateArray is empty array, no warnings or errors provided. The code in controller prints 0.

Steps To Reproduce

  1. No special environment is required - just bare minimum micronaut 3.3.3.
  2. Run the server with the above controller and try to GET /dates?date_array=2022-01-01&date_array=2022-02-02
  3. Check console output

Environment Information

  • Mac OS 12.2.1 and also Ubuntu 18.04.6
  • JDK 15

Example Application

No response

Version

3.3.3

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions