Polymorphic picker that never exposes model or table names on the wire.
| Builder | F.morphTo(attribute: string, options: MorphToOptions = { types: {} }): MorphTo |
| Wire type key | morph-to |
| Class chain | MorphTo → Field |
| Detail projection | relation-entry |
| Column counterpart | — (not tabulatable) |
Example
import { F } from '@adonia/core'
F.morphTo('attribute')Props
This type adds no props of its own; it is configured entirely through the shared field DSL.
Introspection
Read-only members this type adds — used by the compiler, the table derivation and tests rather than by a schema author.
| Member | Declared on | Behaviour |
|---|---|---|
get capabilities(): readonly string[] |
MorphTo |
Requests the scoped relation-options endpoint for the selected type. |
detailProps(): JsonObject |
MorphTo |
Exposes only stable label/resource-slug pairs to the detail renderer. |
contributeHints(hints: EagerHints): void |
MorphTo |
Preloads the polymorphic attribute once for list/detail hydration. |
get optionsResolver() |
MorphTo |
Resolves options only from the currently selected allowlisted resource slug. |
allowsType(slug: string): boolean |
MorphTo |
Whether slug is one of this field’s declared stable resource slugs. |
resolveType(slug: string, ctx: HttpContextLike) |
MorphTo |
Resolves an allowlisted resource slug from the active panel registry. |
applyAttributes(record: object, value: unknown): void |
MorphTo |
Writes the validated stable resource slug and id into the configured model columns. |
Validation
Vine base: vine.any().
Contributed by MorphTo.vineSchema() in packages/core/src/schema/fields/morph_to.ts. The shared modifiers (required, nullable, requiredWhen, unique, optionality) are applied on top by Field.buildValidation, and a rules() override replaces the base entirely — the validator compiler never branches on the field class.
Declared in
packages/core/src/schema/fields/morph_to.ts—MorphTo