Mutually Exclusive Fields

Mutually Exclusive Fields is a Schema Constraint. It ensures that, out of a set of fields, only one field is defined at any time.

Usage Example

          type: string
        - name: beta
          type: string
        - name: gamma
          type: string
    constraints:
        - name: Mutually exclusive fields
          arguments:
            fields:
                - alpha
                - beta
                - gamma
"""

GOOD_DATA_1 = """
one:
    name: GoodOne
    alpha: alpha
"""

GOOD_DATA_2 = """

In the above example, only one of the fields (alpha, beta, and gamma) can be defined.

GOOD_DATA_3 = """
one:

Here, alpha is the only one defined. This would pass the Mutaully Exclusive Fields constraint.

"""

GOOD_DATA_6 = """
one:

Here, both alpha and beta are defined, which would fail the Mutaully Exclusive Fields constraint.