Target of the JSON reference of the callback does not exist

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

Description

The target of the JSON reference of the callback cannot be found in your API. You must define the target callback 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 callback:

{
    "responses": {
        "201": {
            "description": "subscription created",
            "content": {
                // ...
            },
            "callbacks": {
                "callback_1": {
                    "$ref": "#/components/callbacks/reusableCallback"
                }
            }
        }
    },
    // ...
    "components": {
        // ...
        "callbacks": {
            "onData": {
                "{$request.query.callbackUrl}/data": {
                    "post": {
                        "requestBody": {
                            "description": "subscription payload",
                            "content": {
                                "application/json": {
                                    "schema": {
                                        "properties": {
                                            "timestamp": {
                                                "type": "string",
                                                "format": "date-time"
                                            },
                                            "userData": {
                                                "type": "string"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

Remediation

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

{
    "responses": {
        "201": {
            "description": "subscription created",
            "content": {
                // ...
            },
            "callbacks": {
                "callback_1": {
                    "$ref": "#/components/callbacks/onData"
                }
            }
        }
    }
}