Description
Swagger 2.0 lets different object schemas use the same property names. Keep a name if its meaning is clear within each object.
Potential impact
Renaming a field that clients already use can break request serialization or response handling.
Remediation
Clarify ambiguous descriptions and share common structures with $ref when useful. If a rename is necessary, check representative payloads and plan compatibility with existing clients.
Examples
The operation’s body and the reusable parameter can both use name, address and age. The referenced Address definition is omitted.
Before
json
{
"swagger": "2.0",
"info": {
"title": "Simple API Overview",
"version": "1.0.0"
},
"basePath": "/api",
"paths": {
"/": {
"get": {
"operationId": "listVersionsv2",
"summary": "List API versions",
"responses": {
"200": {
"description": "200 response"
}
},
"parameters": [
{
"name": "limit2",
"in": "body",
"description": "max records to return",
"required": true,
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"address": {
"$ref": "#/definitions/Address"
},
"age": {
"type": "integer",
"format": "int32"
}
}
}
}
]
}
}
},
"parameters": {
"limitParam": {
"name": "limit",
"in": "body",
"description": "max records to return",
"required": true,
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"address": {
"$ref": "#/definitions/Address"
},
"age": {
"type": "integer",
"format": "int32"
}
}
}
}
}
}
After
json
{
"swagger": "2.0",
"info": {
"title": "Simple API Overview",
"version": "1.0.0"
},
"basePath": "/api",
"paths": {
"/": {
"get": {
"operationId": "listVersionsv2",
"summary": "List API versions",
"responses": {
"200": {
"description": "200 response"
}
},
"parameters": [
{
"name": "limit2",
"in": "body",
"description": "max records to return",
"required": true,
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"address": {
"$ref": "#/definitions/Address"
},
"age": {
"type": "integer",
"format": "int32"
}
}
}
}
]
}
}
},
"parameters": {
"limitParam": {
"name": "limit",
"in": "body",
"description": "max records to return",
"required": true,
"schema": {
"type": "object",
"properties": {
"name_2": {
"type": "string"
},
"address_2": {
"$ref": "#/definitions/Address"
},
"age_2": {
"type": "integer",
"format": "int32"
}
}
}
}
}
}
Only the reusable limitParam gains the _2 suffixes. The example’s GET operation uses its own inline body schema.