pub struct FieldDef {
pub ts_name: &'static str,
pub zod_expr: &'static str,
pub type_ref: &'static str,
pub optional: bool,
pub skip_if_none: bool,
}Expand description
A single field in a struct schema.
Exactly one of zod_expr or type_ref is non-empty:
zod_expr— complete primitive expression, e.g."z.string().min(1)".type_ref— bare Rust type name of a custom type, e.g."Session". The resolution pass maps this to the correct TS schema name.
Fields§
§ts_name: &'static strTypeScript key (serde-renamed), e.g. "sessionId".
zod_expr: &'static strComplete Zod primitive expression, or "" when type_ref is set.
type_ref: &'static strBare Rust type name of a custom dependency, or "" when zod_expr is set.
optional: boolTrue if the Rust type is Option<T>.
skip_if_none: boolTrue if field has #[serde(skip_serializing_if = "Option::is_none")].
Only meaningful when optional is true. Controls whether to emit
.optional() (field can be omitted) vs .nullable() (field present but can be null).
Trait Implementations§
Auto Trait Implementations§
impl Forget for FieldDef
impl Freeze for FieldDef
impl RefUnwindSafe for FieldDef
impl Send for FieldDef
impl Sync for FieldDef
impl Unpin for FieldDef
impl UnsafeUnpin for FieldDef
impl UnwindSafe for FieldDef
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more