使用对象作为输入时未从 Swagger 2.0 模式获得预期结果

Not getting expected results from Swagger 2.0 schema when using object as input

我正在尝试创建一个 Swagger 定义文件,该文件采用 对象 作为输入,但该对象在运行时将具有临时字段名称。我快到了,但似乎无法获得预期的结果。这是相关的 yaml:

/connector_properties/{connector_name}:
    x-swagger-router-controller: contentBridge
    put:
      description: Sets properties for the specified connector
      operationId: setConnectorProperties
      consumes:
        - application/x-www-form-urlencoded
      parameters:
      - name: connector_name
        in: path
        description: The name of the connector
        required: true
        type: string
      - name: connector_properties
        in: body
        description: The properties to assign to the connector
        required: true
        schema:
          type: object
          additionalProperties:
            type: string
      responses:
        "200":
          description: Success
          schema:
            # a pointer to a definition
            $ref: "#/definitions/ParmResponse"
        # responses may fall through to errors
        default:
          description: Error
          schema:
            $ref: "#/definitions/ErrorResponse"

connector_name 参数工作正常,但 connector_properties 参数只允许我向对象添加一个字段。其他字段只是添加到第一个字段的值中。例如,如果我输入

query=somequery
stuff=otherstuff

对于 swagger-ui 页面中的这个字段,(ecc 对于 connector_name)我的程序接收

{
    "connectorName": "ecc",
    "properties": {
    "query": "somequery\nstuff=otherstuff"
    }
}

我是不是定义有误,输入的值有误,还是两者都有?如何在此输入参数对象中包含多个临时字段?

看起来我的 YAML 对我想做的事情是正确的。显然要么 Swagger-UI 在这方面有错误,要么我不知道如何正确输入参数(可能是后者)。如果我使用 Postman 等外部工具而不是 Swagger-UI 来发送请求,那么我会得到我预期的行为。