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