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-unsubscr...@camel.apache.org.apache.org

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

Reply via email to