Target of the JSON reference of the link does not exist

Issue ID: v3-validation-reference-link-unresolved

Description

The target of the JSON reference of the link cannot be found in your API. You must define the target link in your API.

Example

The following is an example of how this issue could look in your API definition. The name used in the reference does not match the name of the link:

{
    "get": {
        "operationId": "getUserByName",
        "parameters": [
            {
                "name": "username",
                "in": "path",
                "required": true,
                "schema": {
                    "type": "string"
                }
            }
        ],
        "responses": {
            "200": {
                "description": "The User",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/user"
                        }
                    }
                },
                "links": {
                    "userRepositories": {
                        "$ref": "#/components/links/UserRepos"
                    }
                }
            }
        }
    },
    // ...
    "components": {
        "links": {
            "UserRepositories": {
                "operationId": "getRepositoriesByOwner",
                "parameters": {
                    "username": "$response.body#/username"
                }
            }
        }
    }
}

Remediation

Make sure that all targets of JSON references are defined in your API.

{
    "responses": {
        "200": {
            "description": "The User",
            "content": {
                "application/json": {
                    "schema": {
                        "$ref": "#/components/schemas/user"
                    }
                }
            },
            "links": {
                "userRepositories": {
                    "$ref": "#/components/links/UserRepositories"
                }
            }
        }
    }
}