def validate_formula_components(components, versions):
    version_map = {}

    # Build the map of formula -> version
    for version in versions:
        version_map[version['formula']] = version['version']

    errors = {}

    for component in components:
        validated = component.pop('validated', False)
        formula = component.get('formula')
        if not validated:
            # We only care to validate here it wasn't already validated in the other serializer.
            sls_path = component['sls_path']

            version = version_map.get(formula)

            component_list = formula.components_for_version(version)

            if sls_path not in component_list:
                err_msg = 'formula `{0}` does not contain an sls_path called `{1}`.'
                errors.setdefault('sls_path', []).append(err_msg.format(formula.uri, sls_path))

    if errors:
        raise ValidationError(errors)

    return components
Validate a LIST of formula components, where the versions DO NOT already exist
dataset/ETHPy150Open stackdio/stackdio/stackdio/api/formulas/validators.py/validate_formula_components