pub struct Field {
pub name: String,
pub serde_name: String,
pub description: String,
pub deprecation_note: Option<String>,
pub type_ref: TypeReference,
pub required: bool,
pub flattened: bool,
pub hidden: bool,
pub transform_callback: String,
pub transform_callback_fn: Option<fn(&mut TypeReference, &Typespace)>,
}Fields§
§name: StringField name, should be a valid Rust field name identifier
serde_name: StringIf a serialized name is not a valid Rust field name identifier then this defines the name of a field to be used in serialization
description: StringRust docs for the field
deprecation_note: Option<String>Deprecation note. If none, field is not deprecated. If present as empty string, field is deprecated without a note.
type_ref: TypeReferenceType of a field
required: boolrequired and not nullable:
- field always present and not null / none
required and nullable:
- Rust:
Option<T>, do not skip serializing if None - TypeScript: T | null, do not skip serializing if null
not required and not nullable:
- Rust:
Option<T>, skip serializing if None - TypeScript: T | undefined, skip serializing if undefined
not required and nullable: serializers and deserializers are required to differentiate between missing fields and null / none fields
- Rust:
reflectapi::Option<T>is enum with Undefined, None and Some variants - TypeScript: T | null | undefined
Default is false
flattened: boolIf serde flatten attribute is set on a field Default is false
If true, the field is excluded from generated clients and documentation but is still functional at runtime (e.g. for header extraction). Default is false
transform_callback: String§transform_callback_fn: Option<fn(&mut TypeReference, &Typespace)>