apache / camel-karavan

Apache Camel Karavan a Low-code Data Integration Platform
https://camel.apache.org
Apache License 2.0
388 stars 133 forks source link

Unsupported field: enableCORS #1267

Closed samar-elsayed closed 1 month ago

samar-elsayed commented 1 month ago

Describe the bug

I am using the latest karavan VScode plugin version and when I try to enable CORS for rest endpoint it gives me Unsupported field: enableCORS

Steps to reproduce the behavior

image

Variant

Vs Code Extension

Container Management (if applicable)

None

Operating System (if applicable)

None

Version

4.5.0

Relevant log output

No response

mgubaidullin commented 1 month ago

Please share yaml and Camel version you are running

samar-elsayed commented 1 month ago

@mgubaidullin HYG

Camel Version: 4.5.0

- rest:
    id: rest-c531
    path: test/v1
    consumes: application/json
    produces: application/json
    bindingMode: auto
    post:
      - id: post-f13f
        disabled: true
        path: inquiry
        to: direct:Inquiry
        consumes: application/json
        produces: application/json
        bindingMode: auto
        enableCORS: true
        routeId: inquiry
      - id: post-bd88
        path: payment
        to: direct:Payment
- route:
    id: route-a3bb
    description: "SP Auth "
    nodePrefixId: route-ebf
    from:
      id: from-0376
      uri: timer
      parameters:
        timerName: gen-auth-token
        period: "270000"
      steps:
        - step:
            id: step-0e9f
            description: Auth Steps
            steps:
              - process:
                  id: process-9c1b
                  description: AuthReq
                  ref: AuthReq
              - log:
                  id: log-0413
                  message: ${body}
              - removeHeaders:
                  id: removeHeaders-b555
                  description: Remove Camel Headers
                  pattern: Camel*
              - to:
                  id: to-8d87
                  description: Auth API
                  uri: https
                  parameters:
                    httpUri: optest.test.net/api/onlinepayment/Authenticate
                    bridgeEndpoint: true
                    httpMethod: POST
              - process:
                  id: process-2f31
                  description: AuthRes
                  ref: AuthRes
        - to:
            id: to-3292
            description: Cache Auth Token
            uri: caffeine-cache
            parameters:
              action: PUT
              cacheName: Auth_Token
              key: Auth_Token
              maximumSize: 1
              initialCapacity: 1
              evictionType: time_based
              expireAfterAccessTime: "270"
              expireAfterWriteTime: "270"
- route:
    id: Inquiry
    nodePrefixId: route-94b
    from:
      id: from-18a6
      uri: direct
      parameters:
        name: Inquiry
      steps:
        - step:
            id: step-8b19
            description: test Token Validation
            steps:
              - marshal:
                  id: marshal-d49b
                  json:
                    id: json-64d8
              - setProperty:
                  id: setProperty-d35e
                  name: InquiryReqBody
                  expression:
                    simple:
                      id: simple-31b3
                      expression: ${body}
                      resultType: String
              - process:
                  id: process-268d
                  description: test Token Req
                  ref: testTokenReq
              - to:
                  id: to-01c1
                  description: Keycloak Validation
                  uri: http
                  parameters:
                    httpUri: >-
                      10.90.7.61:30888/realms/master/protocol/openid-connect/token/introspect
                    httpMethod: POST
              - log:
                  id: log-da0a
                  disabled: true
                  message: After token validation == ${body}
        - choice:
            id: choice-1e9b
            when:
              - id: when-56bd
                expression:
                  jsonpath:
                    id: jsonpath-d058
                    expression: $[?(@.active == true)]
                steps:
                  - step:
                      id: Inquiry Steps
                      description: Inquiry Steps
                      steps:
                        - to:
                            id: to-50cf
                            description: Get Auth Token
                            uri: caffeine-cache
                            parameters:
                              action: GET
                              cacheName: Auth_Token
                              key: Auth_Token
                              maximumSize: 1
                              initialCapacity: 1
                              evictionType: time_based
                              expireAfterAccessTime: "270"
                              expireAfterWriteTime: "270"
                        - log:
                            id: log-da6b
                            message: >-
                              Token is ${body} ====== Inquiry Req body from BE
                              is ${exchangeProperty.InquiryReqBody}
                        - process:
                            id: process-3b07
                            description: InquiryReq
                            ref: InquiryReq
                        - log:
                            id: log-67eb
                            message: Inquiry Req to SP is  ===  ${body}
                        - to:
                            id: to-5126
                            description: Inquiry API
                            uri: https
                            parameters:
                              httpUri: optest.test.net/api/onlinepayment/Inquiry
                              bridgeEndpoint: true
                              httpMethod: POST
                        - log:
                            id: log-4fb9
                            message: Inquiry Res from SP is === ${body}
                        - process:
                            id: process-36b9
                            description: InquiryRes
                            ref: InquiryRes
                        - log:
                            id: log-f5cd
                            disabled: true
                            message: Before Unmarshal === ${body}
                        - setHeaders:
                            id: setHeaders-c224
                            headers:
                              - id: setHeader-2eeb
                                name: Access-Control-Request-Method
                                expression:
                                  constant:
                                    id: constant-b672
                                    expression: POST
                              - id: setHeader-14e2
                                name: Access-Control-Allow-Headers
                                expression:
                                  constant:
                                    id: constant-d801
                                    expression: Content-Type
                              - id: setHeader-4db5
                                name: Access-Control-Allow-Origin
                                expression:
                                  simple:
                                    id: simple-d087
                                    expression: "*"
                        - unmarshal:
                            id: unmarshal-4468
                            json:
                              id: json-2d1c
                              prettyPrint: true
                              library: Jackson
                        - log:
                            id: log-2503
                            disabled: true
                            message: Inquiry Res to BE === ${body}
            otherwise:
              id: otherwise-acdc
              steps:
                - process:
                    id: process-795d
                    description: Expired test Token
                    ref: ExpiredtestToken
davsclaus commented 1 month ago

Thanks its a bug in Camel to be fixed by https://issues.apache.org/jira/browse/CAMEL-20750

Fixed in Camel 4.7.0