On this page

property.union

Intent

A named semantic union suitable for sealed types, discriminated unions, serializers, and schema alternatives.

Exact selection subject:

yaml
subject: property.union

The current Runtime IR is evidence, not authority. Target improvements needed for a usable template contract are called out explicitly.

Scope envelope

ScopeContext
eachproperty.union: UnionPropertyContext
allproperties.unions: UnionPropertyContext[]
collection candidatescollects.group, collects.feature

For collects.<dimension>, the singular collector is added beside the plural selected-subject array. A collector is valid only when ownership is semantically provable.

Context tree

Context pathTypeMeaning / template use
property.union.idstringOpaque stable semantic identity.
property.union.nameNameContextStable semantic identity and finite naming variants.
property.union.descriptionstring|nullHuman semantic description.
property.union.tagsstring[]Semantic classifiers; empty when none.
property.union.explanationsExplanationContext[]Advisory usage/security/implementation notes.
property.union.groupSemanticLinkContext|nullOwning semantic group.
property.union.featureSemanticLinkContext|nullCanonical owning feature, when present.
property.union.lifecycleLifecycleContextDeprecation/removal semantics.
property.union.discriminantNameContextDiscriminator field name.
property.union.membersUnionMemberContext[]Named alternatives.
property.union.members[].nameNameContextAlternative name.
property.union.members[].typeTypeContextAlternative type.

Usage rules

  • Current member map becomes explicit named entries.
  • The discriminant is semantic; target annotation syntax is not.

Runtime IR implications to audit

  • Properties should gain universal metadata.
  • Audit how each member's discriminant value is canonically represented so packs never infer it.

Template example — Jinja / TypeScript union

jinja
export type {{ file.symbol }} =
{% for member in property.union.members -%}
  | {{ render_type(member.type) }}{{ ";" if loop.last else "" }}
{% endfor %}

The example uses semantic context only. Any renderType/render_type helper shown is a pack-owned macro/partial consuming the documented TypeContext, not hidden Dryv context.

Audit questions

  • Can a real property.union pack generate code without parsing raw IR storage conventions?
  • Is any field here present only because the current IR happens to store it?
  • Does any nested item need first-class selection of its own?
Search in