**** CubicPower OpenStack Study ****
def 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.
:argument dict request_body_schema: a schema to validate request body
"""
schema_validator = _SchemaValidator(request_body_schema)
def add_validator(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
schema_validator.validate(kwargs['body'])
return func(*args, **kwargs)
return wrapper
return add_validator