Skip to content

OpenAPI Spec 3.0 validation should not require exclusiveMinimum to be a number #1114

@jkosternl

Description

@jkosternl

As specified in https://spec.openapis.org/oas/3.0/schema/latest.html the field exclusiveMinimum is a boolean. But while using the example code in doc/openapi.md and changing it to the 3.0 instances, the validation fails with an JsonSchemaException: exclusiveMinimum value is not a number at ExclusiveMinimumValidator.java:45

I used it like this:

  JsonSchemaFactory factory = JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.V4,
    builder -> builder.metaSchema(OpenApi30.getInstance())
      .defaultMetaSchemaIri(OpenApi30.getInstance().getIri()));

   jsonSchema =
    factory.getSchema(
      SchemaLocation.of("classpath:" + filePath + "#/components/schemas/" + schemaName));

and also tried VersionFlag.V7 and other variants.

Expected behavior:

 "value": {
    "minimum": 0,
    "exclusiveMinimum": true,

should validate just fine, with OpenAPI 3.0 and draft 4.

Note: in OpenAPI 3.1 this is changed to a number.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions