Ensure Schema Array Items Type Should Be Defined
Ensure that the type of items in an array is defined in OpenAPI. Otherwise, the API may not function correctly.
Risk Level: high
Platform: OpenAPI
Spectral Rule ID: OPENAPI002
REMEDIATION
Define the type of items in the array.
swagger: '2.0'
# OR
openapi: '3.0.0'
info:
version: 1.0.0
title: Sample API
paths:
/users:
get:
responses:
'200':
description: A list of users.
content:
application/json:
schema:
+ type: array
items:
+ type: object
properties:
name:
+ type: string
age:
+ type: integer
email:
+ type: string
format: email
Read more:
Updated about 1 year ago