Uploaded image for project: 'Kogito'
  1. Kogito
  2. KOGITO-6800

OpenAPI call mixing body and path arguments lead to incorrect URL

XMLWordPrintable

    • False
    • False
    • 2022 Week 08-10 (from Feb 21), 2022 Week 11-13 (from Mar 14)

      When using a function with just a single argument, path to remote call is generated correctly based on the following definition:

      {
        "name": "ansibleAction",
        "functionRef": {
          "refName": "triggerAnsible",
          "arguments": {
            "id": "7"
          }
        }
      } 

      This resolves to /api/v2/job_templates/7/launch/

       

      If arguments are changed to the definition below, then the expect id param fails to be resolved:

       

      {
        "name": "ansibleAction",
        "functionRef": {
          "refName": "triggerAnsible",
          "arguments": {
            "id": "7",
            "data": {
              "extra_vars": {
                "kogito_id": "$CONTEXT.workflowInstanceId"
              }
            }
          }
        }
      } 

       This resolves to /api/v2/job_templates//launch/

       

      In the generated method, jobTemplatesJobTemplatesLaunchCreate, the parameter JsonNode id value is:

      {"extra_vars": {"kogito_id":"$CONTEXT.workflowInstanceId"}}

       

      Solution

      Support for function arguments of the form

      "arguments": { "<anyName>": {"leftElement": "${.fahrenheit}", "rightElement": "${.subtractValue}"}}

      has been removed, since it was not aligned with editor tools and spec examples

      The preferred way to specify request parameters is

      "arguments": { "leftElement": "${.fahrenheit}", "rightElement": "${.subtractValue}"}

      The arguments in the json object will be used as path parameter, body parameter, query parameter or header parameter as specified in the open api spec operation (currently we are only supporting path and body parameter, header and query will be added with https://issues.redhat.com/browse/KOGITO-6895).

      We are also supporting (for those expression languages, like jq, that can generate a json object as result of expression evaluation) a string containing an expression

      "arguments": "${{ leftElement: .fahrenheit, rightElement: .subtractValue}}"

      The result of the expression will be use as body of the request.  Therefore, the request musts  not have any parameter that is not a body one (not path, query or header param)

              ftirados Francisco Javier Tirado Sarti
              cnicolai@redhat.com Cristiano Nicolai (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: