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

openapi-java native applications fail at runtime when REST DSL param arrayType and allowableValues are specified #5554

Closed
jamesnetherton opened this issue Nov 24, 2023 · 0 comments
Assignees
Milestone

Comments

@jamesnetherton
Copy link
Contributor

Bug description

An issue I stumbled upon while investigating #5528.

If you choose to use the openapi-java extension and have something like the following in the REST definition:

.get("/operation/spec/array/params")
.param()
.name("integer_array")
.dataType("array")
.arrayType("integer")
.allowableValues("1", "2", "3")

Then an exception is thrown in native mode at runtime:

java.lang.IllegalStateException: java.lang.NoSuchMethodException: no such method: java.lang.Integer.valueOf(String)Integer/invokeStatic
        at org.apache.camel.openapi.RestOpenApiReader.convertAndSetItemsEnum(RestOpenApiReader.java:722)
        at org.apache.camel.openapi.RestOpenApiReader.defineSchemas(RestOpenApiReader.java:669)
        at org.apache.camel.openapi.RestOpenApiReader.doParseVerb(RestOpenApiReader.java:505)
        at org.apache.camel.openapi.RestOpenApiReader.doParseVerbs(RestOpenApiReader.java:443)
        at org.apache.camel.openapi.RestOpenApiReader.parse(RestOpenApiReader.java:258)
        at org.apache.camel.openapi.RestOpenApiReader.read(RestOpenApiReader.java:138)

From this logic:

https://github.com/apache/camel/blob/main/components/camel-openapi-java/src/main/java/org/apache/camel/openapi/RestOpenApiReader.java#L504-L518

These types need registering for method reflection:

https://github.com/apache/camel/blob/main/components/camel-openapi-java/src/main/java/org/apache/camel/openapi/RestOpenApiReader.java#L501-L518

The other types don't actually have a valueOf method so they fail even in JVM mode.

@jamesnetherton jamesnetherton added the bug Something isn't working label Nov 24, 2023
@jamesnetherton jamesnetherton added this to the 3.7.0 milestone Nov 24, 2023
@jamesnetherton jamesnetherton self-assigned this Nov 24, 2023
jamesnetherton added a commit to jamesnetherton/camel-quarkus that referenced this issue Nov 27, 2023
jamesnetherton added a commit to jamesnetherton/camel-quarkus that referenced this issue Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant