Project: KICS (Provisioning / Security & Compliance)
File: d172a060-8569-4412-8045-3560ebd477e8.md

title: Object Without Required Property (v3) hide: toc: true navigation: true <style> .highlight .hll { background-color: #ff171742; } .md-content { max-width: 1100px; margin: 0 auto; } </style> Query id: d172a060-8569-4412-8045-3560ebd477e8 Query name: Object Without Required Property (v3) Platform: OpenAPI Severity: <span style="color:#5bc0de">Info</span> Category: Structure and Semantics URL: OpenAPI Object should contain all of its required fields<br> ```json title="Positive test num. 1 - json file" hl_lines="3" { "openapi": "3.0.0", "info": { "version": "1.0.0", "contact": { "name": "contact", "url": "/", "email": "user@gmail.com" } }, "paths": {} } ``` ```yaml title="Positive test num. 2 - yaml file" hl_lines="2" openapi: 3.0.0 info: title: Simple API Overview contact: name: contact url: "/" email: user@gmail.com paths: {} ``` ```json title="Positive test num. 3 - json file" hl_lines="9 12" { "openapi": "3.0.0", "info": { "title": "Simple API overview", "version": "1.0.0" }, "paths": { "/": { "get": { "operationId": "listVersions", "summary": "List versions", "servers": [ { "description": "server URL" } ], "security": [ { "OAuth2": [ "write", "read" ] } ] } } } } ``` <details><summary>Positive test num. 4 - yaml file</summary> ```yaml hl_lines="10 7" openapi: 3.0.0 info: title: Simple API overview version: 1.0.0 paths: "/": get: operationId: listVersions summary: List versions servers: description: server URL security: OAuth2: write read ``` </details> <details><summary>Positive test num. 5 - json file</summary> ```json hl_lines="62 65 54" { "openapi": "3.0.0", "info": { "title": "Simple API overview", "version": "1.0.0" }, "paths": { "/": { "get": { "operationId": "listVersions", "summary": "List versions", "servers": [ { "url": "http://myapi.com/", "description": "server URL" } ], "security": [ { "OAuth2": [ "write", "read" ] } ], "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" } ] } ] } } } } } } }, "requestBody": { "description": "A JSON object containing my object information" } } } }, "components": { "requestBodies": { "MyObjectBody": { "description": "A JSON object containing my object information" }, "MyObjectBody_2": { "description": "A JSON object containing my object information" } } } } ``` </details> <details><summary>Positive test num. 6 - yaml file</summary> ```yaml hl_lines="32 36 38" openapi: 3.0.0 info: title: Simple API overview version: 1.0.0 paths: "/": get: operationId: listVersions summary: List versions servers: url: http://myapi.com/ description: server URL security: OAuth2: write read 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 requestBody: description: A JSON object containing my object information components: requestBodies: MyObjectBody: description: A JSON object containing my object information MyObjectBody_2: description: A JSON object containing my object information ``` </details> <details><summary>Positive test num. 7 - json file</summary> ```json hl_lines="72 27 53" { "openapi": "3.0.0", "info": { "title": "Simple API overview", "version": "1.0.0" }, "paths": { "/": { "get": { "operationId": "listVersions", "summary": "List versions", "servers": [ { "url":

"description": "server URL" } ], "security": [ { "OAuth2": [ "write", "read" ] } ], "responses": { "200": { "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" } ] } ] } } } } } } }, "parameters": [ { "in": "path", "description": "ID of pet to use", "required": true, "schema": { "type": "array", "items": { "type": "string" } }, "style": "simple" } ] } } }, "components": { "parameters": { "IdParam": { "name": "id", "description": "ID of pet to use", "required": true, "schema": { "type": "array", "items": { "type": "string" } }, "style": "simple" } } } } ``` </details> <details><summary>Positive test num. 8 - yaml file</summary> ```yaml hl_lines="18 42 31" openapi: 3.0.0 info: title: Simple API overview version: 1.0.0 paths: "/": get: operationId: listVersions summary: List versions servers: url: http://myapi.com/ description: server URL security: OAuth2: write read responses: "200": 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 parameters: in: path description: ID of pet to use required: true schema: type: array items: type: string style: simple components: parameters: IdParam: name: id description: ID of pet to use required: true schema: type: array items: type: string style: simple ``` </details> ```json title="Negative test num. 1 - json file" { "openapi": "3.0.0", "info": { "title": "Simple API Overview", "version": "1.0.0", "contact": { "name": "contact", "url": "/", "email": "user@gmail.com" } }, "paths": {} } ``` ```yaml title="Negative test num. 2 - yaml file" openapi: 3.0.0 info: title: Simple API Overview version: 1.0.0 contact: name: contact url: "/" email: user@gmail.com paths: {} ``` ```json title="Negative test num. 3 - json file" { "openapi": "3.0.0", "info": { "title": "Simple API overview", "version": "1.0.0" }, "paths": { "/": { "get": { "operationId": "listVersions", "summary": "List versions", "servers": [ { "url": "http://myapi.com/", "description": "server URL" } ], "security": [ { "OAuth2": [ "write", "read" ] } ], "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" } ] } ] } } } } } } } } } } } ``` <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: listVersions summary: List versions servers: url: http://myapi.com/ description: server URL security: OAuth2: write read 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 ``` </details> <details><summary>Negative test num. 5 - json file</summary> ```json { "openapi": "3.0.0", "info": { "title": "Simple API overview", "version": "1.0.0" }, "paths": { "/": { "get": { "operationId": "listVersions", "summary": "List versions", "servers": [ { "url":

