def validate_mappings_object(
        mappings_object: Dict,
        structured_marqo_index: Optional[marqo_index.StructuredMarqoIndex] = None
):
    """validates the mappings object.
    Args:
        mappings_object: the mappings object to validate
        structured_marqo_index: Optional StructuredMarqoIndex object. If provided, the validation ensures the mappings are valid
        for this index
    Returns
        The given mappings object if validation has passed

    Raises an InvalidArgError if the settings object is badly formatted
    """
    try:
        jsonschema.validate(instance=mappings_object, schema=mappings_schema)
        for field_name, config in mappings_object.items():
            validate_field_name(field_name)
            if config["type"] == enums.MappingsObjectType.multimodal_combination:
                validate_multimodal_combination_mappings_object(config)
                if structured_marqo_index is not None:
                    if (
                            field_name not in structured_marqo_index.field_map or
                            structured_marqo_index.field_map[
                                field_name
                            ].type != marqo_index.FieldType.MultimodalCombination
                    ):
                        raise jsonschema.ValidationError(
                            f'Invalid mapping {field_name}. Index has no multimodal combination field {field_name}'
                        )
                    dependent_fields = structured_marqo_index.field_map[field_name].dependent_fields
                    weights: dict = config['weights']
                    for field in weights:
                        if field not in dependent_fields:
                            raise jsonschema.ValidationError(
                                f'Invalid mapping {field_name}. '
                                f'Field {field} is not a dependent field of {field_name}'
                            )

            elif config["type"] == enums.MappingsObjectType.custom_vector:
                validate_custom_vector_mappings_object(config)
                # TODO: add validation for custom vector structured/unstructured here

        return mappings_object
    except jsonschema.ValidationError as e:
        raise InvalidArgError(
            f"Error validating mappings object. Reason: {str(e)}. "
            f" Read about the mappings object here: `{marqo_docs.mappings()}`"
        )
validates the mappings object.
    Args:
        mappings_object: the mappings object to validate
        structured_marqo_index: Optional StructuredMarqoIndex object. If provided, the validation ensures the mappings are valid
        for this index
    Returns
        The given mappings object if validation has passed

    Raises an InvalidArgError if the settings object is badly formatted
    
src/marqo/tensor_search/validation.py