Description
Use the Swagger 2.0 field name and case defined for each object. Keys inside properties are field names from your own data model.
Potential impact
A misspelled standard field can fail validation or disappear from the generated documentation or SDK.
Remediation
Validate the document and check the generated parameter descriptions and model fields. For custom metadata, use the x- prefix where the object supports extensions.
Examples
The first example misspells the path parameter’s description as descripption.
Before
json
{
"swagger": "2.0",
"info": {
"title": "Simple API Overview",
"version": "1.0.0"
},
"paths": {
"/{id}": {
"get": {
"summary": "List API versions",
"responses": {
"200": {
"description": "OK"
}
},
"operationId": "listVersionsv2"
},
"parameters": [
{
"descripption": "ID of pet to use",
"required": true,
"type": "array",
"items": {
"type": "string"
},
"collectionFormat": "csv",
"name": "id",
"in": "path"
}
]
}
},
"definitions": {
"ErrorModel": {
"type": "object",
"required": [
"message",
"code"
],
"propppperties": {
"message": {
"type": "string"
},
"code": {
"type": "integer",
"minimum": 100,
"maximum": 600
}
}
}
}
}
After
json
{
"swagger": "2.0",
"info": {
"title": "Simple API Overview",
"version": "1.0.0"
},
"paths": {
"/{id}": {
"get": {
"summary": "List API versions",
"responses": {
"200": {
"description": "OK"
}
},
"operationId": "listVersionsv2"
},
"parameters": [
{
"description": "ID of pet to use",
"required": true,
"type": "array",
"items": {
"type": "string"
},
"collectionFormat": "csv",
"name": "id",
"in": "path"
}
]
}
},
"definitions": {
"ErrorModel": {
"type": "object",
"required": [
"message",
"code"
],
"properties": {
"message": {
"type": "string"
},
"code": {
"type": "integer",
"minimum": 100,
"maximum": 600
}
}
}
}
}
The correction also changes propppperties to properties in ErrorModel. Its data fields message and code keep their names.