validator-badge icon indicating copy to clipboard operation
validator-badge copied to clipboard

Validator should not accept files with duplicate operationIds

Open LarryKlugerDS opened this issue 9 years ago • 4 comments

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" }}}
}}}

LarryKlugerDS avatar Dec 07 '15 11:12 LarryKlugerDS

Tha validator is based on json schema validation at the moment, and unfortunately that doesn't support checking for uniqueness of values.

webron avatar Dec 07 '15 17:12 webron

Ok, you may want to note this issue in the documentation for the validation tool.

LarryKlugerDS avatar Dec 07 '15 18:12 LarryKlugerDS

Fair point, thanks for bringing it up.

webron avatar Dec 07 '15 18:12 webron

This should be handled by the parser. If you could please open a ticket there, we'll get it fixed.

fehguy avatar Dec 07 '15 18:12 fehguy