Anypoint Best Practices

(14 reviews)

heterogeneous-union

general > heterogeneous-union


Guidance

Unions between different types are not a good design practice. Object
shapes with scalar flags/properties are an acceptable alternative.

Message

Do not use 'unionType' as it contains union of different kinds (for example objects and scalars). Use object shapes with scalar flags/properties instead.

Examples

valid

types:
  unionType:
    type: date-only|string
    example: "Hello, world!"

invalid

types:
  unionType:
    type: array|integer
    example: 5

Applies to AnyShape

Constraint

Type: Rego Validation

Reviews

TypeRuleset
OrganizationMuleSoft
Published by
MuleSoft Organization
Published onDec 11, 2023
Asset overview

Asset versions for 1.6.x

Asset versions
VersionActions
1.6.1
1.6.0

Tags