elements icon indicating copy to clipboard operation
elements copied to clipboard

Issues passing array element correctly for a POST application/x-www-form-urlencoded content type

Open freddyexposito opened this issue 1 year ago • 0 comments

We are trying to render correctly a POST endpoint for application/x-www-form-urlencoded content type but there is an issue to try to pass multiple elements to an array of Strings element.

Context

Our customers cannot properly use our stoplight API test page to submit POST request to our test server when there is an array of multiple values in a application/x-www-form-urlencoded request

Current Behavior

When we put multiple values in the array, the curl generated command doesn't put the array variable properly image image

Expected Behavior

It should be able to render the curl command using the same array variable to pass multiple values

curl --request POST \
--url https://brokers.vividseats.com/webservices/v1/transfer0rderVic
-header 'Accept: application/xml, application/json* \
--header 'Content-Type: application/x-www-form-urlencoded' \/
--data apiToken= \
--data 'orderId=' \
-data orderiloken=
--data 'transferURLList=http://a.com'
--data 'transferURLList=http://b.com'
-data transter sources

Possible Workaround/Solution

not known

Steps to Reproduce

Creating endpoint like this one

"/v1/transferOrderViaURL" : {
      "post" : {
        "tags" : [ "/v1" ],
        "summary" : "/transferOrderViaURL",
        "description" : "XML response response and supports JSON<br />Order id or orderToken are required <br />Transfers Electronic Transfer tickets via URL<br />Not rate limited",
        "operationId" : "transferOrderViaURL",
        "requestBody" : {
          "content" : {
            "application/x-www-form-urlencoded" : {
              "schema" : {
                "type" : "object",
                "properties" : {
                  "apiToken" : {
                    "type" : "string"
                  },
                  "orderId" : {
                    "type" : "integer",
                    "format" : "int32"
                  },
                  "orderToken" : {
                    "type" : "string"
                  },
                  "transferURLList" : {
                    "type" : "array",
                    "items" : {
                      "type" : "string"
                    }
                  },
                  "transferSource" : {
                    "type" : "string"
                  }
                }
              }
            },
            "*/*" : {
              "schema" : {
                "type" : "object",
                "properties" : {
                  "apiToken" : {
                    "type" : "string"
                  },
                  "orderId" : {
                    "type" : "integer",
                    "format" : "int32"
                  },
                  "orderToken" : {
                    "type" : "string"
                  },
                  "transferURLList" : {
                    "type" : "array",
                    "items" : {
                      "type" : "string"
                    }
                  },
                  "transferSource" : {
                    "type" : "string"
                  }
                }
              }
            }
          }
        },
        "responses" : {
          "200" : {
            "description" : "Successful operation",
            "content" : {
              "application/xml" : {
                "schema" : {
                  "$ref" : "#/components/schemas/Response"
                }
              },
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/Response"
                }
              }
            }
          }
        }
      }
    }

Environment

https://vividseats.stoplight.io/

freddyexposito avatar Nov 22 '24 20:11 freddyexposito