hyperjump-io / json-schema

JSON Schema Validation, Annotation, and Bundling. Supports Draft 04, 06, 07, 2019-09, 2020-12, OpenAPI 3.0, and OpenAPI 3.1
https://json-schema.hyperjump.io/
MIT License
216 stars 22 forks source link

How can I get errors for all instanceLocation? #61

Closed sukeshpabolu closed 1 month ago

sukeshpabolu commented 4 months ago

Let's consider the following schema

{
    "$id": "https://example.com/user-data",
    "$schema": "http://json-schema.org/draft-07/schema",
    "type": "object",
    "properties": {
      "name": { "type": "string", "default": "Unknown" },
      "email": { 
        "type": "string", 
        "format": "email",
    },
      "tags": {
            "type": "array",
            "minItems": 3,
            "items": { "type": "string", "minLength": 2 }
      },
      "score": { "type": "integer", "minimum": 0 },
      "date": { "type": "integer", "format": "unix-time" },
            "nospace": {
                "pattern": "^\\S*$",
                "type": "string"
            },
            "extra": {
                "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ]
        }
    },
    "required": ["name", "email", "tags", "score", "extra"],
  }

I am getting errors only for tags property for the following json

{
    "name": "Unknown",
    "email": "",
    "tags": [],
    "score": -50,
    "extra": 123
  }
jdesrosiers commented 4 months ago

Currently the library only supports short circuit evaluation, so it will stop evaluating after the first error.

However, I have the all-errors functionality implemented, so you can expect that to be released relatively soon.

(Related discussion: https://github.com/hyperjump-io/json-schema/discussions/32)

sukeshpabolu commented 4 months ago

Okay then eagerly waiting 😊

jdesrosiers commented 1 month ago

This functionality was released with v1.9.0 on May 3. Sorry for forgetting to update this thread.