swagger-api / swagger-api/swagger-ui
Wrong encoding when omitted
Open
Nobody has claimed this yet.
cat: try-it-out
specification: 3.x
type: bug
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
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:
- Go to '/implicit-encoding'
- Click on 'try it out'
- Click on 'add integer item'
- Add two or more items
- 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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the provided implicit-encoding and explicit-encoding definitions, following the listed Try it out steps. Trace the form-encoding request generation used by the implicit endpoint and verify that executing it produces repeated numbers parameters in the curl command, matching the explicit endpoint's behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, openapi
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100