Incorrect link object reference (OpenAPI 3.0)

A link describing a subsequent API operation has an invalid reference

Description

A response link must point to a Link Object describing the follow-up operation and any values to pass to it.

Potential impact

With a broken path, readers lose the information needed to make that follow-up call.

Remediation

Reference a link under #/components/links/... or in an external file. Check that the target operation exists and that any parameter expressions can read their values from the original request or response.

Examples

The link in NotFound now points to #/components/links/address. Check the external models, error schema and follow-up operation in the full specification. Their definitions are omitted here.

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