Skip to content

Enum converters break query params #2371

@jpsugar-flow

Description

@jpsugar-flow

Issue description

We have an enum in a query parameter and when we try to call the endpoint we get this:

16:48:53.737 [default-nioEventLoopGroup-3-4] ERROR i.m.h.s.exceptions.ExceptionHandler - Unhandled error on GET /redacted
java.lang.RuntimeException: io.micronaut.json.JsonSyntaxException: Unrecognized token 'OPEN': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
 at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 5]
	at life.flow.openapi.invoker.redacted.config.EnumConverterServerConfig$Companion.commonToEnumConverter$lambda$1(EnumConverterServerConfig.kt:53)

The generated endpoint is:

    @Get("/doTheThing/{param}")
    fun doTheThing(
        @PathVariable("param") @NotNull param: String,
        @QueryValue("q1") @NotNull q1: String,
        @QueryValue("q2") @Nullable q2: SampleEnum? = null,
        @QueryValue("q3") @Nullable q3: String? = null,
        @QueryValue("q4") @Nullable q4: Boolean? = null,
    ): List<@Valid ResultType>

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions