karbor.api.validation package

Submodules

karbor.api.validation.parameter_types module

Common parameter types for validating request Body.

karbor.api.validation.validators module

Internal implementation of request Body validating middleware.

class karbor.api.validation.validators.FormatChecker(formats=None)

Bases: jsonschema._format.FormatChecker

A FormatChecker can output the message from cause exception

We need understandable validation errors messages for users. When a custom checker has an exception, the FormatChecker will output a readable message provided by the checker.

check(param_value, format)

Check whether the param_value conforms to the given format.

Parameters
  • param_value – the param_value to check

  • format (str) – the format that param_value should conform to

Type

any primitive type (str, number, bool)

Raises

FormatError if param_value does not conform to format

Module contents

Request Body validating middleware.

karbor.api.validation.schema(request_body_schema)

Register a schema to validate request body.

Registered schema will be used for validating request body just before API method executing.

Parameters

request_body_schema (dict) – a schema to validate request body