Skip to main content

TypeMappingConfig

Struct TypeMappingConfig 

Source
pub struct TypeMappingConfig {
Show 16 fields pub date_time: DateStrategy, pub date: DateStrategy, pub time: DateStrategy, pub duration: DurationStrategy, pub uuid: UuidStrategy, pub byte: ByteStrategy, pub binary: BinaryStrategy, pub ipv4: IpStrategy, pub ipv6: IpStrategy, pub uri: UriStrategy, pub email: EmailStrategy, pub unsigned: bool, pub format_aliases: BTreeMap<String, String>, pub shape: Option<TypeShapeConfig>, pub constraints: Option<TypeConstraintsConfig>, pub enums: Option<TypeEnumsConfig>,
}
Expand description

Configuration for TypeMapper. Mirrors the [generator.types] TOML section. Defaults flip on every common typed scalar; opt out per format by setting the strategy to string in TOML.

Fields§

§date_time: DateStrategy§date: DateStrategy§time: DateStrategy§duration: DurationStrategy§uuid: UuidStrategy§byte: ByteStrategy§binary: BinaryStrategy§ipv4: IpStrategy§ipv6: IpStrategy§uri: UriStrategy§email: EmailStrategy§unsigned: bool

Q2.1: honor format: uint32 / uint64 integer formats and map them to u32 / u64 respectively. Default true (cheap, no extra crate). Set false to revert to the pre-Q2.1 behavior where unsigned formats degraded to i64.

§format_aliases: BTreeMap<String, String>

Q2.2: user-extensible format aliases applied before standard format dispatch (e.g. "uuid4" -> "uuid", "unix-time" -> "int64"). Built-in defaults are merged with user-supplied entries; user entries win on collision.

§shape: Option<TypeShapeConfig>

Object/array shape toggles. Filled in by Q2.3, Q2.5, Q2.7.

§constraints: Option<TypeConstraintsConfig>

Constraint annotation mode. Filled in by Q2.4.

§enums: Option<TypeEnumsConfig>

Vendor-extension toggles for enums. Filled in by Q2.6.

Implementations§

Source§

impl TypeMappingConfig

Source

pub fn constraint_mode(&self) -> ConstraintMode

Q2.4: constraint-doc emission mode. Defaults to ConstraintMode::Doc when the [generator.types.constraints] block is absent or its mode field is unset.

Source

pub fn x_enum_varnames_enabled(&self) -> bool

Q2.6: should x-enum-varnames override the heuristic PascalCase variant naming? Default true.

Source

pub fn x_enum_descriptions_enabled(&self) -> bool

Q2.6: should x-enum-descriptions emit per-variant doc comments? Default true.

Source

pub fn conservative() -> Self

Pre-Q2 behavior — every format renders as String and integer formats degrade to i64. Users opt in via --types-conservative when bisecting regressions introduced by typed-scalar adoption.

Trait Implementations§

Source§

impl Clone for TypeMappingConfig

Source§

fn clone(&self) -> TypeMappingConfig

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 TypeMappingConfig

Source§

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

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

impl Default for TypeMappingConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for TypeMappingConfig

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 TypeMappingConfig

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more