API Reference

ska_schemas.example_by_uri(version: str, *args) dict

Generates an example for a particular schema

Parameters:
  • version – Interface URI

  • args – Extra parameters depending on interface (strings)

Returns:

Dictionary

ska_schemas.schema_by_uri(version: str, strict: int = 1, **kwargs) Schema

Looks up interface schema based on interface identifier

Parameters:
  • version – Interface URI

  • strict – Strictness level

Returns:

Interface schema

ska_schemas.validate(version: str | None, config: dict, strictness: int = 1, jsonschema_fallback=False)

Validate a dictionary against schema

Will automatically determine the schema to check against

Parameters:
  • version – Interface with version

  • config – Dictionary to validate

  • strictness

    Strictness level (1: permissive errors + strict warnings, 2: strict errors).

    Note that with strictness level 2, a lot of generally harmless schema violations will cause an exception to be raised. This is generally inadvisable in production consumer code (“be liberal in what you accept”!).Therefore, strictness 2 checks will only be allowed to raise errors when running in testing mode (either PYTEST_VERSION or SKA_SCHEMAS_ALLOW_STRICT_VALIDATION) is set.

  • jsonschema_fallback

    Schema Validation Strategy. The system uses a configurable fallback mechanism controlled by the jsonschema_fallback flag. by default, this flag is set to False. validation process is below. in what you accept”!).

    First attempts validation using the local TMSchema object. If local validation fails with SchemaError, automatically falls back to external schema validation. External validation uses the provided document URL.

Raises:

ValueError – Raised if the object fails permissive checks at strictness level 1. At strictness level 2, raised if the object fails any schema check 3.Raised if fails external validation using documented URL.