[REQ][validate] Warn for validation keyword type mismatch
Created by: kevinoid
Currently validate
does not warn if JSON Schema validation keywords are applied to schemas with types for which the validation keyword has no effect. For example:
openapi: '3.0.3'
info:
title: Incorrect validation keyword example
version: '1.0.0'
components:
schemas:
Vector3:
type: array
items:
type: number
maxLength: 3
minLength: 3
paths:
/location:
get:
operationId: getLocation
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/Vector3'
openapi-generator-cli.jar validate -i openapi.yaml
produces:
Validating spec (openapi.yaml)
No validation issues detected.
However, maxLength
/minLength
validate the length of strings and have no effect on Vector3
, which has type: array
. The author likely intended to use maxItems
/minItems
.
Is there any chance you'd consider producing a warning for such cases?
Thanks for considering, Kevin