pub struct MetadataFieldDef {
pub key: String,
pub description: String,
pub field_type: FieldType,
pub default_value: Option<String>,
pub enum_values: Option<Vec<String>>,
pub required: Option<bool>,
pub legacy_optional: Option<bool>,
pub required_resolved: bool,
pub init_timestamp: bool,
pub auto_timestamp: bool,
pub serialization: Serialization,
pub filterable: Filterable,
}Expand description
A metadata (frontmatter) field.
Fields§
§key: String§description: String§field_type: FieldType§default_value: Option<String>§enum_values: Option<Vec<String>>§required: Option<bool>Whether an entity must carry this field — absence means
optional, the same rule sections follow. required: true
refuses a create that leaves the field unset
(REQUIRED_FIELD_UNSET); a required field with a
default_value (or an init_timestamp) is auto-filled and
therefore never refused — required-with-default means “always
present”, not “caller must type it”. Replaces the retired
optional: key (opposite polarity): sealed schemas carrying
optional keep loading with inverted-but-equivalent
semantics; authoring refuses it naming this key.
legacy_optional: Option<bool>The retired optional: key, captured raw so sealed content
keeps loading (inverted) while authoring refuses it. Never
serialized, never part of the authoring language.
required_resolved: boolResolved requiredness — computed at load from required,
the retired optional, and the package’s format generation
(an unmarked sealed package reads absence as required, the
legacy meaning; everything else reads absence as optional).
Read via Self::is_required; never parsed from YAML.
init_timestamp: bool§auto_timestamp: bool§serialization: Serialization§filterable: FilterableImplementations§
Source§impl MetadataFieldDef
impl MetadataFieldDef
Sourcepub fn is_required(&self) -> bool
pub fn is_required(&self) -> bool
Whether an entity must carry this field, after the load-time
polarity resolution. The single read every validator and
projection uses — required/legacy_optional are raw parse
captures, not behaviour.
Trait Implementations§
Source§impl Clone for MetadataFieldDef
impl Clone for MetadataFieldDef
Source§fn clone(&self) -> MetadataFieldDef
fn clone(&self) -> MetadataFieldDef
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MetadataFieldDef
impl Debug for MetadataFieldDef
Source§impl<'de> Deserialize<'de> for MetadataFieldDef
impl<'de> Deserialize<'de> for MetadataFieldDef
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for MetadataFieldDef
impl JsonSchema for MetadataFieldDef
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more