Non Body Parameter Without Schema
- Query id: 73c3bc54-3cc6-4c0a-b30a-e19f2abfc951
- Query name: Non Body Parameter Without Schema
- Platform: OpenAPI
- Severity: Info
- Category: Structure and Semantics
- URL: Github
Description¶
The Body Parameter Object should have the attribute 'schema' defined
Documentation
Code samples¶
Code samples with security vulnerabilities¶
Positive test num. 1 - json file
{
"swagger": "2.0",
"info": {
"title": "Simple API Overview",
"version": "1.0.0"
},
"paths": {
"/": {
"get": {
"parameters": [
{
"name": "limit2",
"in": "query",
"description": "max records to return",
"required": true,
"schema": {
"type": "integer"
}
}
],
"operationId": "listVersionsV2",
"summary": "List API versions",
"responses": {
"200": {
"description": "200 response"
}
}
}
}
},
"parameters": {
"limitParam": {
"name": "limit",
"in": "path",
"description": "max records to return",
"required": true,
"schema": {
"type": "integer"
}
}
}
}
Positive test num. 2 - yaml file
swagger: '2.0'
info:
title: Simple API Overview
version: 1.0.0
paths:
"/":
get:
parameters:
- name: limit2
in: query
description: max records to return
required: true
schema:
type: integer
operationId: listVersionsV2
summary: List API versions
responses:
'200':
description: 200 response
parameters:
limitParam:
name: limit
in: path
description: max records to return
required: true
schema:
type: integer
Code samples without security vulnerabilities¶
Negative test num. 1 - json file
{
"swagger": "2.0",
"info": {
"title": "Simple API Overview",
"version": "1.0.0"
},
"paths": {
"/": {
"get": {
"parameters": [
{
"name": "limit2",
"in": "query",
"description": "max records to return",
"required": true
}
],
"operationId": "listVersionsV2",
"summary": "List API versions",
"responses": {
"200": {
"description": "200 response"
}
}
}
}
},
"parameters": {
"limitParam": {
"name": "limit",
"in": "path",
"description": "max records to return",
"required": true
}
}
}
Negative test num. 2 - yaml file
swagger: '2.0'
info:
title: Simple API Overview
version: 1.0.0
paths:
"/":
get:
parameters:
- name: limit2
in: query
description: max records to return
required: true
operationId: listVersionsV2
summary: List API versions
responses:
'200':
description: 200 response
parameters:
limitParam:
name: limit
in: path
description: max records to return
required: true