alenkacz / gradle-json-validator

Gradle plugin for json validation
MIT License
10 stars 8 forks source link

Validation does not work for schemas with JSONArray as top level #14

Closed nimix closed 6 years ago

nimix commented 6 years ago

Problem occurs here, because top level object is JSONArray instead of JSONObject: https://github.com/alenkacz/gradle-json-validator/blob/6cfa90577a569c028db092c8f6d7f6db1b97212e/src/main/groovy/cz/alenkacz/gradle/jsonvalidator/ValidateJsonTask.groovy#L53

Example schema:

{
    "$schema": "http://json-schema.org/schema#",
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "country": {
                "type": "string"
            }
        },
        "required": [
            "country"
        ]
    }
}