type
Definition
type Definition struct {
name string
kind Kind
label string
labelTranslations map[string]string
required bool
unique bool
index bool
localized bool
minLength *int
maxLength *int
minimum *float64
maximum *float64
step *float64
defaultValue *DefaultValue
slugSource string
slugConfigured bool
choices []Choice
selectMany bool
selectDefaults []string
relationTo []string
relationMany bool
fields []Definition
blocks []Block
tabs []TabDefinition
pluginKey string
pluginConfig json.RawMessage
pluginReferenceKeys []string
adminPluginKey string
adminComponent string
adminComponentConfig json.RawMessage
adminComponentConfigured bool
description string
descriptionTranslations map[string]string
placeholder string
placeholderTranslations map[string]string
readOnly bool
hidden bool
sidebar bool
columns int
tab string
tabTranslations map[string]string
condition *Condition
codeLanguage string
datePickerAppearance DatePickerAppearance
minRows int
maxRows int
rowLabel string
rowLabelAdminPluginKey string
rowLabelComponent string
rowLabelComponentConfig json.RawMessage
rowLabelComponentConfigured bool
rowLabels RowLabels
initiallyCollapsed bool
joinCollection string
joinOn string
joinLimit int
joinDefaultColumns []string
joinDefaultSort string
joinAllowCreate bool
joinCreateConfigured bool
valueType ValueType
relationshipFilters []RelationshipFilterRule
referenceDeleteAction ReferenceDeleteAction
issues []Issue
}An immutable authored field definition.
Name()string- Authored storage or presentation name.
Kind()Kind- Built-in or plugin field kind.
Label()string- Author-facing label.
LabelTranslations()map[string]string- Translated labels keyed by admin language.
Required()bool- Whether a stored value is required.
Unique()bool- Whether stored values must be unique.
Index()bool- Whether the field requests an index.
Localized()bool- Whether values are stored per locale.
RelationshipTarget()string- Single relationship target, when configured.
RelationshipTargets()[]string- Defensive copy of every relationship target.
RelationshipHasMany()bool- Whether the relationship stores multiple targets.
SelectHasMany()bool- Whether a select stores an ordered list of choices.
SelectDefaults()[]string- Detached ordered defaults for a multi-select.
Category()Category- Scalar, nested, presentation, relationship, upload, or plugin behavior.
Default()(DefaultValue, bool)- Typed scalar default and whether one exists.
SlugSource()(string, bool)- Source path and whether first-class slug behavior is configured.
Choices()[]Choice- Defensive copy of select or radio choices.
Fields()[]Definition- Defensive copy of nested fields.
Blocks()[]Block- Defensive copy of allowed block layouts.
Tabs()[]TabDefinition- Defensive copy of tab definitions.
PluginKey()string- Stable plugin field key.
AdminComponent()(pluginKey, component string, config json.RawMessage, ok bool)- Detached exact renderer selection and whether one was configured.
Description()string- Author-facing help text.
DescriptionTranslations()map[string]string- Translated help text keyed by admin language.
Placeholder()string- Canonical empty-state prompt for compatible controls.
PlaceholderTranslations()map[string]string- Translated empty-state prompts keyed by admin language.
ReadOnly()bool- Whether the admin renders the field as read-only.
Hidden()bool- Whether the admin omits the field from presentation.
Sidebar()bool- Whether a root field belongs in the document editor side rail.
Columns()int- Requested row-layout column span.
Tab()string- Authored tab association.
TabTranslations()map[string]string- Translated tab labels keyed by admin language.
Condition()*Condition- Detached conditional-display rule, when configured.
CodeLanguage()string- Syntax language hint for code fields.
MinLength()(int, bool)- Minimum string length and whether it is set.
MaxLength()(int, bool)- Maximum string length and whether it is set.
Min()(float64, bool)- Minimum numeric value and whether it is set.
Max()(float64, bool)- Maximum numeric value and whether it is set.
Step()(float64, bool)- Numeric editor step and whether it is set.
DatePickerAppearance()DatePickerAppearance- Configured date editor mode.
MinRows()int- Minimum authored rows for repeating fields.
MaxRows()int- Maximum authored rows for repeating fields.
RowLabel()string- Author-facing repeating-row label.
RowLabelComponent()(pluginKey, component string, config json.RawMessage, ok bool)- Detached paired-plugin row-label component selection and whether one was configured.
RowLabels()map[string]string- Translated repeating-row labels.
WithLabelTranslations()map[string]string- Defensive copy of authored label translations.
InitiallyCollapsed()bool- Initial collapsed state for supported layouts.
JoinCollection()string- Collection read through a join field.
JoinOn()string- Relationship path backing a join field.
JoinLimit()int- Maximum number of joined documents returned.
JoinDefaultColumns()[]string- Defensive copy of default join-list columns.
JoinDefaultSort()string- Default join-list ordering.
JoinAllowCreate()bool- Whether the admin may create a joined target inline.
ValueType()ValueType- Declared output type for a virtual field.
RelationshipFilters()[]RelationshipFilterRule- Defensive copy of server-enforced picker filters.
ReferenceDeleteAction()ReferenceDeleteAction- Authored delete policy; empty means config resolution must apply the default.
PluginConfig()json.RawMessage- Defensive copy of plugin-owned configuration JSON.
PluginReferenceKeys()[]string- Defensive copy of plugin-declared reference keys.
Issues()[]Issue- Defensive copy of builder issues found before config resolution.
Definitions defensively copy nested fields, blocks, tabs, plugin JSON, and option slices. Construct them with package builders rather than struct literals.
Read-only methods expose all builder input to config resolvers and plugins: labels, validation and index flags, defaults, choices, nested definitions, relationship metadata, presentation, scalar bounds, join metadata, plugin config, and reference keys.
Methods
Definition.AdminComponent()AdminComponent returns the optional statically registered admin plugin renderer selected for this field. The returned configuration is detached from the immutable definition.
Definition.Blocks()Blocks returns a deep copy of the allowed block types.
Definition.Category()Category returns the behavioral category for the definition's field kind.
Definition.Choices()Choices returns a copy of the select choices.
Definition.CodeLanguage()CodeLanguage is the editor language hint for a code field.
Definition.Columns()Columns returns the requested one-to-twelve-column admin grid width, or zero.
Definition.Condition()Condition returns a copy of the configured presentation condition, if any.
Definition.DatePickerAppearance()DatePickerAppearance returns the configured date control, defaulting to day-only.
Definition.Default()Default returns the configured typed scalar default.
Definition.Description()Description returns the configured author-facing supporting text.
Definition.DescriptionTranslations()DescriptionTranslations returns localized supporting text by admin language.
Definition.Fields()Fields returns a deep copy of the nested child definitions.
Definition.Hidden()Hidden reports whether the admin should omit this field from presentation.
Definition.Index()Index reports whether the field should have a non-unique database index. Unique fields already receive a unique index even when this is false.
Definition.InitiallyCollapsed()InitiallyCollapsed reports whether a collapsible presentation group starts closed.
Definition.Issues()Issues returns a copy of constructor and option compatibility issues.
Definition.JoinAllowCreate()JoinAllowCreate reports whether the admin may offer inline target creation.
Definition.JoinCollection()JoinCollection is the collection queried by an inverse join.
Definition.JoinDefaultColumns()JoinDefaultColumns returns the target fields shown by the inverse-join table.
Definition.JoinDefaultSort()JoinDefaultSort returns the target sort expression, including an optional descending prefix.
Definition.JoinLimit()JoinLimit is the maximum related documents returned for an inverse join.
Definition.JoinOn()JoinOn is the target relationship path matched against the source document ID.
Definition.Kind()Kind returns the concrete authoring field kind.
Definition.Label()Label returns the explicit author-facing label, if one was configured.
Definition.LabelTranslations()LabelTranslations returns localized author-facing labels by admin language.
Definition.Localized()Localized reports whether the field stores an independent value for each configured application locale.
Definition.Max()Max returns the inclusive maximum accepted by a number field.
Definition.MaxLength()MaxLength returns the maximum accepted Unicode code-point length.
Definition.MaxRows()MaxRows is the maximum accepted length for an array, or zero when unbounded.
Definition.Min()Min returns the inclusive minimum accepted by a number field.
Definition.MinLength()MinLength returns the minimum accepted Unicode code-point length.
Definition.MinRows()MinRows is the minimum accepted length for an array.
Definition.Name()Name returns the document property name authored for the field.
Definition.Placeholder()Placeholder returns the canonical empty-state prompt for compatible admin controls.
Definition.PlaceholderTranslations()PlaceholderTranslations returns localized placeholder text by admin language.
Definition.PluginConfig()PluginConfig returns a copy of the plugin-owned serialized configuration.
Definition.PluginKey()PluginKey returns the compiled plugin responsible for a custom field.
Definition.PluginReferenceKeys()PluginReferenceKeys returns JSON property names whose string values contain public collection slugs and therefore participate in content renames and persisted reference-shape migration safety.
Definition.ReadOnly()ReadOnly reports whether the admin should prevent editing this field.
Definition.ReferenceDeleteAction()ReferenceDeleteAction returns the explicitly authored hard-delete policy. An empty action means config resolution must apply the deterministic default for the reference shape.
Definition.RelationshipFilters()RelationshipFilters returns configured multi-rule and polymorphic option filters.
Definition.RelationshipHasMany()RelationshipHasMany reports whether the field stores multiple references.
Definition.RelationshipTarget()RelationshipTarget returns the first configured target slug, or an empty string.
Definition.RelationshipTargets()RelationshipTargets returns a copy of all configured target slugs.
Definition.Required()Required reports whether validation rejects a missing, null, or field-type-specific empty value.
Definition.RowLabel()RowLabel is the child property used to label array rows in the admin.
Definition.RowLabelComponent()RowLabelComponent returns the optional statically registered admin plugin component selected for array or blocks row headings. The returned configuration is detached from the immutable definition.
Definition.RowLabels()RowLabels returns optional singular and plural author-facing array row names.
Definition.SelectDefaults()SelectDefaults returns the configured ordered default choices for a multi-select.
Definition.SelectHasMany()SelectHasMany reports whether a select stores an ordered list of choices.
Definition.Sidebar()Sidebar reports whether a root field belongs in the document editor's right rail.
Definition.SlugSource()SlugSource returns the source field path for a text-backed slug helper. The boolean distinguishes an invalid empty source from an ordinary text field.
Definition.Step()Step returns the positive admin input increment for a number field. It is presentation metadata and does not impose divisibility validation.
Definition.Tab()Tab returns the named admin form tab, or an empty string.
Definition.Tabs()Tabs returns a deep copy of the configured named and unnamed tabs.
Definition.TabTranslations()TabTranslations returns localized direct-tab labels by admin language.
Definition.Unique()Unique reports whether values must be distinct within the collection.
Definition.ValueType()ValueType is the declared output contract for a virtual field.
Definition.WithLabelTranslations()WithLabelTranslations returns an immutable copy with localized labels. It is useful for presentation definitions such as Collapsible that do not accept options.