Skip to content

Schema for defer_call contains invalid JSON Schema, causing some schema validators to fail #1474

Closed
@sirosen

Description

This was encountered and reported against check-jsonschema (a JSON Schema CLI): python-jsonschema/check-jsonschema#376

That bug report covers two issues:

  1. there is invalid/malformed data in the taskfile JSON Schema
  2. 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:

"anyOf": [
"string",
{

"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" in defer_call
  • remove the 3 from definitions nesting (If this is versioning, we could rename all of the defs to end with v3, as in env -> env_v3)

Just let me know how to proceed!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    area: json schemaChanges related to the JSON schema.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions