Project: KICS (Provisioning / Security & Compliance)
File: f5b2e6af-76f5-496d-8482-8f898c5fdb4a.md

title: Parameters Name In Combination Not Unique (v3) hide: toc: true navigation: true <style> .highlight .hll { background-color: #ff171742; } .md-content { max-width: 1100px; margin: 0 auto; } </style> Query id: f5b2e6af-76f5-496d-8482-8f898c5fdb4a Query name: Parameters Name In Combination Not Unique (v3) Platform: OpenAPI Severity: <span style="color:#5bc0de">Info</span> Category: Structure and Semantics URL: Parameters properties 'name' and 'in' should have unique combinations<br> ```json title="Positive test num. 1 - json file" hl_lines="28 37" { "openapi": "3.0.0", "info": { "title": "Simple API Overview", "version": "1.0.0" }, "paths": { "/": { "get": { "operationId": "listVersionsv2", "summary": "List API versions", "responses": { "200": { "description": "200 response" } }, "parameters": [ { "$ref": "#/components/parameters/limitJSONParam" } ] } } }, "components": { "parameters": { "limitJSONParam": { "name": "limit", "in": "query", "description": "max records to return", "required": true, "schema": { "type": "integer" } }, "otherJSONParam": { "name": "limit", "in": "query", "description": "max records to return", "required": true, "schema": { "type": "integer" } } } } } ``` ```yaml title="Positive test num. 2 - yaml file" hl_lines="25 18" openapi: 3.0.0 info: title: Simple API Overview version: 1.0.0 paths: "/": get: operationId: listVersionsv2 summary: List API versions responses: "200": description: 200 response parameters: "$ref": "#/components/parameters/limitParam" components: parameters: limitParam: name: limit in: query description: max records to return required: true schema: type: integer otherParam: name: limit in: query description: max records to return required: true schema: type: integer ``` ```json title="Positive test num. 3 - json file" hl_lines="21" { "swagger": "2.0", "info": { "title": "Simple API Overview", "version": "1.0.0" }, "paths": { "/": { "get": { "responses": { "200": { "description": "200 response" } }, "parameters": [ { "items": { "type": "string" }, "collectionFormat": "csv", "name": "limit", "in": "path", "description": "ID of pet to use", "required": true, "type": "array" }, { "required": true, "type": "array", "items": { "type": "string" }, "collectionFormat": "csv", "name": "limit", "in": "path", "description": "ID of pet to use" } ], "operationId": "listVersionsv2", "summary": "List API versions" } } } } ``` <details><summary>Positive test num. 4 - yaml file</summary> ```yaml hl_lines="14" swagger: "2.0" info: title: Simple API Overview version: 1.0.0 paths: "/": get: operationId: listVersionsv2 summary: List API versions responses: "200": description: 200 response parameters: name: limit in: path description: ID of pet to use required: true type: array items: type: string collectionFormat: csv name: limit in: path description: ID of pet to use required: true type: array items: type: string collectionFormat: csv ``` </details> ```json title="Negative test num. 1 - json file" { "openapi": "3.0.0", "info": { "title": "Simple API Overview", "version": "1.0.0" }, "paths": { "/": { "get": { "operationId": "listVersionsv2", "summary": "List API versions", "responses": { "200": { "description": "200 response" } }, "parameters": [ { "$ref": "#/components/parameters/negativeLimitParam" } ] } } }, "components": { "parameters": { "negativeLimitParam": { "name": "limit", "in": "query", "description": "max records to return", "required": true, "schema": { "type": "integer" } }, "negativeOtherParam": { "name": "other", "in": "query", "description": "max records to return", "required": true, "schema": { "type": "integer" } } } } } ``` ```yaml title="Negative test num. 2 - yaml file" openapi: 3.0.0 info: title: Simple API Overview version: 1.0.0 paths: "/": get: operationId: listVersionsv2 summary: List API versions responses: "200": description: 200 response parameters: "$ref": "#/components/parameters/negativeLimitParam" components: parameters: negativeLimitParam: name: limit in: query description: max records to return required: true schema: type: integer negativeOtherParam: name: other in: header description: max records to return required: true schema: type: integer ```