Incorrect callback object reference (OpenAPI 3.0)

A callback reference does not point to a valid callback definition

Description

A callback’s $ref must point to a valid Callback Object. An incorrect path or name prevents the definition of the API’s subsequent callback request from being loaded.

Potential impact

Documentation or client code generation may fail, or information needed to integrate the callback may be omitted.

Remediation

Reference existing shared callbacks under #/components/callbacks/.... Valid Callback Objects in external files are also supported. Check both the path and the target name.

Examples

These excerpts correct callbaccgcks to callbacks in a POST operation’s callback reference. The original request body definition that supplies the callback URL is omitted.

Before

json
{
  "openapi": "3.0.0",
  "info": {
    "title": "Simple API Overview",
    "version": "1.0.0"
  },
  "paths": {
    "/": {
      "post": {
        "operationId": "listVersionsv2",
        "summary": "List API versions",
        "responses": {
          "200": {
            "description": "Success"
          }
        },
        "callbacks": {
          "myEvent": {
            "$ref": "#/components/callbaccgcks/inProgress"
          }
        }
      }
    }
  },
  "components": {
    "callbacks": {
      "inProgress": {
        "{$request.body#/inProgressUrl}": {
          "post": {
            "requestBody": {
              "content": {
                "application/json": {
                  "schema": {
                    "type": "object"
                  }
                }
              }
            },
            "responses": {
              "200": {
                "description": "OK"
              }
            }
          }
        }
      }
    }
  }
}

After

json
{
  "openapi": "3.0.0",
  "info": {
    "title": "Simple API Overview",
    "version": "1.0.0"
  },
  "paths": {
    "/": {
      "post": {
        "operationId": "listVersionsv2",
        "summary": "List API versions",
        "responses": {
          "200": {
            "description": "Success"
          }
        },
        "callbacks": {
          "myEvent": {
            "$ref": "#/components/callbacks/inProgress"
          }
        }
      }
    }
  },
  "components": {
    "callbacks": {
      "inProgress": {
        "{$request.body#/inProgressUrl}": {
          "post": {
            "requestBody": {
              "content": {
                "application/json": {
                  "schema": {
                    "type": "object"
                  }
                }
              }
            },
            "responses": {
              "200": {
                "description": "OK"
              }
            }
          }
        }
      }
    }
  }
}

References