pmotools.pmo_engine.pmo_checker module

class pmotools.pmo_engine.pmo_checker.PMOChecker(pmo_jsonschema: dict | None = None)[source]

Bases: object

A class to house utilities to help check the formatting of read in PMO files.

check_for_required_base_fields(pmo_object)[source]

Check that all required base fields are present in a pmo object

Parameters:

pmo_object – the pmo object to check

Returns:

return void if passes, otherwise raises an exception

get_required_fields_for_pmo_class(pmo_class)[source]

Get the required fields for the pmo_class from the pmo_jsonschema

Parameters:

pmo_class – the class to get a required fields for, will throw an exception if class is not found within the schema

Returns:

the required fields for the pmo_class

validate_pmo_json(pmo_json)[source]

Validate the PMO json file with loaded schema

Parameters:

pmo_json – the pmo json to validate

pmotools.pmo_engine.pmo_checker.load_schema(name: str) dict[source]

Load a JSON schema from the pmotools.schemas package.

Parameters:

name (str) – The filename of the schema (e.g. “pmo_schema.json”).

Returns:

Parsed JSON schema as a Python dictionary.

Return type:

dict

Raises:
  • FileNotFoundError – If the schema file does not exist.

  • json.JSONDecodeError – If the schema file is not valid JSON.

pmotools.pmo_engine.pmo_checker.load_schema_by_version(version: str) dict[source]

Load a JSON schema from the pmotools.schemas package.

Parameters:

version (str) – The version of the schema to be loaded (e.g. “1.0.0”, “1.1.0”).

Returns:

Parsed JSON schema as a Python dictionary.

Return type:

dict

Raises:
  • FileNotFoundError – If the schema file does not exist.

  • json.JSONDecodeError – If the schema file is not valid JSON.