|
| 1 | +#![allow(clippy::redundant_closure_call)] |
| 2 | +#![allow(clippy::needless_lifetimes)] |
| 3 | +#![allow(clippy::match_single_binding)] |
| 4 | +#![allow(clippy::clone_on_copy)] |
| 5 | + |
| 6 | +#[doc = r" Error types."] |
| 7 | +pub mod error { |
| 8 | + #[doc = r" Error from a `TryFrom` or `FromStr` implementation."] |
| 9 | + pub struct ConversionError(::std::borrow::Cow<'static, str>); |
| 10 | + impl ::std::error::Error for ConversionError {} |
| 11 | + impl ::std::fmt::Display for ConversionError { |
| 12 | + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> { |
| 13 | + ::std::fmt::Display::fmt(&self.0, f) |
| 14 | + } |
| 15 | + } |
| 16 | + impl ::std::fmt::Debug for ConversionError { |
| 17 | + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> { |
| 18 | + ::std::fmt::Debug::fmt(&self.0, f) |
| 19 | + } |
| 20 | + } |
| 21 | + impl From<&'static str> for ConversionError { |
| 22 | + fn from(value: &'static str) -> Self { |
| 23 | + Self(value.into()) |
| 24 | + } |
| 25 | + } |
| 26 | + impl From<String> for ConversionError { |
| 27 | + fn from(value: String) -> Self { |
| 28 | + Self(value.into()) |
| 29 | + } |
| 30 | + } |
| 31 | +} |
| 32 | +#[doc = "`Fruit`"] |
| 33 | +#[doc = r""] |
| 34 | +#[doc = r" <details><summary>JSON schema</summary>"] |
| 35 | +#[doc = r""] |
| 36 | +#[doc = r" ```json"] |
| 37 | +#[doc = "{"] |
| 38 | +#[doc = " \"type\": \"object\","] |
| 39 | +#[doc = " \"additionalProperties\": {"] |
| 40 | +#[doc = " \"type\": \"string\""] |
| 41 | +#[doc = " }"] |
| 42 | +#[doc = "}"] |
| 43 | +#[doc = r" ```"] |
| 44 | +#[doc = r" </details>"] |
| 45 | +#[extra_attr] |
| 46 | +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] |
| 47 | +#[serde(transparent)] |
| 48 | +pub struct Fruit(pub ::std::collections::HashMap<::std::string::String, ::std::string::String>); |
| 49 | +impl ::std::ops::Deref for Fruit { |
| 50 | + type Target = ::std::collections::HashMap<::std::string::String, ::std::string::String>; |
| 51 | + fn deref(&self) -> &::std::collections::HashMap<::std::string::String, ::std::string::String> { |
| 52 | + &self.0 |
| 53 | + } |
| 54 | +} |
| 55 | +impl ::std::convert::From<Fruit> |
| 56 | + for ::std::collections::HashMap<::std::string::String, ::std::string::String> |
| 57 | +{ |
| 58 | + fn from(value: Fruit) -> Self { |
| 59 | + value.0 |
| 60 | + } |
| 61 | +} |
| 62 | +impl ::std::convert::From<&Fruit> for Fruit { |
| 63 | + fn from(value: &Fruit) -> Self { |
| 64 | + value.clone() |
| 65 | + } |
| 66 | +} |
| 67 | +impl ::std::convert::From<::std::collections::HashMap<::std::string::String, ::std::string::String>> |
| 68 | + for Fruit |
| 69 | +{ |
| 70 | + fn from( |
| 71 | + value: ::std::collections::HashMap<::std::string::String, ::std::string::String>, |
| 72 | + ) -> Self { |
| 73 | + Self(value) |
| 74 | + } |
| 75 | +} |
| 76 | +#[doc = "`FruitOrVeg`"] |
| 77 | +#[doc = r""] |
| 78 | +#[doc = r" <details><summary>JSON schema</summary>"] |
| 79 | +#[doc = r""] |
| 80 | +#[doc = r" ```json"] |
| 81 | +#[doc = "{"] |
| 82 | +#[doc = " \"oneOf\": ["] |
| 83 | +#[doc = " {"] |
| 84 | +#[doc = " \"title\": \"veg\","] |
| 85 | +#[doc = " \"anyOf\": ["] |
| 86 | +#[doc = " {"] |
| 87 | +#[doc = " \"$ref\": \"#/defs/veggie\""] |
| 88 | +#[doc = " }"] |
| 89 | +#[doc = " ]"] |
| 90 | +#[doc = " },"] |
| 91 | +#[doc = " {"] |
| 92 | +#[doc = " \"title\": \"fruit\","] |
| 93 | +#[doc = " \"anyOf\": ["] |
| 94 | +#[doc = " {"] |
| 95 | +#[doc = " \"$ref\": \"#/defs/fruit\""] |
| 96 | +#[doc = " }"] |
| 97 | +#[doc = " ]"] |
| 98 | +#[doc = " }"] |
| 99 | +#[doc = " ]"] |
| 100 | +#[doc = "}"] |
| 101 | +#[doc = r" ```"] |
| 102 | +#[doc = r" </details>"] |
| 103 | +#[extra_attr] |
| 104 | +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] |
| 105 | +#[serde(untagged)] |
| 106 | +pub enum FruitOrVeg { |
| 107 | + Veg(Veggie), |
| 108 | + Fruit(Fruit), |
| 109 | +} |
| 110 | +impl ::std::convert::From<&Self> for FruitOrVeg { |
| 111 | + fn from(value: &FruitOrVeg) -> Self { |
| 112 | + value.clone() |
| 113 | + } |
| 114 | +} |
| 115 | +impl ::std::convert::From<Veggie> for FruitOrVeg { |
| 116 | + fn from(value: Veggie) -> Self { |
| 117 | + Self::Veg(value) |
| 118 | + } |
| 119 | +} |
| 120 | +impl ::std::convert::From<Fruit> for FruitOrVeg { |
| 121 | + fn from(value: Fruit) -> Self { |
| 122 | + Self::Fruit(value) |
| 123 | + } |
| 124 | +} |
| 125 | +#[doc = "`Veggie`"] |
| 126 | +#[doc = r""] |
| 127 | +#[doc = r" <details><summary>JSON schema</summary>"] |
| 128 | +#[doc = r""] |
| 129 | +#[doc = r" ```json"] |
| 130 | +#[doc = "{"] |
| 131 | +#[doc = " \"type\": \"object\","] |
| 132 | +#[doc = " \"required\": ["] |
| 133 | +#[doc = " \"veggieLike\","] |
| 134 | +#[doc = " \"veggieName\""] |
| 135 | +#[doc = " ],"] |
| 136 | +#[doc = " \"properties\": {"] |
| 137 | +#[doc = " \"veggieLike\": {"] |
| 138 | +#[doc = " \"description\": \"Do I like this vegetable?\","] |
| 139 | +#[doc = " \"type\": \"boolean\""] |
| 140 | +#[doc = " },"] |
| 141 | +#[doc = " \"veggieName\": {"] |
| 142 | +#[doc = " \"description\": \"The name of the vegetable.\","] |
| 143 | +#[doc = " \"type\": \"string\""] |
| 144 | +#[doc = " }"] |
| 145 | +#[doc = " }"] |
| 146 | +#[doc = "}"] |
| 147 | +#[doc = r" ```"] |
| 148 | +#[doc = r" </details>"] |
| 149 | +#[extra_attr] |
| 150 | +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] |
| 151 | +pub struct Veggie { |
| 152 | + #[doc = "Do I like this vegetable?"] |
| 153 | + #[serde(rename = "veggieLike")] |
| 154 | + pub veggie_like: bool, |
| 155 | + #[doc = "The name of the vegetable."] |
| 156 | + #[serde(rename = "veggieName")] |
| 157 | + pub veggie_name: ::std::string::String, |
| 158 | +} |
| 159 | +impl ::std::convert::From<&Veggie> for Veggie { |
| 160 | + fn from(value: &Veggie) -> Self { |
| 161 | + value.clone() |
| 162 | + } |
| 163 | +} |
| 164 | +#[doc = "A representation of a person, company, organization, or place"] |
| 165 | +#[doc = r""] |
| 166 | +#[doc = r" <details><summary>JSON schema</summary>"] |
| 167 | +#[doc = r""] |
| 168 | +#[doc = r" ```json"] |
| 169 | +#[doc = "{"] |
| 170 | +#[doc = " \"$id\": \"https://example.com/arrays.schema.json\","] |
| 171 | +#[doc = " \"title\": \"veggies\","] |
| 172 | +#[doc = " \"description\": \"A representation of a person, company, organization, or place\","] |
| 173 | +#[doc = " \"type\": \"object\","] |
| 174 | +#[doc = " \"properties\": {"] |
| 175 | +#[doc = " \"fruits\": {"] |
| 176 | +#[doc = " \"type\": \"array\","] |
| 177 | +#[doc = " \"items\": {"] |
| 178 | +#[doc = " \"type\": \"string\""] |
| 179 | +#[doc = " }"] |
| 180 | +#[doc = " },"] |
| 181 | +#[doc = " \"vegetables\": {"] |
| 182 | +#[doc = " \"type\": \"array\","] |
| 183 | +#[doc = " \"items\": {"] |
| 184 | +#[doc = " \"$ref\": \"#/$defs/veggie\""] |
| 185 | +#[doc = " }"] |
| 186 | +#[doc = " }"] |
| 187 | +#[doc = " }"] |
| 188 | +#[doc = "}"] |
| 189 | +#[doc = r" ```"] |
| 190 | +#[doc = r" </details>"] |
| 191 | +#[extra_attr] |
| 192 | +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] |
| 193 | +pub struct Veggies { |
| 194 | + #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")] |
| 195 | + pub fruits: ::std::vec::Vec<::std::string::String>, |
| 196 | + #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")] |
| 197 | + pub vegetables: ::std::vec::Vec<Veggie>, |
| 198 | +} |
| 199 | +impl ::std::convert::From<&Veggies> for Veggies { |
| 200 | + fn from(value: &Veggies) -> Self { |
| 201 | + value.clone() |
| 202 | + } |
| 203 | +} |
| 204 | +impl ::std::default::Default for Veggies { |
| 205 | + fn default() -> Self { |
| 206 | + Self { |
| 207 | + fruits: Default::default(), |
| 208 | + vegetables: Default::default(), |
| 209 | + } |
| 210 | + } |
| 211 | +} |
0 commit comments