Project: KICS (Provisioning / Security & Compliance)
File: 8bfed1c6-2d59-4924-bc7f-9b9d793ed0df.md

title: Parameter Object Content With Multiple Entries hide: toc: true navigation: true <style> .highlight .hll { background-color: #ff171742; } .md-content { max-width: 1100px; margin: 0 auto; } </style> Query id: 8bfed1c6-2d59-4924-bc7f-9b9d793ed0df Query name: Parameter Object Content With Multiple Entries Platform: OpenAPI Severity: <span style="color:#5bc0de">Info</span> Category: Structure and Semantics URL: The map content property of the parameter object should only contain one entry<br> ```json title="Positive test num. 1 - json file" hl_lines="11 78" { "openapi": "3.0.0", "info": { "title": "Simple API Overview", "version": "1.0.0" }, "paths": { "/": { "get": { "summary": "List API versions", "parameters": [ { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" }, "examples": { "user": { "summary": "User Example", "externalValue": "http://foo.bar/examples/user-example.json" } } }, "application/xml": { "schema": { "$ref": "#/components/schemas/User" }, "examples": { "user": { "summary": "User Example in XML", "externalValue": "http://foo.bar/examples/user-example.xml" } } } }, "name": "id", "in": "path", "description": "ID of the API version", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "content": { "application/json": { "examples": { "foo": { "value": { "versions": [ { "updated": "2011-01-21T11:33:21Z", "id": "v2.0", "links": [ { "rel": "self", "href": "http://127.0.0.1:8774/v2/" } ], "status": "CURRENT" } ] } } } } }, "description": "200 response" } }, "operationId": "listVersionsv2" } }, "/user/{id}": { "parameters": [ { "description": "ID of the API version", "required": true, "schema": { "type": "integer" }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" }, "examples": { "user": { "summary": "User Example", "externalValue": "http://foo.bar/examples/user-example.json" } } }, "application/xml": { "schema": { "$ref": "#/components/schemas/User" }, "examples": { "user": { "summary": "User Example in XML", "externalValue": "http://foo.bar/examples/user-example.xml" } } } }, "name": "id", "in": "path" } ] } } } ``` ```json title="Positive test num. 2 - json file" hl_lines="44" { "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", "content": { "application/json": { "examples": { "foo": { "value": { "versions": [ { "status": "CURRENT", "updated": "2011-01-21T11:33:21Z", "id": "v2.0", "links": [ { "href": "http://127.0.0.1:8774/v2/", "rel": "self" } ] } ] } } } } } } } } } }, "components": { "parameters": { "idParam": { "name": "id", "in": "path", "description": "ID of the API version", "required": true, "schema": { "type": "int" }, "content": { "application/xml": { "examples": { "user": { "externalValue": "http://foo.bar/examples/user-example.xml", "summary": "User Example in XML" } }, "schema": { "$ref": "#/components/schemas/User" } }, "application/json": { "schema": { "$ref": "#/components/schemas/User" }, "examples": { "user": { "externalValue": "http://foo.bar/examples/user-example.json", "summary": "User Example" } } } } } } } } ``` ```yaml title="Positive test num. 3 - yaml file" hl_lines="48 10" openapi: 3.0.0 info: title: Simple API overview version: 1.0.0 paths: "/": get: operationId: listVersionsv2 summary: List API versions parameters: name: id in: path description: ID of the API version required: true schema: type: integer content: "application/json": schema: $ref: "#/components/schemas/User" examples: user: summary: User Example externalValue: "http://foo.bar/examples/user-example.json" "application/xml": schema: $ref: "#/components/schemas/User" examples: user: summary: User Example in XML externalValue: "http://foo.bar/examples/user-example.xml" responses: "200": description: 200 response content: application/json: examples: foo: value: versions: status: CURRENT updated: "2011-01-21T11:33:21Z" id: v2.0 links: href: http://127.0.0.1:8774/v2/ rel: self /user/{id}: parameters: name: id in: path description: ID of the API version required: true schema: type: integer content: "application/json": schema: $ref: "#/components/schemas/User" examples: user: summary: User Example externalValue: "http://foo.bar/examples/user-example.json" "application/xml": schema: $ref: "#/components/schemas/User" examples: user: summary: User Example in XML externalValue: "http://foo.bar/examples/user-example.xml" ``` <details><summary>Positive test num. 4 - yaml file</summary> ```yaml hl_lines="26" openapi:

info: title: Simple API overview version: 1.0.0 paths: "/": get: operationId: listVersionsv2 summary: List API versions responses: "200": description: 200 response content: application/json: examples: foo: value: versions: status: CURRENT updated: "2011-01-21T11:33:21Z" id: v2.0 links: href: http://127.0.0.1:8774/v2/ rel: self components: parameters: idParam: name: id in: path description: ID of the API version required: true schema: type: int content: "application/json": schema: $ref: "#/components/schemas/User" examples: user: summary: User Example externalValue: "http://foo.bar/examples/user-example.json" "application/xml": schema: $ref: "#/components/schemas/User" examples: user: summary: User Example in XML externalValue: "http://foo.bar/examples/user-example.xml" ``` </details> ```json title="Negative test num. 1 - json file" { "openapi": "3.0.0", "info": { "title": "Simple API Overview", "version": "1.0.0" }, "paths": { "/": { "get": { "summary": "List API versions", "parameters": [ { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" }, "examples": { "user": { "summary": "User Example", "externalValue": "http://foo.bar/examples/user-example.json" } } } }, "name": "id", "in": "path", "description": "ID of the API version", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "content": { "application/json": { "examples": { "foo": { "value": { "versions": [ { "updated": "2011-01-21T11:33:21Z", "id": "v2.0", "links": [ { "rel": "self", "href": "http://127.0.0.1:8774/v2/" } ], "status": "CURRENT" } ] } } } } }, "description": "200 response" } }, "operationId": "listVersionsv2" } }, "/user/{id}": { "parameters": [ { "description": "ID of the API version", "required": true, "schema": { "type": "integer" }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" }, "examples": { "user": { "summary": "User Example", "externalValue": "http://foo.bar/examples/user-example.json" } } } }, "name": "id", "in": "path" } ] } } } ``` ```json title="Negative test num. 2 - 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", "content": { "application/json": { "examples": { "foo": { "value": { "versions": [ { "status": "CURRENT", "updated": "2011-01-21T11:33:21Z", "id": "v2.0", "links": [ { "href": "http://127.0.0.1:8774/v2/", "rel": "self" } ] } ] } } } } } } } } } }, "components": { "parameters": { "idParam": { "name": "id", "in": "path", "description": "ID of the API version", "required": true, "schema": { "type": "int" }, "content": { "application/xml": { "examples": { "user": { "externalValue": "http://foo.bar/examples/user-example.xml", "summary": "User Example in XML" } }, "schema": { "$ref": "#/components/schemas/User" } } } } } } } ``` ```yaml title="Negative test num. 3 - yaml file" openapi: 3.0.0 info: title: Simple API overview version: 1.0.0 paths: "/": get: operationId: listVersionsv2 summary: List API versions parameters: name: id in: path description: ID of the API version required: true schema: type: integer content: "application/json": schema: $ref: "#/components/schemas/User" examples: user: summary: User Example externalValue: "http://foo.bar/examples/user-example.json" responses: "200": description: 200 response content: application/json: examples: foo: value: versions: status: CURRENT updated: "2011-01-21T11:33:21Z" id: v2.0 links: href: http://127.0.0.1:8774/v2/ rel: self /user/{id}: parameters: name: id in: path description: ID of the API version required: true schema: type: integer content: "application/json": schema: $ref: "#/components/schemas/User" examples: user: summary: User Example externalValue: "http://foo.bar/examples/user-example.json" ``` <details><summary>Negative test num. 4 - yaml file</summary> ```yaml 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 content: application/json: examples: foo: value: versions: status: CURRENT updated: "2011-01-21T11:33:21Z" id: v2.0 links: href: http://127.0.0.1:8774/v2/ rel: self components: parameters: idParam: name: id in: path description: ID of the API version required: true schema: type: int content: "application/json": schema: $ref: "#/components/schemas/User" examples: user: summary: User Example externalValue: "http://foo.bar/examples/user-example.json" ``` </details>