kogosoftwarellc / open-api

A Monorepo of various packages to power OpenAPI in node
MIT License
889 stars 233 forks source link

Boolean `exclusiveMinimum` for openapi 3.0 #776

Open wszydlak opened 2 years ago

wszydlak commented 2 years ago

This issue is related to #696.

However openapi 3.0 specification says exclusiveMinimum and exclusiveMaximum should be boolean. They became numbers in openapi 3.1.

open-api-validator should recognize if specified version is openapi 3.0 or 3.1 and make a proper validation.

Currently when i specify openapi 3.0 document with exclusiveMinimum: true validator reports error, but according to https://swagger.io/docs/specification/data-models/data-types/ is should pass validation.

braco commented 2 years ago

Same problem, @wszydlak did you find a workaround?

YuefengLi commented 2 years ago

Will have to correct the $ref link here to draft 05 of JSON schema to comply with OAS v3.0. https://github.com/kogosoftwarellc/open-api/blob/master/packages/openapi-schema-validator/resources/openapi-3.0.json#L763

jftanner commented 1 year ago

I ran into this issue just now. Unfortunately, it doesn't appear to be as simple as just changing to draft-04 (since there wasn't really a 5). Doing so in my node_modules folder for a test, I get this:

MissingRefError: can't resolve reference http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum from id http://openapis.org/v3/schema.json

Unfortunately, changing to be {"type": "boolean","default": false} instead of a ref doesn't seem to make any difference, either. Still get the Ajv error: exclusiveMinimum must be number.

What's the proper solution here?