説明
レスポンスのリンク参照は、後続の操作とそこに渡す値を記述したリンクオブジェクトを指す必要があります。
想定される影響
パスが誤っていると、次の呼び出しに必要な情報を文書から読み取れません。
対処方法
#/components/links/... または外部ファイルのリンクを参照してください。リンク先の操作が存在し、パラメーターの式が元のリクエストやレスポンスから値を取得できることを確認します。
例
NotFound 内のリンクは #/components/links/address を参照します。外部モデル、エラースキーマ、後続操作の定義は省略されているので、仕様全体で確認してください。
変更前
json
{
"openapi": "3.0.0",
"info": {
"title": "Simple API overview",
"version": "1.0.0"
},
"paths": {
"/": {
"get": {
"responses": {
"200": {
"description": "the user being returned",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"uuid": {
"type": "string",
"format": "uuid"
}
}
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"Pet": {
"$ref": "../models/pet.yaml"
},
"User": {
"$ref": "https://api.example.com/v2/openapi.yaml#/components/schemas/User"
}
},
"responses": {
"NotFound": {
"description": "The specified resource was not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
},
"links": {
"l": {
"$ref": "#components/linfks/address"
}
}
}
},
"links": {
"address": {
"operationId": "getUssssserAddress",
"parameters": {
"userId": "$request.path.id"
}
}
}
}
}
変更後
json
{
"openapi": "3.0.0",
"info": {
"title": "Simple API overview",
"version": "1.0.0"
},
"paths": {
"/": {
"get": {
"responses": {
"200": {
"description": "the user being returned",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"uuid": {
"type": "string",
"format": "uuid"
}
}
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"Pet": {
"$ref": "../models/pet.yaml"
},
"User": {
"$ref": "https://api.example.com/v2/openapi.yaml#/components/schemas/User"
}
},
"responses": {
"NotFound": {
"description": "The specified resource was not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
},
"links": {
"l": {
"$ref": "#/components/links/address"
}
}
}
},
"links": {
"address": {
"operationId": "getUssssserAddress",
"parameters": {
"userId": "$request.path.id"
}
}
}
}
}