swagger-ui icon indicating copy to clipboard operation
swagger-ui copied to clipboard

Wrong encoding when omitted

Open avalloneandrea opened this issue 4 years ago • 1 comments

Q&A (please complete the following information)

  • OS: macOS]
  • Browser: chrome
  • Version: 96
  • Method of installation: maven
  • Swagger/OpenAPI version: Swagger 2.0, OpenAPI 3.0

Content & configuration

Example Swagger/OpenAPI definition:

openapi: 3.0.0
info:
  title: Test API
  version: '1.0'
servers:
  - url: 'http://localhost:3000'
paths:
  /implicit-encoding:
    post:
      summary: Implicit encoding
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                numbers:
                  type: array
                  items:
                    format: int64
                    type: integer
      responses:
        '200':
          description: OK
  /explicit-encoding:
    post:
      summary: Explicit encoding
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                numbers:
                  type: array
                  items:
                    format: int64
                    type: integer
            encoding:
              numbers:
                style: form
                explode: true
      responses:
        '200':
          description: OK

Describe the bug you're encountering

To reproduce...

Steps to reproduce the behavior:

  1. Go to '/implicit-encoding'
  2. Click on 'try it out'
  3. Click on 'add integer item'
  4. Add two or more items
  5. Click on 'execute'

Expected behavior

The data of the curl command should be

  -d 'numbers=1&numbers=2&numbers=3'

Actual behavior

The data of the curl command is

  -d 'numbers=1,2,3'

Additional context or thoughts

The provided explicit-encoding endpoint works as expected.

avalloneandrea avatar Dec 08 '21 14:12 avalloneandrea

Can confirm this is still an issue

YuriiMotov avatar Nov 06 '25 16:11 YuriiMotov