Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-18168

camel.rest.apiProperties (restConfiguration) in quarkus application.yml/application.properties and camel-main standalone

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Cannot Reproduce
    • 3.17.0
    • 3.x
    • None
    • Unknown

    Description

       I have this restConfiguration in a quarkus (2.9.2.Final) application:

          @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
      }
      

      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:

       

      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}"

       

      And I also tried the same settings in application.properties:

       

      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}

       

      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.

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            jsiponen Joe Siponen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: