-
Notifications
You must be signed in to change notification settings - Fork 9.3k
deepObject query parameter doesn't work #4216
Description
| Q | A |
|---|---|
| Bug or feature request? | Bug |
| Which Swagger/OpenAPI version? | 3.0 |
| Which Swagger-UI version? | 3.10 |
| How did you install Swagger-UI? | git clone |
| Which browser & version? | Chrome 64 |
| Which operating system? | macOS |
The webui doesn't seem to handle deepObject correctly. For example:
openapi: 3.0.0
servers:
- url: https://localhost
info:
description: |
This is a sample API that allows to reproduce the deepObject UX issue
version: "1.0.0"
title: deepObject UX issue
paths:
/:
get:
parameters:
- in: query
name: param
schema:
type: object
properties:
first:
type: integer
example: 1
second:
type: string
example: "this is a string"
style: deepObject
explode: true
responses:
'200':
description: OK
Here's what the web-ui gives:
If I were to type first=1 in that box for example, the generated URL would be
https://localhost/?param[0]=f¶m[1]=i¶m[2]=r¶m[3]=s¶m[4]=t¶m[5]=%3D¶m[6]=1
As you can see, it simply iterates over each character, uses it's position at the argument name and the letter as the value.
This code from swagger-js expects an object to be passed as a parameter and wants to iterate over the keys of an object.
It seems like deepObject fields in swagger-ui should be treated as a JSON document and be unserialized into an object before being passed to swagger-jss parameter-builds.js:query.
