apigee-127 / swagger-tools

A Node.js and browser module that provides tooling around Swagger.
MIT License
702 stars 373 forks source link

Duplicate operationId is not throwing errors #219

Open who opened 9 years ago

who commented 9 years ago

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"
                    }
                }
            }
        }
    }
}
whitlockjc commented 9 years ago

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

whitlockjc commented 9 years ago

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

sdementen commented 6 years ago

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/)

whitlockjc commented 6 years ago

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.