def validate_config(config_json, fields):
    """Validate a JSON file configuration against list of :obj:`honeycomb.defs.ConfigField`."""
    for field_name, validator_obj in six.iteritems(fields):
        field_value = config_json.get(field_name, None)
        if field_value is None:
            raise exceptions.ConfigFieldMissing(field_name)

        if not validator_obj.validator_func(field_value):
            raise exceptions.ConfigFieldValidationError(field_name, field_value, validator_obj.get_error_message())
def validate_config ( config_json , fields ) : for field_name , validator_obj in six . iteritems ( fields ) : field_value = config_json . get ( field_name , None ) if field_value is None : raise exceptions . ConfigFieldMissing ( field_name ) if not validator_obj . validator_func ( field_value ) : raise exceptions . ConfigFieldValidationError ( field_name , field_value , validator_obj . get_error_message ( ) )
Validate a JSON file configuration against list of :obj:`honeycomb.defs.ConfigField`.