swagger-api / swagger-api/swagger-parser

Possible regression of issue #1066 - Inaccurate reporting of duplicate parameter values when parsing schema

Open
#1,492 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
867
Forks
560
Avg merge
2d 21h
Merged PRs (30d)
7

Description

I am seeing an issue very similar to this: https://github.com/swagger-api/swagger-parser/issues/1066

using the sample schema:

{
  "openapi": "3.0.0",
  "info": {
    "title": "Test",
    "version": "1.0"
  },
  "paths": {
    "/foo": {
      "post": {
        "operationId": "foo",
        "parameters": [
          {
            "in": "header",
            "name": "x-something",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "header",
            "name": "x-something-else",
            "schema": {
              "type": "string"
            },
            "required": false
          }
        ],
        "responses": {
          "201": {
            "description": "Success–resource created."
          }
        }
      }
    },
    "/foo/bar": {
      "post": {
        "operationId": "foo2",
        "parameters": [
          {
            "$ref": "#/paths/~1foo/post/parameters/0"
          },
          {
            "$ref": "#/paths/~1foo/post/parameters/1"
          }
        ],
        "responses": {
          "201": {
            "description": "Success–resources created."
          }
        }
      }
    }
  }
}

when trying to parse this file I am getting the same error described in #1066, This issue was originally filed against the Atlassian Validator:
https://bitbucket.org/atlassian/swagger-request-validator/issues/307/inaccurate-reporting-of-duplicate

They were able to reproduce this using 2.0.23 of the swagger-parser which they use to drive the parsing of the schemas.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the report with the sample OpenAPI schema in this issue and compare the result with issue #1066 and swagger-parser 2.0.23. Trace how referenced parameters are resolved and duplicate values are reported. Done means the valid referenced parameters no longer produce the inaccurate duplicate-parameter error.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.