Skip to main content

FieldDefinition

Struct FieldDefinition 

Source
pub struct FieldDefinition {
Show 15 fields pub field_type: FieldType, pub widget: Option<Widget>, pub required: bool, pub default: Option<Value>, pub format: Option<String>, pub enum_values: Option<Vec<String>>, pub items: Option<Box<FieldDefinition>>, pub one_of: Option<Vec<FieldDefinition>>, pub description: Option<String>, pub label: Option<String>, pub label_key: Option<String>, pub score: u8, pub source: Option<String>, pub group: Option<String>, pub file_kinds: Option<Vec<ExtKind>>,
}
Expand description

A single field definition in the frontmatter schema.

Fields§

§field_type: FieldType

The data type of the field.

§widget: Option<Widget>

Which UI widget to render for this field. None for sub-definitions (e.g. array item types) that have no direct UI representation.

§required: bool

Whether this field is required.

§default: Option<Value>

Default value for the field.

§format: Option<String>

Format hint (e.g. “date” for YYYY-MM-DD).

§enum_values: Option<Vec<String>>

Allowed values for select/enum fields.

§items: Option<Box<FieldDefinition>>

Item definition for array fields.

§one_of: Option<Vec<FieldDefinition>>

Member variants for a OneOf union field. Each member is a full FieldDefinition carrying its own field_type + widget. Only set when field_type == OneOf. The specta override mirrors items to dodge the self-referential type (the chip bar reads members structurally from JSON; it needs no nominal TS type).

§description: Option<String>

Human-readable description of the field.

§label: Option<String>

Optional human-readable label for the chip bar. When None, the frontend falls back to using the field key.

§label_key: Option<String>

i18n key for the chip bar label, resolved by the TypeScript registry. None when no key is registered (frontend falls back to field name).

§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); see schema_fields.rs. 0 means unset (skip-schema or plugin-contributed fields, sort to end). Serialized as “priority” for backwards compatibility with the frontend.

§source: Option<String>

Source of this field definition. None for builtin fields, Some("review") for plugin-contributed fields. Used by the frontend to group fields by source in the editor form. See docs/reference/plugin-schema-contributions.md.

§group: Option<String>

UI group name for the add-property dropdown (e.g. “Common”, “Children”). None for plugin-contributed fields (shown in “Other” group).

§file_kinds: Option<Vec<ExtKind>>

For Widget::FilePicker fields, the extension kinds the picker should restrict search results to (e.g. cover -> image/video, logo -> image only). None means unrestricted. Mirrors schema_fields::BuiltinField::file_kinds — see that field’s doc comment.

Trait Implementations§

Source§

impl Clone for FieldDefinition

Source§

fn clone(&self) -> FieldDefinition

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FieldDefinition

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for FieldDefinition

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for FieldDefinition

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.