pub enum SchemaType {
Primitive {
rust_type: String,
serde_with: Option<String>,
},
Object {
properties: BTreeMap<String, PropertyInfo>,
required: HashSet<String>,
additional_properties: ObjectAdditionalProperties,
variant: Option<SchemaRef>,
},
DiscriminatedUnion {
discriminator_field: String,
variants: Vec<UnionVariant>,
},
Union {
variants: Vec<SchemaRef>,
},
Array {
item_type: Box<SchemaType>,
},
Tuple {
element_types: Vec<SchemaType>,
},
StringEnum {
values: Vec<String>,
},
ExtensibleEnum {
known_values: Vec<String>,
},
Composition {
schemas: Vec<SchemaRef>,
},
Reference {
target: String,
},
Untyped {
shape: UntypedShape,
reason: UntypedReason,
},
}Variants§
Primitive
Simple primitive type. serde_with carries an optional
#[serde(with = "<path>")] codec hint produced by the
TypeMapper for typed scalars (e.g. format: byte →
Vec<u8> + base64_serde); the generator wraps this in a
field-level with = ... attribute.
Object
Object with properties
DiscriminatedUnion
Discriminated union (oneOf + discriminator)
Union
Simple union (anyOf without discriminator)
Array
Array type
Fields
item_type: Box<SchemaType>Tuple
Fixed-arity array — one schema per position, no extras — rendered as a
Rust tuple. Only emitted when the spec proves the length (see
SchemaDetails::positional_items_are_exact); an open prefixItems
stays an Array, because serde would reject the extra elements the
spec allows.
Fields
element_types: Vec<SchemaType>StringEnum
String enum
ExtensibleEnum
Extensible enum with known values and custom variant
Composition
Schema composition (allOf)
Reference
Reference to another schema
Untyped
A value the generator could not type, rendered as serde_json::Value.
The reason travels with the type rather than in a side table, so the census counts what is actually generated: a schema analyzed once but referenced by fifty properties yields fifty untyped fields, and one that is pruned yields none.
Implementations§
Source§impl SchemaType
impl SchemaType
Sourcepub fn renders_inline(&self) -> bool
pub fn renders_inline(&self) -> bool
Whether the generator can render this type directly in a field or element position.
The other variants name something that must be generated as its own
item — a struct, an enum, a union — so a field can only hold them by
reference. Analysis hoists those and leaves a
SchemaType::Reference; anything that reaches the generator
un-hoisted is rendered as serde_json::Value, losing the type the
schema had. UntypedReason::inline_drop names those cases so the
census can count them.
Trait Implementations§
Source§impl Clone for SchemaType
impl Clone for SchemaType
Source§fn clone(&self) -> SchemaType
fn clone(&self) -> SchemaType
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more