Incorrect link object reference (OpenAPI 3.0)

A link describing a subsequent API operation has an invalid reference

Description

A response’s link reference must point to a valid Link Object. An incorrect path or target prevents the link’s subsequent operation and parameter mappings from being loaded.

Potential impact

Documentation may omit information about follow-up calls, or reference resolution may fail.

Remediation

Reference existing shared links under #/components/links/.... Valid external Link Objects are also supported. Check the operation and parameters identified by the link.

Examples

These excerpts correct the reference path for the address link. External models, the error model and the follow-up operation definitions are omitted.

Before

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"
        }
      }
    }
  }
}

After

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"
        }
      }
    }
  }
}

References