jsonism package

Submodules

jsonism.checker module

jsonism.checker.validate(input: any, schema: any, allow_empty_lists=False, parent=None)

Validate a top-level element. JSON supports lists, dicts and raw elements at the top level.

Parameters
  • input – JSON to be validated, as Python list, dict or base type

  • schema – JSON schema, as Python list, dict or base type

Returns

True or False

jsonism.types module

class jsonism.types.Boolean(allowed=None, mandatory=True)

Bases: object

Schema class for booleans. Takes the place of a bare bool when adding value validation.

type

alias of bool

validate(input)

Validate a boolean field

Parameters

input – The field to validate

Returns

True or False indicating validity

class jsonism.types.Float(max=None, min=None, mandatory=True)

Bases: object

Schema class for floats. Takes the place of a bare float when adding value validation.

type

alias of float

validate(input)

Validate a floating-point field

Parameters

input – The field to validate

Returns

True or False indicating validity

class jsonism.types.Integer(max=None, min=None, mandatory=True)

Bases: object

Schema class for integers. Takes the place of a bare int when adding value validation.

type

alias of int

validate(input)

Validate an integer field.

Parameters

input – The field to validate

Returns

True or False indicating validity

class jsonism.types.String(len=None, max_len=None, min_len=None, options=None, mandatory=True)

Bases: object

Schema class for strings. Takes the place of a bare str when adding value validation.

type

alias of str

validate(input)

Validate a string field

Parameters

input – The input to validate

Returns

True or False indicating validity

Module contents