pub struct SerdeSchema {Show 13 fields
pub metadata: Option<BTreeMap<String, Value>>,
pub definitions: Option<BTreeMap<String, SerdeSchema>>,
pub nullable: Option<bool>,
pub ref_: Option<String>,
pub type_: Option<String>,
pub enum_: Option<Vec<String>>,
pub elements: Option<Box<SerdeSchema>>,
pub properties: Option<BTreeMap<String, SerdeSchema>>,
pub optional_properties: Option<BTreeMap<String, SerdeSchema>>,
pub additional_properties: Option<bool>,
pub values: Option<Box<SerdeSchema>>,
pub discriminator: Option<String>,
pub mapping: Option<BTreeMap<String, SerdeSchema>>,
}
Expand description
A JSON representation of JSON Typedef schemas, compatible with serde_json
.
To convert this into a Schema
, see
Schema::from_serde_schema
.
use jtd::SerdeSchema;
use serde_json::json;
assert_eq!(
SerdeSchema { type_: Some("uint8".to_owned()), ..Default::default() },
serde_json::from_value::<SerdeSchema>(json!({ "type": "uint8" })).unwrap()
)
Fields§
§metadata: Option<BTreeMap<String, Value>>
§definitions: Option<BTreeMap<String, SerdeSchema>>
§nullable: Option<bool>
§ref_: Option<String>
§type_: Option<String>
§enum_: Option<Vec<String>>
§elements: Option<Box<SerdeSchema>>
§properties: Option<BTreeMap<String, SerdeSchema>>
§optional_properties: Option<BTreeMap<String, SerdeSchema>>
§additional_properties: Option<bool>
§values: Option<Box<SerdeSchema>>
§discriminator: Option<String>
§mapping: Option<BTreeMap<String, SerdeSchema>>
Trait Implementations§
Source§impl Clone for SerdeSchema
impl Clone for SerdeSchema
Source§fn clone(&self) -> SerdeSchema
fn clone(&self) -> SerdeSchema
Returns a duplicate of the value. Read more
1.0.0 · 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 SerdeSchema
impl Debug for SerdeSchema
Source§impl Default for SerdeSchema
impl Default for SerdeSchema
Source§fn default() -> SerdeSchema
fn default() -> SerdeSchema
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for SerdeSchema
impl<'de> Deserialize<'de> for SerdeSchema
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
Source§impl PartialEq for SerdeSchema
impl PartialEq for SerdeSchema
Source§impl Serialize for SerdeSchema
impl Serialize for SerdeSchema
impl StructuralPartialEq for SerdeSchema
Auto Trait Implementations§
impl Freeze for SerdeSchema
impl RefUnwindSafe for SerdeSchema
impl Send for SerdeSchema
impl Sync for SerdeSchema
impl Unpin for SerdeSchema
impl UnwindSafe for SerdeSchema
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