validator-badge
validator-badge copied to clipboard
Validator should not accept files with duplicate operationIds
Hi, The spec says that operationId values must be unique per API. But duplicate operationIds are accepted by the validator.
This short example passes validation, but shouldn't: http://online.swagger.io/validator/debug?url=http://assetsdp.arx.com/larry/swagger/swagger_dup_ids.json
{"swagger": "2.0",
"x-foo" : "woof",
"info": { "version": "0.0.0", "title": "Simple API" },
"paths": { "/": {
"get": {"operationId": "duplicateID", "responses": { "200": { "description": "OK" }}},
"put": {"operationId": "duplicateID", "responses": { "200": { "description": "OK" }}}
}}}
Tha validator is based on json schema validation at the moment, and unfortunately that doesn't support checking for uniqueness of values.
Ok, you may want to note this issue in the documentation for the validation tool.
Fair point, thanks for bringing it up.
This should be handled by the parser. If you could please open a ticket there, we'll get it fixed.