参考下面的例子,我想NamedElementArray
在它的定义中提供一个例子。这将需要显示属性数组的示例NamedElement
。elements
我怎么做?我在 swagger 规范中找不到有关如何执行此操作的详细信息。
swagger: '2.0'
info:
version: "0.0.0"
title: Example
definitions:
Identifier:
type: string
format: uuid
NamedElement:
type: object
properties:
name:
type: string
identifier:
$ref: "#/definitions/Identifier"
required:
- name
- identifier
example:
name: Identifier1
identifier: ab804529-11d0-4781-a49a-3bbbc40243df
NamedElementArray:
type: object
properties:
name:
type: string
elements:
type: array
minLength: 0
items:
$ref: "#/definitions/NamedElement"
required:
- name
- elements
example:
name: Fred
elements:
paths:
/elements/{name}:
get:
description: |
Gets `NamedElement` objects, based on the **name** query param.
parameters:
-
name: name
in: path
description: Name of element array to return
required: true
type: string
responses:
200:
description: Returns a named element array
schema:
$ref: "#/definitions/NamedElementArray"
default:
description: Return nothing