pub struct Field {
pub name: RustIdent,
pub rename: Option<String>,
pub doc: Option<String>,
pub deprecated: Option<Deprecation>,
pub ty: RustType,
pub required: bool,
pub omit_empty: Option<bool>,
pub serde_skip: bool,
pub default: Option<DefaultValue>,
pub constraints: Option<Constraints>,
}Expand description
A single struct field.
Fields§
§name: RustIdentRust field identifier.
rename: Option<String>#[serde(rename = "...")] value, when the wire name differs.
doc: Option<String>Doc comment derived from the property description.
deprecated: Option<Deprecation>#[deprecated] annotation from deprecated: true (+ x-deprecated-reason).
ty: RustTypeField type (already wrapped in Option<..> when optional).
required: boolWhether the property is required. Optional fields get
#[serde(skip_serializing_if = "Option::is_none")] unless Self::omit_empty
overrides it.
omit_empty: Option<bool>x-omitempty override: Some(true)/Some(false) forces the
skip_serializing_if on/off. None keeps the default (skip when optional).
serde_skip: boolx-rust-serde-skip: drop the field from (de)serialization via #[serde(skip)].
default: Option<DefaultValue>The value that serde uses when the property is absent, from default.
An optional property with a default is not wrapped in Option. Once
parsed, it always holds a value. Only nullable keeps the Option,
because there null is a value that the property can carry.
default: null never reaches here. The parser reads it as no default at
all, and serde already leaves a missing Option as None.
constraints: Option<Constraints>The validation keywords the property declares, when it declares any.
The generator checks these on the way in, so the check runs only where the code deserializes. A response the server writes is not checked.