question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Submitting Array in requestBody with "application/x-www-form-urlencoded" ignores the explode encoding parameter

See original GitHub issue

I am attaching an example where explode is set to true in both the parameter block and the requestBody and they behave differently.

The example midway down this page mentions that you can specify the explode param in the encoding block for the requestBody - https://swagger.io/docs/specification/describing-request-body/

I’m using that exact example, except setting explode to true.

0

{
  "openapi" : "3.0.0",
  "info" : {
    "version" : "1.0.0",
    "title" : "Swagger Petstore",
    "license" : {
      "name" : "MIT"
    }
  },
  "servers" : [ {
    "url" : "http://petstore.swagger.io/v1"
  } ],
  "paths" : {
    "/pets" : {
      "post" : {
        "summary" : "Create a pet",
        "operationId" : "createPets",
        "tags" : [ "pets" ],
        "parameters" : [
          {
            "name" : "limit",
            "in" : "query",
            "description" : "How many items to return at one time (max 100)",
            "required" : false,
            "schema" : {
              "type" : "array",
              "items" : {
                "type": "string"
              }
            },
            "style": "form",
            "explode": true
          }
        ],
        "requestBody" : {
          "content" : {
            "application/x-www-form-urlencoded" : {
              "schema" : {  
                "type" : "object",
                "properties" : {
                  "color" : {
                    "type" : "array",
                    "items" : {
                      "type" : "string"
                    }
                  }
                }
              },
              "encoding" : {
                "color" : {
                  "style" : "form",
                  "explode" : true
                }
              }
            }
          }
        },
        "responses" : {
          "201" : {
            "description" : "Null response"
          }
        }
      }
    }
  }
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
shockeycommented, Apr 5, 2019

@xyfantis nothing yet!

2reactions
xyfantiscommented, Mar 6, 2019

@shockey any update on this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Encoding not exploding a property in requestBody in swagger-ui
There's currently no way to define your scenario (a multipart request with an exploded array) with OpenAPI, because the explode and style ...
Read more >
explode - Manual - PHP
Returns an array of strings created by splitting the string parameter on boundaries formed by the separator . If separator is an empty...
Read more >
WhatsNew 1.3 | Ktor Framework
Customize HttpCache behavior, serve stale if host is down, ignore max-age ... Headers use encoding different from other major HTTP clients ...
Read more >
PHP Explode – How to Split a String into an Array
The explode() function takes in three parameters: the separator; the string to convert to an array; and the limit. The full syntax looks...
Read more >
Pyspark - Split multiple array columns into rows - GeeksforGeeks
functions module. Syntax: pyspark.sql.functions.explode(col). Parameters: col is an array column ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found