Claus Ibsen created CAMEL-25768:
-----------------------------------

             Summary: camel-jbang - camel run does not add camel-openapi-java 
for a code-first REST DSL with apiContextPath
                 Key: CAMEL-25768
                 URL: https://issues.apache.org/jira/browse/CAMEL-25768
             Project: Camel
          Issue Type: Bug
          Components: camel-jbang
            Reporter: Claus Ibsen
             Fix For: 4.24.0


camel run adds camel-openapi-java when the REST DSL uses an OpenAPI contract 
(the rest-openapi component), but not for a code-first REST DSL with an API 
description:

{code}
- restConfiguration:
    bindingMode: json
    apiContextPath: openapi
- rest:
    path: /orders
    get:
      - id: listOrders
        to:
          uri: direct:list-orders
{code}

The application does not start:

{noformat}
FailedToStartRouteException: Failed to start route: route1 because: 
java.lang.IllegalStateException: Cannot find RestApiProcessorFactory in 
Registry or classpath (such as the camel-openapi-java component)
{noformat}

DependencyDownloaderComponentResolver downloads camel-openapi-java only for 
rest-openapi. The API description of a code-first REST DSL is served through 
the rest-api component (route1 is rest-api://openapi). The same on 4.23.0 and 
4.24.0-SNAPSHOT.

Workaround: camel.jbang.dependencies=camel:openapi-java in 
application.properties.

Fix: download camel-openapi-java when the rest-api component is resolved, as 
for rest-openapi.

Found while writing the contracts/rest-code-first example 
(apache/camel-jbang-examples#118).

_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to