설명
응답의 링크 참조는 후속 작업과 그 작업에 전달할 값을 설명하는 링크 객체를 가리켜야 합니다.
잠재적 영향
참조 경로가 잘못되면 문서에서 후속 호출에 필요한 정보를 찾을 수 없습니다.
해결 방법
#/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"
}
}
}
}
}