swagger-api / swagger-api/swagger-ui
Describing parameter with 'content' not working when using array of objects
Nobody has claimed this yet.
- 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: Ubuntu 18.04
- Browser: chrome
- Version: 80.0.3987.87
- Method of installation: dist assets
- Swagger-UI version: 3.25.0
- Swagger/OpenAPI version: OpenAPI 3.0
Example Swagger/OpenAPI definition:
openapi: 3.0.1
info:
title: API Docs
version: '1.0'
description: ''
termsOfService: ''
contact: []
tags: []
paths:
"/api/v1/example":
get:
description: Example endpoint
parameters:
- name: sort
in: query
content:
application/json:
schema:
type: array
items:
type: object
properties:
property:
type: string
direction:
type: string
Describe the bug you're encountering
Tried to use 'content' to describe a query parameter with type array of objects but its not working.
Example use case: ?sort=[{"property":"date", "direction":"ASC"}]
Expected behavior

Or like this (when clicking add item, it should add the single object schema):

Screenshots of what I got
Its all blank:

Related issue: https://github.com/swagger-api/swagger-ui/issues/4442
That issue solved the content rendering but only for simple json objects.
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 supplied OpenAPI 3.0 query-parameter example in Swagger UI 3.25.0 and compare it with the behavior described in related issue #4442. Trace the existing content rendering entry point and its tests, if present; done means an array of objects renders and can be added as the expected schema shows.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100