Skip to main content

BuiltinField

Struct BuiltinField 

Source
pub struct BuiltinField {
Show 16 fields pub name: &'static str, pub field_type: FieldType, pub widget: Widget, pub required: bool, pub default_json: Option<&'static str>, pub format: Option<&'static str>, pub enum_values: Option<&'static [&'static str]>, pub items_type: Option<FieldType>, pub one_of_members: Option<&'static [BuiltinField]>, pub description: &'static str, pub label: Option<&'static str>, pub label_key: &'static str, pub score: u8, pub skip_schema: bool, pub group: &'static str, pub file_kinds: Option<&'static [ExtKind]>,
}
Expand description

A builtin frontmatter field definition.

Each entry describes a field that moss recognizes in markdown frontmatter. The schema::builtin_schema() function reads this table to produce the ContentSchema returned to the editor and validation engine.

Fields§

§name: &'static str

Field name as it appears in YAML frontmatter.

§field_type: FieldType

Data type of the field.

§widget: Widget

UI widget hint for the editor form.

§required: bool

Whether the field is required.

§default_json: Option<&'static str>

Default value as a JSON literal (e.g. "true", "\"list\"", "1").

§format: Option<&'static str>

Format hint (e.g. "date" for YYYY-MM-DD validation).

§enum_values: Option<&'static [&'static str]>

Allowed values for select/enum fields.

§items_type: Option<FieldType>

Item type for array fields (e.g. FieldType::String for tags: [...]).

§one_of_members: Option<&'static [BuiltinField]>

Member variants for a OneOf union field. Each member is itself a BuiltinField (scalar field_type/widget — const-legal). Set only for union fields (children, series); builtin_schema() recursively materializes these into the owned FieldDefinition::one_of.

§description: &'static str

Human-readable description shown in the editor form.

§label: Option<&'static str>

Optional human-readable label for the chip bar. When None, the frontend falls back to using the field key. Useful for fields with unfriendly internal names (e.g. children_depth → “Depth”).

§label_key: &'static str

i18n key for the chip bar label, resolved by the TypeScript registry. Format: “chip..label”. Empty string → frontend falls back to field name. The existing label field is deprecated in favour of this key.

§score: u8

Display score for chip bar ordering and add-property search list ordering. Lower values appear first / sort higher in the list. Formula: score = 100 - (Frequency6 + Importance4) where Frequency (0–5) = real usage frequency, Importance (0–5) = first-principles importance. 0 means unset (skip-schema fields). Typical range: 0 (title) to 100 (draft/listed/cascade).

§skip_schema: bool

If true, the field exists in the FrontMatter struct but is NOT exposed in the editor schema or validation. Used for site-level config, auto-generated fields, and fields migrating to plugin-contributed schemas.

The field name IS surfaced to the frontend via FrontmatterSchema::internal_fields (populated by builtin_schema()), so the chip bar can filter these out of its render list without a hand-maintained denylist. Adding a new skip_schema: true field here is sufficient — no TS-side edit needed.

§group: &'static str

UI group for the add-property dropdown. Fields with the same group are displayed together. Empty string for skip_schema fields. One of: “This Page”, “Child Pages”, “Child Styles”, “Whole Site”. The “Other” group is handled entirely on the TS side for unknown fields.

§file_kinds: Option<&'static [ExtKind]>

For Widget::FilePicker fields, the extension kinds the picker should restrict search results to (e.g. cover → image or video; logo → image only). None means unrestricted. This is the schema-side SSOT the chip bar reads instead of hardcoding a key -> ExtKind[] switch.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.