belso.schemas package — belso 0.0.1 documentation

# belso.schemas package

## Submodules

## belso.schemas.base module

class belso.schemas.base.Field(name, type, description, required=True, default=None)

  Bases: `object`

class belso.schemas.base.Schema

  Bases: `object`

  fields: `ClassVar`[`List`[`Field`]] = []
  classmethod get_field_by_name(name)
    Return type:

      `Optional`[`Field`]

  classmethod get_required_fields()
    Return type:

      `List`[`str`]

  name: `ClassVar`[`str`] = ''

## belso.schemas.nested module

class belso.schemas.nested.ArrayField(name, items_type=<class 'str'>, items_schema=None, description='', required=True)

  Bases: `Field`

  Field class for arrays of items.

  __init__(name, items_type=<class 'str'>, items_schema=None, description='', required=True)

    Initialize an array field.

    ### Args

    param name:

      the name of the field.

    type name:

      str

    - items_type (Type, optional): the type of items in the array. Defaults to str.

    - items_schema (Type[Schema], optional): the schema of items in the array. Defaults to None.

    - description (str, optional): the description of the field. Defaults to an empty string.

    - required (bool, optional): whether the field is required. Defaults to True.

class belso.schemas.nested.NestedField(name, schema, description='', required=True)

  Bases: `Field`

  Field class for nested schemas.

  __init__(name, schema, description='', required=True)

    Initialize a nested field.

    ### Args

    param name:

      the name of the field.

    type name:

      str

    param schema:

      the nested schema.

    type schema:

      Type[Schema]

    param description:

      the description of the field, defaults to an empty string.

    type description:

      Optional[str]

    param required:

      whether the field is required, defaults to True.

    type required:

      Optional[bool]

## Module contents

class belso.schemas.Field(name, type, description, required=True, default=None)

  Bases: `object`

class belso.schemas.Schema

  Bases: `object`

  fields: `ClassVar`[`List`[`Field`]] = []
  classmethod get_field_by_name(name)
    Return type:

      `Optional`[`Field`]

  classmethod get_required_fields()
    Return type:

      `List`[`str`]

  name: `ClassVar`[`str`] = ''