eclipse-vertx/vertx-openapi

Parameters and body's format type is not validated

CheesyBoy123 opened this issue · 0 comments

Questions

Do not use this issue tracker to ask questions, instead use one of these channels. Questions will likely be closed without notice.

Version

Which version(s) did you encounter this bug ?
4.5.1

Context

We are in the process of migrating from vertx-web-api-contract for our openapi schema validation & request validation needs. While doing some testing it seems that the "format" keyword is completely ignored. Ex:

"parameters": [
          {
            "name": "petId",
            "in": "path",
            "description": "ID of pet to return",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32
            }
          }
        ]

Given this schema, when we pass in the "petId" parameter with an integer value that is greater than an int32 the request validations is expected to fail. This is seen for:
type: number, format: float
type: number, format: double,
type: integer, format: int32
type: integer, format: int64

Do you have a reproducer?

I have created this reproducer:
https://github.com/CheesyBoy123/vertx-openapi
branch: allowFormatValidation

Steps to reproduce

  1. Create a schema spec where parameters/body has strict formatting requirements
  2. Validate any parameter which meets the type criteria, but does not meet the format criteria