swagger-tools icon indicating copy to clipboard operation
swagger-tools copied to clipboard

Duplicate operationId is not throwing errors

Open who opened this issue 9 years ago • 4 comments

According to the Swagger 2.0 spec, regarding operationId :

A friendly name for the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operation id to uniquely identify an operation.

However, a Swagger 2.0 spec with duplicate operationIds is not throwing an error via swagger-tools.

Here's a sample spec to repro the issue:

{
    "swagger": "2.0",
    "info": {
        "version": "0.0.0",
        "title": "Simple API"
    },
    "paths": {
        "/": {
            "get": {
                "operationId": "unoriginalOperationId",
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            },
            "post": {
                "operationId": "unoriginalOperationId",
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    }
}

who avatar May 26 '15 16:05 who

Yup, I just filed a bug at the same time you did. I will close #220 as a duplicate of this one.

whitlockjc avatar May 26 '15 16:05 whitlockjc

I had to reopen this since it broke backward compatibility. I will add this back when 1.0.0 is released.

whitlockjc avatar Aug 05 '15 14:08 whitlockjc

any news on this bug ? this control on duplicate id is missing from a lot of swagger validators ... (except the one behind https://editor.swagger.io/)

sdementen avatar Dec 18 '17 15:12 sdementen

This will not be released prior to 1.0.0, which itself might not be released due to this project being effectively deprecated, see #335.

whitlockjc avatar Dec 27 '17 21:12 whitlockjc