Description
A model referenced through #/definitions/... must exist in definitions. If it is absent or named differently, the request or response body structure cannot be resolved.
Potential impact
Validation or model generation may fail, leaving client type information incomplete.
Remediation
Correct the schema reference to the exact model name or add the needed definition. Update all references when renaming a model.
Examples
These POST examples correct the response schema reference from Use to the actual model name, User.
Before
json
{
"swagger": "2.0",
"info": {
"title": "Simple API Overview",
"version": "1.0.0"
},
"paths": {
"/": {
"post": {
"operationId": "listVersionsv2",
"summary": "List API versions",
"responses": {
"200": {
"schema": {
"$ref": "#/definitions/Use"
},
"description": "A user"
}
},
"parameters": [
{
"$ref": "#/parameters/limitParam"
}
]
}
}
},
"parameters": {
"limitParam": {
"name": "limit",
"in": "body",
"description": "max records to return",
"required": true,
"schema": {
"type": "integer"
}
}
},
"definitions": {
"User": {
"type": "object",
"required": [
"id",
"name"
],
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
}
}
}
}
}
After
json
{
"swagger": "2.0",
"info": {
"title": "Simple API Overview",
"version": "1.0.0"
},
"paths": {
"/": {
"post": {
"operationId": "listVersionsv2",
"summary": "List API versions",
"responses": {
"200": {
"schema": {
"$ref": "#/definitions/User"
},
"description": "A user"
}
},
"parameters": [
{
"$ref": "#/parameters/limitParam"
}
]
}
}
},
"parameters": {
"limitParam": {
"name": "limit",
"in": "body",
"description": "max records to return",
"required": true,
"schema": {
"type": "integer"
}
}
},
"definitions": {
"User": {
"type": "object",
"required": [
"id",
"name"
],
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
}
}
}
}
}