1
我正在尝试创建OpenAPI yml文档文件(通过放大器)。我的一个API调用返回资源列表。每个资源都有属性,一个自我链接和一个链接到一个额外的链接,它将检索与资源相关的其他“内容”。如何记录使用OpenAPI资源列表的响应
请看下面的例子:
[
{
"name": "object-01",
"links": [
{
"rel": "self",
"href": "http://localhost:8800/foo/object-01"
},
{
"rel": "Supported stuff",
"href": "http://localhost:8800/foo/object-01/stuff"
}
]
}, {
"name": "object-02",
"links": [
{
"rel": "self",
"href": "http://localhost:8800/foo/object-02"
},
{
"rel": "Supported stuff",
"href": "http://localhost:8800/foo/object-02/stuff"
}
]
}, {
"name": "object-03",
"links": [
{
"rel": "self",
"href": "http://localhost:8800/foo/object-03"
},
{
"rel": "Supported stuff",
"href": "http://localhost:8800/foo/object-03/stuff"
}
]
}
]
我不知道什么是记录的正确方法,这就是我在的地方现在。
paths:
/foo/objects:
get:
operationId: getObject
responses:
'200':
description: Respresentation of objects
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/object'
links:
self:
$ref: '#/components/links/object'
components:
links:
object:
operationId: getSObject
stuff:
operationId: getStuff
schemas:
object:
type: object
properties:
name:
type: string
但我不认为这是充分代表我的API。
感谢您的帮助,包括在实际的响应
感谢工作就像一个魅力! – jonatzin