Joe Siponen created CAMEL-18168:
-----------------------------------
Summary: camel.rest.apiProperties (restConfiguration) in quarkus
application.yml/application.properties and camel-main standalone
Key: CAMEL-18168
URL: https://issues.apache.org/jira/browse/CAMEL-18168
Project: Camel
Issue Type: Improvement
Components: camel-main, camel-rest-swagger
Affects Versions: 3.17.0
Reporter: Joe Siponen
I have this {{restConfiguration}} in a quarkus (2.9.2.Final) application:
{code:java}
@ConfigProperty(name = "quarkus.http.root-path")
String quarkusHttpRootPath;
@ConfigProperty(name = "quarkus.application.name")
String quarkusApplicationName;
public void configure() throws Exception {
restConfiguration()
.dataFormatProperty("prettyPrint", "true")
//.port(8080) - Not applicable, using quarkus http server
//.host("0.0.0.0") - Not applicable, using quarkus http server
.enableCORS(true)
// turn on openapi api-doc
.apiContextPath("/openapi")
.apiVendorExtension(true)
.apiProperty("base.path", quarkusHttpRootPath)
.apiProperty("api.title", quarkusApplicationName)
.apiProperty("api.version", "1.0.0")
// and enable CORS
.apiProperty("cors", "true");
//... routes etc
}
{code}
I attempted to do the same configuration in my application's
{{application.yml}} instead as my understanding is that quarkus uses camel-main
to bootstrap/start camel (but could be a misunderstanding on my part...).
I consulted
https://camel.apache.org/components/3.17.x/others/main.html#_camel_rest_dsl_configurations
and saw some options listed there that fits nicely with my goal. I ended up
with this configuration in my {{application.yml:}}
{code:java}
camel:
context:
name: "${quarkus.application.name}"
rest:
enableCORS: true
apiContextPath: "/openapi"
apiVendorExtension: true
apiProperties:
"[base.path]": "${quarkus.http.root-path}"
"[api.title]": "${quarkus.application.name} API"
"[api.version]": "${quarkus.application.version}"{code}
And I also tried the same settings in {{{}application.properties{}}}:
{code:java}
camel.rest.apiProperties."[api.title]"=${quarkus.application.name} API
camel.rest.apiProperties."[api.version]"=${quarkus.application.version}
camel.rest.apiProperties."[base.path]"=${quarkus.http.root-path}{code}
But, I am *not* able to set the {{apiProperties}} in any of the above ways.
For instance, the {{api.title}} is not shown in the Swagger UI and the
{{base.path}} is not set (a 404 is generated when the API is invoked by
Swagger). The application itself starts without any errors.
It seems that there is something missing here to make this configurable in both
camel-main standalone and camel quarkus.
--
This message was sent by Atlassian Jira
(v8.20.7#820007)