st2common/st2common/util/pack.py
def validate_config_against_schema(config_schema, config_object, config_path,
                                  pack_name=None):
    """
    Validate provided config dictionary against the provided config schema
    dictionary.
    """
    pack_name = pack_name or 'unknown'

    schema = util_schema.get_schema_for_resource_parameters(parameters_schema=config_schema,
                                                            allow_additional_properties=True)
    instance = config_object

    try:
        cleaned = util_schema.validate(instance=instance, schema=schema,
                                       cls=util_schema.CustomValidator, use_default=True,
                                       allow_default_none=True)
    except jsonschema.ValidationError as e:
        attribute = getattr(e, 'path', [])
        attribute = '.'.join(attribute)

        msg = ('Failed validating attribute "%s" in config for pack "%s" (%s): %s' %
               (attribute, pack_name, config_path, str(e)))
        raise jsonschema.ValidationError(msg)

    return cleaned

    Validate provided config dictionary against the provided config schema
    dictionary.
    
Validate provided config dictionary against the provided config schema
dictionary.
Validate provided config dictionary against the provided config schema dictionary .
def validate_config_against_schema(config_schema, config_object, config_path,
                                  pack_name=None):
    pack_name = pack_name or 'unknown'
    schema = util_schema.get_schema_for_resource_parameters(parameters_schema=config_schema,
                                                            allow_additional_properties=True)
    instance = config_object
    try:
        cleaned = util_schema.validate(instance=instance, schema=schema,
                                       cls=util_schema.CustomValidator, use_default=True,
                                       allow_default_none=True)
    except jsonschema.ValidationError as e:
        attribute = getattr(e, 'path', [])
        attribute = '.'.join(attribute)
        msg = ('Failed validating attribute "%s" in config for pack "%s" (%s): %s' %
               (attribute, pack_name, config_path, str(e)))
        raise jsonschema.ValidationError(msg)
    return cleaned
def validate_config_against_schema ( config_schema , config_object , config_path , pack_name = None ) : pack_name = pack_name or 'unknown' schema = util_schema . get_schema_for_resource_parameters ( parameters_schema = config_schema , allow_additional_properties = True ) instance = config_object try : cleaned = util_schema . validate ( instance = instance , schema = schema , cls = util_schema . CustomValidator , use_default = True , allow_default_none = True ) except jsonschema . ValidationError as e : attribute = getattr ( e , 'path' , [ ] ) attribute = '.' . join ( attribute ) msg = ( 'Failed validating attribute "%s" in config for pack "%s" (%s): %s' % ( attribute , pack_name , config_path , str ( e ) ) ) raise jsonschema . ValidationError ( msg ) return cleaned
Validate provided config dictionary against the provided config schema
dictionary.
Validate provided config dictionary against the provided config schema dictionary .
"""
    Validate provided config dictionary against the provided config schema
    dictionary.
    """
config_schema
config_object
config_path
pack_name