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

SW rest API enum parameter would be changed to uppercase

XMLWordPrintable

    • False
    • None
    • False
    • ---
    • ---
    • 2022 Week 50-02 (from Dec 12), 2023 Week 03-05 (from Jan 16)
    • Important

      The API used in my test serverless workflow is as below.

      openapi: 3.0.3
      info:
        title: feishu bot
        version: '1.0.0'
        description: ""
      servers:
        - url: https://open.feishu.cn/open-apis/bot
      paths:
        /v2/hook/{hookId}:
          post:
            summary: PostBotMessage
            operationId: PostBotMessage
            parameters:
              - name: hookId
                in: path
                required: true
                schema:
                  type: string
            requestBody:
              content:
                application/json:
                  schema:
                    $ref: "#/components/schemas/PostBotMessage"
            responses:
              '200':
                description: ''
      components:
        schemas:
          PostBotMessage:
            type: object
            required: 
              - msg_type
              - content
            properties:
              msg_type:
                type: string
                enum:
                - 'text'
              content:
                type: object
                properties:
                  text:
                    type: string

      And then I used it as a rest function in the test serverless workflow.

      "functions": [
              {
                  "name": "PostBotMessage",
                  "type": "rest",
                  "operation": "classpath:/feishu.yaml#PostBotMessage"
              }
          ]
      ...
      "states": [
        {
                  "name": "New Data Processing",
                  "type": "event",
                  "onEvents": [
                      {
                          "eventRefs": [
                              "newDataProcessingEvent"
                          ],
                          "actions": [
                              {
                                  "functionRef": {
                                      "refName": "PostBotMessage",
                                      "arguments": {
                                          "hookId": "314ae0ba-d4e2-4639-944c-92954967de8e",
                                          "msg_type": "text",
                                          "content": {
                                              "text": "newDataProcessingEvent"
                                          }
                                      }
                                  }
                              }
                          ]
                      }
                  ],
                  "transition": "Prepare Upload"
              },
      ]

      Finally the API was called  but the "msg_type" was "TEXT" rather than "text".

      If the enum is removed from the openapi, "msg_type" is "text" as expected.

      I wonder if it is the wrong behavior or I have missed something to avoid this behavior.

       

      Thank you. 

              hbelmiro@redhat.com Helber Belmiro
              globefishng Marshall Ma (Inactive)
              Marian Macik Marian Macik
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: