swagger-api / swagger-editor

Swagger Editor
https://editor.swagger.io
Apache License 2.0
8.9k stars 2.25k forks source link

Error reported in editor.swagger.io not found with validator.swagger.io #2869

Open craigpastro opened 2 years ago

craigpastro commented 2 years ago

Q&A (please complete the following information)

Example Swagger/OpenAPI definition:

{
  "swagger": "2.0",
  "info": {
    "version": "1.0.0",
    "title": "Swagger Petstore"
  },
  "paths": {
    "/pet/{pet_Id}": {
      "post": {
        "tags": [
          "pet"
        ],
        "operationId": "getPetById",
        "parameters": [
          {
            "in": "path",
            "name": "pet_Id",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation"
          }
        }
      }
    },
    "/pet/{petId}": {
      "get": {
        "tags": [
          "pet"
        ],
        "operationId": "getPetByAnId",
        "parameters": [
          {
            "name": "petId",
            "in": "path",
            "description": "ID of pet to return",
            "required": true,
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "successful operation"
          }
        }
      }
    }
  }
}

Describe the bug you're encountering

If I paste the spec above into editor.swagger.io it reports an error:

Semantic error at paths./pet/{petId}
Equivalent paths are not allowed.
Jump to line 28

However, if I send it to validator.swagger.io it reports valid. See screenshot below.

To reproduce...

As above.

Expected behavior

I would like for validate.swagger.io to report the same error as I see in the editor.

Screenshots

Screen Shot 2022-01-13 at 10 40 15 AM

Additional context or thoughts

Thank you for your time!

char0n commented 2 years ago

@craigpastro thanks for reporting it. SwaggerEditor has some additional rules of validation on top of validator service. We're probing the ideas of unification.