gws.spec.runtime

Validate values according to specs

Source code: gws.spec.runtime

Module Contents

gws.spec.runtime.create(manifest_path: str = None, read_cache=False, write_cache=False) Object
gws.spec.runtime.Error
gws.spec.runtime.GeneratorError
gws.spec.runtime.get_spec(manifest_path: str = None, read_cache=False, write_cache=False) dict
gws.spec.runtime.LoadError
class gws.spec.runtime.Object(gs)

Bases: gws.SpecRuntime

Specification runtime.

cli_commands(lang='en')
command_descriptor(command_category, command_name)

Get a command descriptor.

Parameters:
  • command_category – Command category.

  • command_name – Command name.

Returns:

A descriptor or None if the command is not found.

get_class(classref, ext_type=None)

Get a class object for a class reference.

Parameters:
  • classref – Class reference.

  • ext_type – Extension type.

Returns:

A class or None if the reference is not found.

get_type(key)
object_descriptor(name)

Get an object descriptor.

Parameters:

type_name – Object type name.

Returns:

A descriptor or None if the type is not found.

parse_classref(classref: gws.ClassRef) tuple[type | None, str, str]

Parse a class reference.

Parameters:

classref – Class reference.

Returns:

A tuple (class object, class name, extension name).

read(value, type_name, path='', options=None)

Read a raw value according to a spec.

Parameters:
  • value – Raw value from config or request.

  • type_name – Object type name.

  • path – Config file path.

  • options – Read options.

Returns:

A parsed object.

register_object(classref, ext_type, cls)

Dynamically register an extension object.

gws.spec.runtime.ReadError