Description
This was encountered and reported against check-jsonschema
(a JSON Schema CLI): python-jsonschema/check-jsonschema#376
That bug report covers two issues:
- there is invalid/malformed data in the taskfile JSON Schema
- the python-jsonschema projects do not handle the malformed data with a clear error
I'm pursuing (2) independently. Regarding (1), here's the malformed JSON Schema data:
Lines 351 to 353 in dc3cf1c
"string"
is not a valid subschema. Possibly this was meant to be {"type": "string"}
(?) but it's not obvious.
Aside: Fixing the structure of definitions
The current schema has all definitions
nested under an intermediate key, i.e. definitions/3/foo
rather than definitions/foo
. That weakens the ability of downstream validation of the definitions
section of the schema.
definitions
is defined under the Draft 7 metaschema as an object whose values are all, themselves, valid schemas.
The current structure of the schema means that this is validating #/definitions/3
rather than #/definitions/defer_call
(which would be much more useful).
It would be nice to move all of the definitions up one level so that metaschema validation can catch issues like this.
(Shameless plug: check-jsonschema --check-metaschema schema.json
can do this for you. 🙂 )
Under the latest draft definition of $defs, this kind of structure is more clearly spelled out, using "MUST"s to clarify that a schema which doesn't follow this structure is invalid. Under the Draft 7 spec, I think it's pretty clear that this was the intent based on the metaschema, but it wasn't called out explicitly.
I have no direct experience with task
, so I might not be the right person to modify the schema appropriately.
But I'm happy to submit one or two PRs to
- remove the errant
"string"
indefer_call
- remove the
3
fromdefinitions
nesting (If this is versioning, we could rename all of the defs to end withv3
, as inenv -> env_v3
)
Just let me know how to proceed!
Activity