"description": "server URL" } ], "security": [ { "OAuth2": [ "write", "read" ] } ], "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" } ] } ] } } } } } } }, "requestBody": { "description": "A JSON object containing my object information", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MyObject" } } } } } } }, "components": { "requestBodies": { "MyObjectBody": { "description": "A JSON object containing my object information", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MyObject" } } } }, "MyObjectBody_2": { "description": "A JSON object containing my object information", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MyObject" } } } } } } } ``` </details> <details><summary>Negative test num. 6 - yaml file</summary> ```yaml openapi: 3.0.0 info: title: Simple API overview version: 1.0.0 paths: "/": get: operationId: listVersions summary: List versions servers: url: http://myapi.com/ description: server URL security: OAuth2: write read 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 requestBody: description: A JSON object containing my object information content: application/json: schema: "$ref": "#/components/schemas/MyObject" components: requestBodies: MyObjectBody: description: A JSON object containing my object information content: application/json: schema: "$ref": "#/components/schemas/MyObject" MyObjectBody_2: description: A JSON object containing my object information content: application/json: schema: "$ref": "#/components/schemas/MyObject" ``` </details> <details><summary>Negative test num. 7 - json file</summary> ```json { "openapi": "3.0.0", "info": { "title": "Simple API overview", "version": "1.0.0" }, "paths": { "/": { "get": { "operationId": "listVersions", "summary": "List versions", "servers": [ { "url": "http://myapi.com/", "description": "server URL" } ], "security": [ { "OAuth2": [ "write", "read" ] } ], "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" } ] } ] } } } } } } }, "parameters": [ { "name": "id", "in": "path", "description": "ID of pet to use", "required": true, "schema": { "type": "array", "items": { "type": "string" } }, "style": "simple" } ] } } }, "components": { "parameters": { "IdParam": { "name": "id", "in": "path", "description": "ID of pet to use", "required": true, "schema": { "type": "array", "items": { "type": "string" } }, "style": "simple" } } } } ``` </details> <details><summary>Negative test num. 8 - yaml file</summary> ```yaml openapi: 3.0.0 info: title: Simple API overview version: 1.0.0 paths: "/": get: operationId: listVersions summary: List versions servers: url: http://myapi.com/ description: server URL security: OAuth2: write read 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 parameters: name: id in: path description: ID of pet to use required: true schema: type: array items: type: string style: simple components: parameters: IdParam: name: id in: path description: ID of pet to use required: true schema: type: array items: type: string style: simple ``` </details>