pwall567 / json-kotlin-schema

Kotlin implementation of JSON Schema (Draft 07)
MIT License
90 stars 13 forks source link

Fails to process schema for OpenAPI v3.0 #10

Open StochasticTinkr opened 1 year ago

StochasticTinkr commented 1 year ago

I'm trying to process this file: https://github.com/OAI/OpenAPI-Specification/blob/main/schemas/v3.0/schema.json

It's failing on:

        "multipleOf": {
          "type": "number",
          "minimum": 0,
          "exclusiveMinimum": true
        }

with the message: > Must be number (was true) - /definitions/Schema/properties/multipleOf/exclusiveMinimum

It looks like the code is expecting exclusiveMinimum and exclusiveMaximum to be numeric values, but they're supposed to be booleans.

StochasticTinkr commented 1 year ago

It looks like this doesn't support http://json-schema.org/draft-04/schema, which is where they are defined as booleans instead of numbers. That means this isn't so much a bug as a feature request to support draft-04 schemas as well.

pwall567 commented 1 year ago

Hi – sorry about the delay in responding. Yes, exclusiveMinimum was originally a boolean property, indicating that the minimum was to be interpreted as an exclusive bound. This changed in draft-06, and exclusiveMinimum now takes a number, the exclusive minimum value. It is the later form that this project uses.

I have had a new version of the project in the works for some time now; this version will accept multiple schema specification drafts based on the $schema element in the schema document. Unfortunately, I can't promise any delivery date on the new version.

Regards, Peter Wall

StochasticTinkr commented 1 year ago

Thanks for the response. Only reason this even became an issue I cared about was because of the SpaceTraders io game, which exposed the game only through OpenAPI. Honestly I got bored with it pretty quickly, so this isn't really an important feature for me any more.