Problem
stac-validator appears to validate extension schemas as JSON Schema 2020-12 regardless of the dialect declared by the schema.
This causes valid draft-07 extension schemas to crash validation.
For example, the Portolan extension declares:
"$schema": "http://json-schema.org/draft-07/schema#"
and uses the draft-07 tuple form of items:
"items": [
{"$ref": "#/definitions/longitude"},
{"$ref": "#/definitions/latitude"},
{"$ref": "#/definitions/longitude"},
{"$ref": "#/definitions/latitude"}
]
When stac-validator reaches this definition, it crashes with:
AttributeError: 'list' object has no attribute 'get'
The relevant code appears to hardcode 2020-12:
Resource(contents=schema, specification=DRAFT202012)
validator = Draft202012Validator(...)
Under 2020-12, items expects a schema rather than the draft-07 array form, which leads referencing to call .get("$id") on the array.
Expected behavior
The validator should respect the extension schema's declared $schema dialect.
The Portolan schema validates successfully with Draft7Validator, as do all 14 reference STAC objects tested against it.
Reproduction
Schema:
https://schemas.portolan-sdi.org/portolan/v0.1.1/schema.json
Any Portolan collection that exercises the bbox definition reproduces the crash. Catalogs do not, because they do not reach that definition.
The same objects validate successfully with the draft-07 validator and with Portolan's own validator.
Problem
stac-validatorappears to validate extension schemas as JSON Schema 2020-12 regardless of the dialect declared by the schema.This causes valid draft-07 extension schemas to crash validation.
For example, the Portolan extension declares:
and uses the draft-07 tuple form of
items:When
stac-validatorreaches this definition, it crashes with:The relevant code appears to hardcode 2020-12:
Under 2020-12,
itemsexpects a schema rather than the draft-07 array form, which leadsreferencingto call.get("$id")on the array.Expected behavior
The validator should respect the extension schema's declared
$schemadialect.The Portolan schema validates successfully with
Draft7Validator, as do all 14 reference STAC objects tested against it.Reproduction
Schema:
https://schemas.portolan-sdi.org/portolan/v0.1.1/schema.jsonAny Portolan collection that exercises the
bboxdefinition reproduces the crash. Catalogs do not, because they do not reach that definition.The same objects validate successfully with the draft-07 validator and with Portolan's own validator.