pub struct SchemaDetails {Show 53 fields
pub description: Option<String>,
pub nullable: Option<bool>,
pub recursive_anchor: Option<bool>,
pub dynamic_anchor: Option<String>,
pub schema_id: Option<String>,
pub enum_values: Option<Vec<Value>>,
pub format: Option<String>,
pub default: Option<Value>,
pub const_value: Option<Value>,
pub properties: Option<BTreeMap<String, Schema>>,
pub required: Option<Vec<String>>,
pub additional_properties: Option<AdditionalProperties>,
pub items: Option<Box<Schema>>,
pub minimum: Option<f64>,
pub maximum: Option<f64>,
pub min_length: Option<u64>,
pub max_length: Option<u64>,
pub pattern: Option<String>,
pub exclusive_minimum: Option<ExclusiveBound>,
pub exclusive_maximum: Option<ExclusiveBound>,
pub multiple_of: Option<f64>,
pub min_items: Option<u64>,
pub max_items: Option<u64>,
pub unique_items: Option<bool>,
pub min_properties: Option<u64>,
pub max_properties: Option<u64>,
pub prefix_items: Option<Vec<Schema>>,
pub contains: Option<Box<Schema>>,
pub min_contains: Option<u64>,
pub max_contains: Option<u64>,
pub pattern_properties: Option<BTreeMap<String, Schema>>,
pub property_names: Option<Box<Schema>>,
pub unevaluated_properties: Option<AdditionalProperties>,
pub unevaluated_items: Option<AdditionalProperties>,
pub dependent_required: Option<BTreeMap<String, Vec<String>>>,
pub dependent_schemas: Option<BTreeMap<String, Schema>>,
pub content_encoding: Option<String>,
pub content_media_type: Option<String>,
pub content_schema: Option<Box<Schema>>,
pub if_schema: Option<Box<Schema>>,
pub then_schema: Option<Box<Schema>>,
pub else_schema: Option<Box<Schema>>,
pub not: Option<Box<Schema>>,
pub title: Option<String>,
pub deprecated: Option<bool>,
pub read_only: Option<bool>,
pub write_only: Option<bool>,
pub examples: Option<Vec<Value>>,
pub example: Option<Value>,
pub comment: Option<String>,
pub schema_keyword: Option<String>,
pub defs: Option<BTreeMap<String, Schema>>,
pub extra: BTreeMap<String, Value>,
}Fields§
§description: Option<String>§nullable: Option<bool>§recursive_anchor: Option<bool>§dynamic_anchor: Option<String>§schema_id: Option<String>§enum_values: Option<Vec<Value>>§format: Option<String>§default: Option<Value>§const_value: Option<Value>§properties: Option<BTreeMap<String, Schema>>§required: Option<Vec<String>>§additional_properties: Option<AdditionalProperties>§items: Option<Box<Schema>>§minimum: Option<f64>§maximum: Option<f64>§min_length: Option<u64>§max_length: Option<u64>§pattern: Option<String>§exclusive_minimum: Option<ExclusiveBound>In 3.0/Swagger this was a bool flag relative to minimum; in 3.1
(JSON Schema 2020-12) it’s a number. Accept either to round-trip
real-world specs. (Tracked under J3 — proper validation lowering.)
exclusive_maximum: Option<ExclusiveBound>§multiple_of: Option<f64>§min_items: Option<u64>§max_items: Option<u64>§unique_items: Option<bool>§min_properties: Option<u64>§max_properties: Option<u64>§prefix_items: Option<Vec<Schema>>§contains: Option<Box<Schema>>§min_contains: Option<u64>§max_contains: Option<u64>§pattern_properties: Option<BTreeMap<String, Schema>>§property_names: Option<Box<Schema>>§unevaluated_properties: Option<AdditionalProperties>§unevaluated_items: Option<AdditionalProperties>§dependent_required: Option<BTreeMap<String, Vec<String>>>§dependent_schemas: Option<BTreeMap<String, Schema>>§content_encoding: Option<String>§content_media_type: Option<String>§content_schema: Option<Box<Schema>>§if_schema: Option<Box<Schema>>§then_schema: Option<Box<Schema>>§else_schema: Option<Box<Schema>>§not: Option<Box<Schema>>§title: Option<String>§deprecated: Option<bool>§read_only: Option<bool>§write_only: Option<bool>§examples: Option<Vec<Value>>§example: Option<Value>§comment: Option<String>JSON Schema annotation $comment.
schema_keyword: Option<String>§defs: Option<BTreeMap<String, Schema>>§extra: BTreeMap<String, Value>Implementations§
Source§impl SchemaDetails
impl SchemaDetails
Sourcepub fn is_nullable(&self) -> bool
pub fn is_nullable(&self) -> bool
Check if this schema is nullable
Sourcepub fn is_string_enum(&self) -> bool
pub fn is_string_enum(&self) -> bool
Check if this is a string enum
A standalone string const (no enum array) is treated as a
degenerate single-value enum so the generator emits a tightly-typed
single-variant enum instead of a bare String. See issue #10.
Sourcepub fn string_enum_values(&self) -> Option<Vec<String>>
pub fn string_enum_values(&self) -> Option<Vec<String>>
Get enum values as strings if this is a string enum.
Falls back to [const_value] when enum is absent but const is a
string, so a property like { "type": "string", "const": "X" }
produces a single-variant enum.
Sourcepub fn is_field_required(&self, field_name: &str) -> bool
pub fn is_field_required(&self, field_name: &str) -> bool
Check if a field is required
Trait Implementations§
Source§impl Clone for SchemaDetails
impl Clone for SchemaDetails
Source§fn clone(&self) -> SchemaDetails
fn clone(&self) -> SchemaDetails
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SchemaDetails
impl Debug for SchemaDetails
Source§impl Default for SchemaDetails
impl Default for SchemaDetails
Source§fn default() -> SchemaDetails
fn default() -> SchemaDetails
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for SchemaDetails
impl<'de> Deserialize<'de> for SchemaDetails
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for SchemaDetails
impl RefUnwindSafe for SchemaDetails
impl Send for SchemaDetails
impl Sync for SchemaDetails
impl Unpin for SchemaDetails
impl UnsafeUnpin for SchemaDetails
impl UnwindSafe for SchemaDetails
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