addons14/base_rest/tools.py
def cerberus_to_json(schema):
    """Convert a Cerberus schema to a JSON schema"""
    result = OrderedDict()
    required = []
    properties = OrderedDict()
    result["type"] = "object"
    result["required"] = required
    result["properties"] = properties
    for field, spec in list(schema.items()):
        props = _get_field_props(spec)
        properties[field] = props
        if spec.get("required"):
            required.append(field)
    # sort required to get the same order on each run and easy comparison into
    # the tests
    required.sort()
    return result
Convert a Cerberus schema to a JSON schema
Convert a Cerberus schema to a JSON schema
Convert a Cerberus schema to a JSON schema
def cerberus_to_json(schema):
    result = OrderedDict()
    required = []
    properties = OrderedDict()
    result["type"] = "object"
    result["required"] = required
    result["properties"] = properties
    for field, spec in list(schema.items()):
        props = _get_field_props(spec)
        properties[field] = props
        if spec.get("required"):
            required.append(field)
    required.sort()
    return result
def cerberus_to_json ( schema ) : result = OrderedDict ( ) required = [ ] properties = OrderedDict ( ) result [ "type" ] = "object" result [ "required" ] = required result [ "properties" ] = properties for field , spec in list ( schema . items ( ) ) : props = _get_field_props ( spec ) properties [ field ] = props if spec . get ( "required" ) : required . append ( field ) required . sort ( ) return result
Convert a Cerberus schema to a JSON schema
Convert a Cerberus schema to a JSON schema
"""Convert a Cerberus schema to a JSON schema""" # sort required to get the same order on each run and easy comparison into # the tests
schema