DiscriminatedModelShape interface
A name-discriminated group of variants that share one parent key
(an ARM (type, apiVersion) at the registry level, or a parent
model's @discriminator field elsewhere). The discriminator names
the field whose value selects a variant.
Properties
| by |
Map from discriminator value (e.g. Entries may be:
Note that a hierarchy re-using the same discriminator field at every level (abstract intermediates) is flattened by the emitter into a single level here — only a change of discriminator field produces a nested entry. |
| discriminator | Names of the field used to select a variant. |
| kind |
Property Details
byValue
Map from discriminator value (e.g. "signin") to the shape for
that variant. A value with no entry here doesn't end resolution —
<xref:resolveModelShape> infers the variant from the payload's
structure instead.
Entries may be:
- a FlatModelShape — the terminal, common case;
- a DeferredShape — breaks emit-order / cyclic-reference hazards, exactly as PropertyShape.value does;
- a nested DiscriminatedModelShape — a variant that is
itself a discriminated base on a different field. TypeSpec
permits this (
@discriminator("kind") model Pet, then@discriminator("breed") model Cat extends Pet), so selecting a concrete shape may take more than one hop. See <xref:resolveModelShape>.
Note that a hierarchy re-using the same discriminator field at every level (abstract intermediates) is flattened by the emitter into a single level here — only a change of discriminator field produces a nested entry.
byValue: {[value: string]: ModelShape | DeferredShape<ModelShape>}
Property Value
{[value: string]: ModelShape | DeferredShape<ModelShape>}
discriminator
Names of the field used to select a variant.
discriminator: DiscriminatorNames
Property Value
kind
kind: "discriminatedModel"
Property Value
"discriminatedModel"