def validate_configuration(configuration):
    schema = {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "type": "object",
        "required": ["version", "control-service", "dataset"],
        "properties": {
            "version": {
                "type": "number",
                "maximum": 1,
                "minimum": 1,
            },
            "control-service": {
                "type": "object",
                "required": ["hostname"],
                "properties": {
                    "hostname": {
                        "type": "string",
                        "format": "hostname",
                    },
                    "port": {"type": "integer"},
                }
            },
            "dataset": {
                "type": "object",
                "properties": {
                    "backend": {
                        "type": "string",
                    },
                },
                "required": [
                    "backend",
                ],
            },
            "logging": {
                # Format described at https://www.python.org/dev/peps/pep-0391/
                "type": "object",
            },
        }
    }

    v = Draft4Validator(schema, format_checker=FormatChecker())
    v.validate(configuration)
Validate a provided configuration.
dataset/ETHPy150Open ClusterHQ/flocker/flocker/node/script.py/validate_configuration