You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "cdia8890 (via GitHub)" <gi...@apache.org> on 2025/05/07 21:30:35 UTC

[I] REST OpenAPI endpoint always uses `platform-http` ignoring `component: servlet` in Spring Boot [camel-karavan]

cdia8890 opened a new issue, #1527:
URL: https://github.com/apache/camel-karavan/issues/1527

   ### Describe the bug
   
   I'm trying to configure REST OpenAPI endpoint with `component: servlet` with Apache Camel and Spring Boot, but due to the behaviour of `org.apache.camel.component.rest.openapi.RestOpenApiEndpoint` class it is always defaulting to `platform-http`.
   
   The reason is because though we set the restConfiguration as follows:
   ```
   - restConfiguration:
       component: servlet
   ```
   
   due to the following code, it is favouring `platform-http`
   
   ![Image](https://github.com/user-attachments/assets/2bd55755-1832-4dfb-9c4c-ff43a6665b4e)
   
   I tried to debug why the `factory` is always null and found that `if (getConsumerComponentName() != null) {` is always false because `consumerComponentName` is null.
   
   ![Image](https://github.com/user-attachments/assets/b8390295-e267-4822-a8b7-d4cf88d12667)
   
   The `consumerComponentName` is null because the properties are not transferred from `RestOpenApiComponent` to `RestOpenApiEndpoint`.
   
   ![Image](https://github.com/user-attachments/assets/186aad97-ffb8-4fe6-b415-210ab89f38f4)
   
   ![Image](https://github.com/user-attachments/assets/304ae957-fa21-48bc-be94-186c7c39a07f)
   
   
   Since `consumerComponentName` is a UriParam, if we enable Karavan to add `consumerComponentName` as a parameter in the Rest Section, it will be passed into the endpoint configuration when setting properties at `org.apache.camel.component.rest.openapi.RestOpenApiComponent - Line 166`.
   
   Example:
   ```
   - rest:
       id: rest-7e31
       consumes: application/json
       produces: application/json
       bindingMode: json
       skipBindingOnErrorCode: true
       clientRequestValidation: true
       consumerComponentName: servlet <----
       openApi:
         id: openApi-0642
         specification: oas/oas.yaml
         missingOperation: fail
   
   ```
   
   
   Highly appreciate your consideration on this and please correct me if I'm missing something.
   
   Thank you!
   
   ### Steps to reproduce the behavior
   
   1. Example yaml config
   
   ```
   - restConfiguration:
       component: servlet
       apiComponent: openapi
       port: "8080"
       contextPath: /camel/*
       bindingMode: json
       skipBindingOnErrorCode: false
       clientRequestValidation: true
       inlineRoutes: false
   - rest:
       id: rest-7e31
       consumes: application/json
       produces: application/json
       bindingMode: json
       skipBindingOnErrorCode: true
       clientRequestValidation: true
       openApi:
         id: openApi-0642
         specification: oas/oas.yaml
         missingOperation: fail
   - route:
       id: route-846a
       description: GetAllProductsOperation
       routeConfigurationId: GlobalExceptionHandlerRouteConfig,RestRequestInterceptorRouteConfig
       streamCache: true
       from:
         id: from-96c5
         uri: direct
         parameters:
           name: GetAllProductsOperationDirect
         steps:
           - log:
               id: log-1676
               message: "Received request to get products: ${exchange}"
               loggingLevel: INFO
               logName: RestSvcLogger
           - to:
               id: to-730c
               uri: direct
               parameters:
                 name: RestSvcGetAllProductsDirect
   ```
   
   
   ### Variant
   
   Vs Code Extension
   
   ### Container Management (if applicable)
   
   None
   
   ### Operating System (if applicable)
   
   Windows
   
   ### Version
   
   4.10.2
   
   ### Relevant log output
   
   ```shell
   
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] REST OpenAPI endpoint always uses `platform-http` ignoring `component: servlet` in Spring Boot [camel-karavan]

Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on issue #1527:
URL: https://github.com/apache/camel-karavan/issues/1527#issuecomment-2861804341

   Do not use servlet in spring-boot - use platform-http and leave it blank.
   and this is not a karavan issue - this ticket is only about karavan as an editor/designer having a bug.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] REST OpenAPI endpoint always uses `platform-http` ignoring `component: servlet` in Spring Boot [camel-karavan]

Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus closed issue #1527: REST OpenAPI endpoint always uses `platform-http` ignoring `component: servlet` in Spring Boot
URL: https://github.com/apache/camel-karavan/issues/1527


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] REST OpenAPI endpoint always uses `platform-http` ignoring `component: servlet` in Spring Boot [camel-karavan]

Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on issue #1527:
URL: https://github.com/apache/camel-karavan/issues/1527#issuecomment-2861869807

   Created JIRA: https://issues.apache.org/jira/browse/CAMEL-22050


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] REST OpenAPI endpoint always uses `platform-http` ignoring `component: servlet` in Spring Boot [camel-karavan]

Posted by "cdia8890 (via GitHub)" <gi...@apache.org>.
cdia8890 commented on issue #1527:
URL: https://github.com/apache/camel-karavan/issues/1527#issuecomment-2861916460

   Thanks a lot for the quick response. Will do!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org