Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
jobspec: add schema for validation #1913
This PR adds a json-schema schema for jobspec and a python script for validation based python-jsonschema. It might form the basis for a future ingest validation plugin, as described in #1908. The schema and test script are exercised by a new sharness test, using the test jobspec in
Walking through the explicit checks in libjobspec, validation by this schema is is on a par with the explicit checks there, as they exist now. I did find one check that seemed inexpressible in the schema - the test for
Other things that seemingly ought to be caught in validation, but aren't currently checked by libjobspec, would be inexpressible in json-schema. For example, as far as I understand, the schema cannot ensure that a task
This PR includes a little bit of cleanup of the existing jobspec sharness test, including turning
The new dependency on
Add a json-schema (https://json-schema.org/) schema for jobspec, as defined in - Flux RFC 14 json content rules, examples, and text - Valid and invalid sharness test input - (some) peeking at jobspec.cpp Some caveats: - "complex count" cannot be checked for max < min (see json-schema-org/json-schema-spec#51)
Ubuntu bionic suppiles 2.6.0, while RHEL 7 EPEL supplies 2.3.0. Both work, so require 2.3.0 or greater.
Add python script to validate candidate JSON file(s) on command line against a configurable json-schema. Read candidate input(s) with the YAML parser, so jobspec can be supplied in either YAML or JSON form.
Problem: jobspec validator is an installed flux command, but jobspec library is being deprecated. Move jobspec validator to libjobspec and build as an noinst test program. Update sharness test for the new path.
Minor cleanup: - Define JOBSPEC and use it instead of full path - Distinguish invalid inputs from valid with a prefix in the output.