pub struct TypeMapper { /* private fields */ }Implementations§
Source§impl TypeMapper
impl TypeMapper
pub fn new(config: TypeMappingConfig) -> Self
Sourcepub fn used_features(&self) -> UsedFeatures
pub fn used_features(&self) -> UsedFeatures
Snapshot of crates this mapper has emitted references to.
Read after generation by Q2.8 to write REQUIRED_DEPS.toml.
Sourcepub fn config(&self) -> &TypeMappingConfig
pub fn config(&self) -> &TypeMappingConfig
Borrow the underlying type-mapping config — useful for
non-format-mapping toggles (shape, enums, constraints)
that other modules need to inspect.
Sourcepub fn config_shape_primitive_unions(&self) -> Option<bool>
pub fn config_shape_primitive_unions(&self) -> Option<bool>
Q2.7 helper: should anyOf of primitives become an untagged
enum with primitive variant types directly (true), or fall
back to the pre-Q2.7 type-alias-per-variant shape (false)?
Default: true.
Sourcepub fn config_shape_additional_properties_typed(&self) -> Option<bool>
pub fn config_shape_additional_properties_typed(&self) -> Option<bool>
Q2.3 helper: should additionalProperties: <schema> produce
BTreeMap<String, T> (true) or degrade to BTreeMap<String, serde_json::Value> (false)? Default: true.
Sourcepub fn config_constraint_mode(&self) -> ConstraintMode
pub fn config_constraint_mode(&self) -> ConstraintMode
Q2.4 helper: which constraint-annotation mode is active?
Defaults to ConstraintMode::Doc when the
[generator.types.constraints] block is absent or its mode
field is unset.
Sourcepub fn string_format(&self, format: Option<&str>) -> MappedType
pub fn string_format(&self, format: Option<&str>) -> MappedType
Map string + optional format → typed Rust scalar.
Routing:
- Apply user-provided + built-in
format_aliases. - Dispatch on the normalized format.
- Honor each format’s strategy in
self.config. - Record any introduced crate in
used_features.
Sourcepub fn integer_format(&self, format: Option<&str>) -> MappedType
pub fn integer_format(&self, format: Option<&str>) -> MappedType
Map integer + optional format → Rust type.
Q2.1: honors uint32 / uint64 (and a few vendor variants
like uint) when config.unsigned is true (default).
Setting unsigned = false reverts to the pre-Q2.1 behavior
where unsigned formats degrade to i64.
pub fn number_format(&self, format: Option<&str>) -> MappedType
pub fn boolean(&self) -> MappedType
pub fn untyped_array(&self) -> MappedType
pub fn dynamic_json(&self) -> MappedType
pub fn null_unit(&self) -> MappedType
Sourcepub fn map(&self, ty: OpenApiSchemaType, details: &SchemaDetails) -> MappedType
pub fn map(&self, ty: OpenApiSchemaType, details: &SchemaDetails) -> MappedType
One-shot dispatch from (OpenApiSchemaType, &SchemaDetails).