Skip to content
Prompty

UnionProperty

Represents a JSON Schema union property.

Use oneOf when exactly one branch must match, or anyOf when one or more branches may match. Exactly one composition field MUST be provided with at least one branch; oneOf and anyOf MUST NOT both be populated. The alternatives are full Prompty properties so unions remain portable across generated runtimes.

---
title: UnionProperty
config:
  look: handDrawn
  theme: colorful
  class:
    hideEmptyMembersBox: true
---
classDiagram
    class Property {
        +string name
        +string kind
        +string description
        +boolean required
        +boolean nullable
        +unknown default
        +unknown example
        +unknown[] enumValues
    }
    Property <|-- UnionProperty
    class UnionProperty {
        +string kind
        +Property[] oneOf
        +Property[] anyOf
    }
    class Property {
        +string kind
        +string description
        +boolean required
        +boolean nullable
        +unknown default
        +unknown example
        +unknown[] enumValues
    }
    UnionProperty *-- Property
    class Property {
        +string kind
        +string description
        +boolean required
        +boolean nullable
        +unknown default
        +unknown example
        +unknown[] enumValues
    }
    UnionProperty *-- Property
anyOf:
- kind: string
- kind: boolean
Name Type Description
kind string
oneOf Property[] Alternative property schemas where exactly one branch must match
anyOf Property[] Alternative property schemas where one or more branches may match

The following types are composed within UnionProperty: