apache / camel-karavan

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

allowableValues are not populated correctly when generating routes in REST DSL from an OpenAPI definition #1187

Closed cjmamo closed 8 months ago

cjmamo commented 8 months ago

From Karavan's VS Code extension, I've generated routes in REST DSL from the following OpenAPI definition: us-core-server.openapi.json. As far as I can tell, the allowableValues key is never populated correctly. For example:

Expected (as generated from JBang with Camel 4.4.0)

  - id: "createCareTeam"
    path: "/CareTeam"
    consumes: "application/fhir+json,application/fhir+xml"
    produces: "application/fhir+json,application/fhir+xml"
    param:
    - collectionFormat: "multi"
      dataType: "string"
      description: "Requests the server to return a designated subset of the resource"
      name: "_summary"
      required: false
      type: "query"
      allowableValues:
      - "true"
      - "text"
      - "data"
      - "count"
      - "false"
    - collectionFormat: "multi"
      dataType: "string"
      description: "Specify alternative response formats by their MIME-types (when\
        \ a client is unable acccess accept: header)"
      name: "_format"
      required: false
      type: "query"
    - collectionFormat: "multi"
      dataType: "boolean"
      description: "Ask for a pretty printed response for human convenience"
      name: "_pretty"
      required: false
      type: "query"
    - collectionFormat: "csv"
      dataType: "array"
      description: "Requests the server to return a collection of elements from\
        \ the resource"
      name: "_elements"
      required: false
      type: "query"
    - description: "The new state of the resource"
      name: "body"
      required: true
      type: "body"
    to: "direct:createCareTeam"

Actual (as generated from Karavan v4.4.0)

    - id: createCareTeam
      path: /CareTeam
      to: direct:createCareTeam
      consumes: application/fhir+json,application/fhir+xml
      produces: application/fhir+json,application/fhir+xml
      param:
        - description: Requests the server to return a designated subset of the resource
          name: _summary
          type: query
          required: false
          collectionFormat: multi
          dataType: string
          allowableValues:
            - '0': t
              '1': r
              '2': u
              '3': e
            - '0': t
              '1': e
              '2': x
              '3': t
            - '0': d
              '1': a
              '2': t
              '3': a
            - '0': c
              '1': o
              '2': u
              '3': 'n'
              '4': t
            - '0': f
              '1': a
              '2': l
              '3': s
              '4': e
        - description: >-
            Specify alternative response formats by their MIME-types (when a
            client is unable acccess accept: header)
          name: _format
          type: query
          required: false
          collectionFormat: multi
          dataType: string
        - description: Ask for a pretty printed response for human convenience
          name: _pretty
          type: query
          required: false
          collectionFormat: multi
          dataType: boolean
        - description: >-
            Requests the server to return a collection of elements from the
            resource
          name: _elements
          type: query
          required: false
          collectionFormat: csv
          dataType: array
        - description: The new state of the resource
          name: body
          type: body
          required: true
cjmamo commented 8 months ago

Additionally, I've observed that allowableValues also becomes messed up after opening the REST YAML from the REST tab:

image