def one_field_empty_other_filled_check()

in annotation/annotation/schemas/annotations.py [0:0]


    def one_field_empty_other_filled_check(cls, values):
        """
        When user_id is null, pipeline_id should not be null
        and vice versa.
        """
        user_id, pipeline_id = values.get("user"), values.get("pipeline")
        if (user_id is None and pipeline_id is None) or (
            user_id is not None and pipeline_id is not None
        ):
            raise ValueError(
                "Fields user_id and pipeline_id should "
                "not be empty or filled at the same time."
            )
        return values