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

RESTEasy Reactive doesn't provide converters for types like Optional<LocalDate> #28089

Closed
knutwannheden opened this issue Sep 20, 2022 · 3 comments · Fixed by #28095
Closed
Labels
area/rest kind/bug Something isn't working
Milestone

Comments

@knutwannheden
Copy link
Contributor

Describe the bug

Not sure if this is expected to work or not, but while RestEasy Reactive has support for Java Time types (like LocalDate) out-of-the-box, this doesn't work when wrapped in an optional (e.g. Optional<LocalDate>).

2022-09-20 11:33:03,799 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
        [error]: Build step io.quarkus.resteasy.reactive.server.deployment.ResteasyReactiveProcessor#setupEndpoints threw an exception: java.lang.RuntimeException: java.lang.RuntimeException: Failed to process method 'org.acme.GreetingResource#hello'
        at org.jboss.resteasy.reactive.common.processor.EndpointIndexer.createEndpoints(EndpointIndexer.java:313)
        at io.quarkus.resteasy.reactive.server.deployment.ResteasyReactiveProcessor.setupEndpoints(ResteasyReactiveProcessor.java:584)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:909)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:281)
        at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
        at java.base/java.lang.Thread.run(Thread.java:833)
        at org.jboss.threads.JBossThread.run(JBossThread.java:501)
Caused by: java.lang.RuntimeException: Failed to process method 'org.acme.GreetingResource#hello'
        at org.jboss.resteasy.reactive.common.processor.EndpointIndexer.createResourceMethod(EndpointIndexer.java:693)
        at org.jboss.resteasy.reactive.common.processor.EndpointIndexer.createEndpoints(EndpointIndexer.java:400)
        at org.jboss.resteasy.reactive.common.processor.EndpointIndexer.createEndpoints(EndpointIndexer.java:284)
        ... 12 more
Caused by: java.lang.RuntimeException: Failed to find converter for java.time.LocalDate
        at org.jboss.resteasy.reactive.server.processor.generation.converters.GeneratedConverterIndexerExtension.extractConverterImpl(GeneratedConverterIndexerExtension.java:104)
        at org.jboss.resteasy.reactive.server.processor.ServerEndpointIndexer.extractConverter(ServerEndpointIndexer.java:507)
        at org.jboss.resteasy.reactive.server.processor.ServerEndpointIndexer.handleOptionalParam(ServerEndpointIndexer.java:357)
        at org.jboss.resteasy.reactive.server.processor.ServerEndpointIndexer.handleOptionalParam(ServerEndpointIndexer.java:90)
        at org.jboss.resteasy.reactive.common.processor.EndpointIndexer.extractParameterInfo(EndpointIndexer.java:1251)
        at org.jboss.resteasy.reactive.common.processor.EndpointIndexer.createResourceMethod(EndpointIndexer.java:531)
        ... 14 more

Expected behavior

I would have expected this to be supported. Sample code:

    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String hello(@QueryParam("when") Optional<LocalDate> when) {
        return "Hello " + when + " from RESTEasy Reactive";
    }

Actual behavior

See description.

How to Reproduce?

Unzip code-with-quarkus.zip and run mvn quarkus:dev.

Output of uname -a or ver

No response

Output of java -version

No response

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.12.2.Final

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

@knutwannheden knutwannheden added the kind/bug Something isn't working label Sep 20, 2022
@gsmet
Copy link
Member

gsmet commented Sep 20, 2022

/cc @geoand (not sure why the bot didn't ping anyone)

@geoand
Copy link
Contributor

geoand commented Sep 20, 2022

Thanks for reporting. I'll have a look some time this week

@geoand geoand changed the title RestEasy Reactive doesn't provide converters for types like Optional<LocalDate> RESTEasy Reactive doesn't provide converters for types like Optional<LocalDate> Sep 20, 2022
geoand added a commit to geoand/quarkus that referenced this issue Sep 20, 2022
@geoand
Copy link
Contributor

geoand commented Sep 20, 2022

#28095 takes care of it

geoand added a commit that referenced this issue Sep 21, 2022
Make RESTEasy Reactive work with Optional temporal types
@quarkus-bot quarkus-bot bot added this to the 2.14 - main milestone Sep 21, 2022
@gsmet gsmet modified the milestones: 2.14 - main, 2.13.1.Final Sep 30, 2022
gsmet pushed a commit to gsmet/quarkus that referenced this issue Oct 3, 2022
igorregis pushed a commit to igorregis/quarkus that referenced this issue Oct 16, 2022
igorregis pushed a commit to igorregis/quarkus that referenced this issue Oct 16, 2022
igorregis pushed a commit to igorregis/quarkus that referenced this issue Oct 16, 2022
igorregis pushed a commit to igorregis/quarkus that referenced this issue Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/rest kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants