user_workspaces_server.config_schemas package

Submodules

user_workspaces_server.config_schemas.json_schema_loader module

JSON Schema loader for configuration validation.

This module loads JSON Schema files for validation and documentation generation.

class user_workspaces_server.config_schemas.json_schema_loader.JSONSchemaWrapper(schema, file_path)[source]

Bases: object

Wrapper around a JSON Schema providing convenient access methods.

__init__(schema, file_path)[source]

Initialize a JSONSchemaWrapper.

Parameters:
  • schema (Dict[str, Any]) – The parsed JSON Schema dictionary

  • file_path (str) – Path to the schema file

property fields: Dict[str, Dict[str, Any]]

Get all fields (properties) from the schema.

get_required_fields()[source]

Get list of required field names.

Return type:

List[str]

get_optional_fields()[source]

Get list of optional field names.

Return type:

List[str]

get_field(field_name)[source]

Get a specific field definition.

Parameters:

field_name (str) – Name of the field

Return type:

Optional[Dict[str, Any]]

Returns:

Field definition dict or None if not found

property example: Dict[str, Any]

Get the first example (for backwards compatibility with YAML schemas).

class user_workspaces_server.config_schemas.json_schema_loader.JSONSchemaLoader(schemas_dir=None)[source]

Bases: object

Loads and manages JSON Schema files.

__init__(schemas_dir=None)[source]

Initialize the JSON Schema loader.

Parameters:

schemas_dir (str) – Path to directory containing JSON schemas. Defaults to schemas/ subdirectory of this module.

get_schema(category, controller_name)[source]

Get a schema by category and controller name.

Parameters:
  • category (str) – Schema category (resources, storage, authentication, job_types)

  • controller_name (str) – Name of the controller

Return type:

Optional[JSONSchemaWrapper]

Returns:

JSONSchemaWrapper object or None if not found

get_all_schemas()[source]

Get all loaded schemas organized by category.

Return type:

Dict[str, Dict[str, JSONSchemaWrapper]]

get_resource_schema(controller_name)[source]

Get a resource schema by controller name.

Return type:

Optional[JSONSchemaWrapper]

get_storage_schema(controller_name)[source]

Get a storage schema by controller name.

Return type:

Optional[JSONSchemaWrapper]

get_authentication_schema(controller_name)[source]

Get an authentication schema by controller name.

Return type:

Optional[JSONSchemaWrapper]

get_job_type_schema(controller_name)[source]

Get a job type schema by controller name.

Return type:

Optional[JSONSchemaWrapper]

user_workspaces_server.config_schemas.json_schema_loader.get_schema_loader()[source]

Get the global schema loader instance.

Return type:

JSONSchemaLoader

user_workspaces_server.config_schemas.json_schema_validator module

Configuration validation using JSON Schema.

This module provides validation logic for configuration files using JSON Schema definitions.

exception user_workspaces_server.config_schemas.json_schema_validator.ValidationError(errors)[source]

Bases: Exception

Exception raised when configuration validation fails.

__init__(errors)[source]
class user_workspaces_server.config_schemas.json_schema_validator.JSONSchemaConfigValidator[source]

Bases: object

Validates configuration dictionaries against JSON schemas.

__init__()[source]

Initialize the validator.

validate_with_schema(config, schema_dict, path='')[source]

Validate a configuration dictionary against a JSON schema.

Parameters:
  • config (Dict[str, Any]) – The configuration dictionary to validate

  • schema_dict (Dict[str, Any]) – The JSON Schema to validate against

  • path (str) – The current path in the config (for error messages)

Return type:

bool

Returns:

True if validation passes, False otherwise

validate_controller_config(config, schema_wrapper, config_key='')[source]

Validate a controller configuration against its schema.

Parameters:
  • config (Dict[str, Any]) – The configuration dictionary to validate

  • schema_wrapper – The JSONSchemaWrapper to validate against

  • config_key (str) – The key in the config file (for error messages)

Return type:

bool

Returns:

True if validation passes, False otherwise

validate_uws_config(config)[source]

Validate the complete UWS config.json file.

Parameters:

config (Dict[str, Any]) – The loaded config.json dictionary

Return type:

bool

Returns:

True if validation passes, False otherwise

Raises:

ValidationError – If validation fails

Module contents

Configuration schema definitions and validation for User Workspaces Server.

This module provides a JSON Schema-based system for validating configuration files (config.json) at startup time.

class user_workspaces_server.config_schemas.JSONSchemaWrapper(schema, file_path)[source]

Bases: object

Wrapper around a JSON Schema providing convenient access methods.

__init__(schema, file_path)[source]

Initialize a JSONSchemaWrapper.

Parameters:
  • schema (Dict[str, Any]) – The parsed JSON Schema dictionary

  • file_path (str) – Path to the schema file

property fields: Dict[str, Dict[str, Any]]

Get all fields (properties) from the schema.

get_required_fields()[source]

Get list of required field names.

Return type:

List[str]

get_optional_fields()[source]

Get list of optional field names.

Return type:

List[str]

get_field(field_name)[source]

Get a specific field definition.

Parameters:

field_name (str) – Name of the field

Return type:

Optional[Dict[str, Any]]

Returns:

Field definition dict or None if not found

property example: Dict[str, Any]

Get the first example (for backwards compatibility with YAML schemas).

class user_workspaces_server.config_schemas.JSONSchemaLoader(schemas_dir=None)[source]

Bases: object

Loads and manages JSON Schema files.

__init__(schemas_dir=None)[source]

Initialize the JSON Schema loader.

Parameters:

schemas_dir (str) – Path to directory containing JSON schemas. Defaults to schemas/ subdirectory of this module.

get_schema(category, controller_name)[source]

Get a schema by category and controller name.

Parameters:
  • category (str) – Schema category (resources, storage, authentication, job_types)

  • controller_name (str) – Name of the controller

Return type:

Optional[JSONSchemaWrapper]

Returns:

JSONSchemaWrapper object or None if not found

get_all_schemas()[source]

Get all loaded schemas organized by category.

Return type:

Dict[str, Dict[str, JSONSchemaWrapper]]

get_resource_schema(controller_name)[source]

Get a resource schema by controller name.

Return type:

Optional[JSONSchemaWrapper]

get_storage_schema(controller_name)[source]

Get a storage schema by controller name.

Return type:

Optional[JSONSchemaWrapper]

get_authentication_schema(controller_name)[source]

Get an authentication schema by controller name.

Return type:

Optional[JSONSchemaWrapper]

get_job_type_schema(controller_name)[source]

Get a job type schema by controller name.

Return type:

Optional[JSONSchemaWrapper]

class user_workspaces_server.config_schemas.JSONSchemaConfigValidator[source]

Bases: object

Validates configuration dictionaries against JSON schemas.

__init__()[source]

Initialize the validator.

validate_with_schema(config, schema_dict, path='')[source]

Validate a configuration dictionary against a JSON schema.

Parameters:
  • config (Dict[str, Any]) – The configuration dictionary to validate

  • schema_dict (Dict[str, Any]) – The JSON Schema to validate against

  • path (str) – The current path in the config (for error messages)

Return type:

bool

Returns:

True if validation passes, False otherwise

validate_controller_config(config, schema_wrapper, config_key='')[source]

Validate a controller configuration against its schema.

Parameters:
  • config (Dict[str, Any]) – The configuration dictionary to validate

  • schema_wrapper – The JSONSchemaWrapper to validate against

  • config_key (str) – The key in the config file (for error messages)

Return type:

bool

Returns:

True if validation passes, False otherwise

validate_uws_config(config)[source]

Validate the complete UWS config.json file.

Parameters:

config (Dict[str, Any]) – The loaded config.json dictionary

Return type:

bool

Returns:

True if validation passes, False otherwise

Raises:

ValidationError – If validation fails

user_workspaces_server.config_schemas.get_schema_loader()[source]

Get the global schema loader instance.

Return type:

JSONSchemaLoader

exception user_workspaces_server.config_schemas.ValidationError(errors)[source]

Bases: Exception

Exception raised when configuration validation fails.

__init__(errors)[source]