swagger-api / swagger-api/swagger-ui
Missing square brackets on object array property after serializing.
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
- OS: Windows
- Browser: Chrome
- Version: 113.0.5672.63
- Method of installation: PHP port for swagger UI - https://github.com/zircote/swagger-php
- Swagger-UI version:v4.18.3
- Swagger/OpenAPI version: 3.0
When using content-type as multi-part/form-data with array object parameters, it seems that swagger UI encodes the parameter incorrectly, its missing square brackets for arrays []:


Here is my open api definition, you can see the problem for yourself on https://editor-next.swagger.io just paste the definition and test the field.
openapi: 3.0.3
info:
title: Swagger Petstore - OpenAPI 3.0
description: 'test'
version: "1.0.0"
termsOfService: http://swagger.io/terms/
servers:
- url: "https://127.0.0.1"
paths:
/api/kits:
post:
tags:
- Kit
summary: Create a new kit
description: Create a new kit
operationId: createKit
requestBody:
description: Pass kit details
required: true
content:
multipart/form-data:
schema:
properties:
products:
type: array
items:
properties:
id:
type: integer
example: '1'
quantity:
type: integer
example: '1'
type: object
name:
type: string
format: text
example: Kit 1
type: object
responses:
'200':
description: Successful operation
The array property is not serialized properly, its missing the square brackets...
Is this behavior intended, or is this a bug? How do I fix this?
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
Start by reproducing the report in Swagger UI or editor-next.swagger.io with the provided OpenAPI 3.0.3 multipart/form-data definition and inspect the request serialization path. Done means the object array property is serialized with the expected square brackets ([]) while preserving the other form fields.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100