How can I define and reference an array of object as a parameter
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2020
10:49 AM
11-09-2020
10:49 AM
How can I define and reference an array of object as a parameter
I have a REST endpoint which accepts and Id and an object as input parameter. I have documented it as follows :
/api/exam/end:
post:
tags:
- Exam
summary: Bla bla
operationId: exam_end
description: Bla bla
parameters:
- in: query
name: sectionId
description: Bla bla
required: true
schema:
type: integer
format: int32
- in: query
name: answers
description: Bla bla
required: true
schema:
type: array
items:
$ref: '#/components/schemas/ExamAnswerObject'
responses:
'200':
description: Bla bla
content:
application/json:
schema:
$ref: '#/components/schemas/EndExamSectionResponse'
I also have a valid definition for "ExamAnswerObject" where it is correctly displayed in the Schemas section. The problem is the document does not have a "Schema" link as it has in other parts.
IS there anything I am missing here or the "parameters" part does not allow such definition?
Solved! Go to Solution.
1 REPLY 1
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2020
01:52 PM
11-16-2020
01:52 PM
@utkuozan wrote:IS there anything I am missing here or the "parameters" part does not allow such definition?
Your definition is correct, but Swagger UI currently does not display the schemas of object parameters. This issue is tracked here:
https://github.com/swagger-api/swagger-ui/issues/4581
Helen Kosova
SmartBear Documentation Team Lead
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
