Project: KICS (Provisioning / Security & Compliance)
File: 3b615f00-c443-4ba9-acc4-7c308716917d.md

title: Unknown Prefix (v2) hide: toc: true navigation: true <style> .highlight .hll { background-color: #ff171742; } .md-content { max-width: 1100px; margin: 0 auto; } </style> Query id: 3b615f00-c443-4ba9-acc4-7c308716917d Query name: Unknown Prefix (v2) Platform: OpenAPI Severity: <span style="color:#5bc0de">Info</span> Category: Best Practices URL: The media type prefix should be set as 'application', 'audio', 'font', 'example', 'image', 'message', 'model', 'multipart', 'text' or 'video'<br> ```json title="Positive test num. 1 - json file" hl_lines="12" { "swagger": "2.0", "info": { "title": "Simple API Overview", "version": "1.0.0" }, "paths": { "/": { "get": { "operationId": "listVersionsv2", "summary": "List API versions", "produces": [ "aplication/json" ], "responses": { "200": { "schema": { "$ref": "#/definitions/User" } } }, "parameters": [ { "$ref": "#/parameters/limitParam" } ] } } }, "parameters": { "limitParam": { "name": "limit", "in": "query", "description": "max records to return", "required": true, "schema": { "type": "integer" } } }, "definitions": { "User": { "type": "object", "required": [ "id", "name" ], "properties": { "id": { "type": "integer", "format": "int64" }, "name": { "type": "string" } } } } } ``` ```json title="Positive test num. 2 - json file" hl_lines="38" { "swagger": "2.0", "info": { "title": "Simple API Overview", "version": "1.0.0" }, "paths": { "/": { "get": { "operationId": "listVersionsv2", "summary": "List API versions", "responses": { "200": { "schema": { "$ref": "#/definitions/User" } } }, "parameters": [ { "$ref": "#/parameters/limitParam" } ] } } }, "parameters": { "limitParam": { "name": "limit", "in": "query", "description": "max records to return", "required": true, "schema": { "type": "integer" } } }, "produces": [ "aplication/json" ], "definitions": { "User": { "type": "object", "required": [ "id", "name" ], "properties": { "id": { "type": "integer", "format": "int64" }, "name": { "type": "string" } } } } } ``` ```yaml title="Positive test num. 3 - yaml file" hl_lines="10" swagger: '2.0' info: title: Simple API Overview version: 1.0.0 paths: "/": get: operationId: listVersionsv2 summary: List API versions produces: aplication/json responses: '200': schema: "$ref": "#/definitions/User" parameters: "$ref": "#/parameters/limitParam" parameters: limitParam: name: limit in: query description: max records to return required: true schema: type: integer definitions: User: type: object required: id name properties: id: type: integer format: int64 name: type: string ``` <details><summary>Positive test num. 4 - yaml file</summary> ```yaml hl_lines="24" swagger: '2.0' info: title: Simple API Overview version: 1.0.0 paths: "/": get: operationId: listVersionsv2 summary: List API versions responses: '200': schema: "$ref": "#/definitions/User" parameters:

"#/parameters/limitParam" parameters: limitParam: name: limit in: query description: max records to return required: true schema: type: integer produces: aplication/json definitions: User: type: object required: id name properties: id: type: integer format: int64 name: type: string ``` </details> ```json title="Negative test num. 1 - json file" { "swagger": "2.0", "info": { "title": "Simple API Overview", "version": "1.0.0" }, "paths": { "/": { "get": { "operationId": "listVersionsv2", "summary": "List API versions", "produces": [ "application/json" ], "responses": { "200": { "schema": { "$ref": "#/definitions/User" } } }, "parameters": [ { "$ref": "#/parameters/limitParam" } ] } } }, "parameters": { "limitParam": { "name": "limit", "in": "query", "description": "max records to return", "required": true, "schema": { "type": "integer" } } }, "definitions": { "User": { "type": "object", "required": [ "id", "name" ], "properties": { "id": { "type": "integer", "format": "int64" }, "name": { "type": "string" } } } } } ``` ```json title="Negative test num. 2 - json file" { "swagger": "2.0", "info": { "title": "Simple API Overview", "version": "1.0.0" }, "paths": { "/": { "get": { "operationId": "listVersionsv2", "summary": "List API versions", "responses": { "200": { "schema": { "$ref": "#/definitions/User" } } }, "parameters": [ { "$ref": "#/parameters/limitParam" } ] } } }, "parameters": { "limitParam": { "name": "limit", "in": "query", "description": "max records to return", "required": true, "schema": { "type": "integer" } } }, "produces": [ "application/json" ], "definitions": { "User": { "type": "object", "required": [ "id", "name" ], "properties": { "id": { "type": "integer", "format": "int64" }, "name": { "type": "string" } } } } } ``` ```yaml title="Negative test num. 3 - yaml file" swagger: '2.0' info: title: Simple API Overview version: 1.0.0 paths: "/": get: operationId: listVersionsv2 summary: List API versions produces: application/json responses: '200': schema: "$ref": "#/definitions/User" parameters: "$ref": "#/parameters/limitParam" parameters: limitParam: name: limit in: query description: max records to return required: true schema: type: integer definitions: User: type: object required: id name properties: id: type: integer format: int64 name: type: string ``` <details><summary>Negative test num. 4 - yaml file</summary> ```yaml swagger: '2.0' info: title: Simple API Overview version: 1.0.0 paths: "/": get: operationId: listVersionsv2 summary: List API versions responses: '200': schema: "$ref": "#/definitions/User" parameters: "$ref": "#/parameters/limitParam" parameters: limitParam: name: limit in: query description: max records to return required: true schema: type: integer produces: application/json definitions: User: type: object required: id name properties: id: type: integer format: int64 name: type: string ``` </details>