1 1 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 2 | #[::pyo3::pyclass]
|
3 - | /// :param path str:
|
4 - | /// :param message str:
|
5 3 | /// :rtype None:
|
6 - | /// Describes one specific validation failure for an input member.
|
4 + | #[allow(missing_docs)] // documentation missing in model
|
7 5 | #[derive(
|
8 6 | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
9 7 | )]
|
10 - | pub struct ValidationExceptionField {
|
11 - | #[pyo3(get, set)]
|
12 - | /// :type str:
|
13 - | /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
|
14 - | pub path: ::std::string::String,
|
15 - | #[pyo3(get, set)]
|
16 - | /// :type str:
|
17 - | /// A detailed description of the validation failure.
|
18 - | pub message: ::std::string::String,
|
19 - | }
|
20 - | impl ValidationExceptionField {
|
21 - | /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
|
22 - | pub fn path(&self) -> &str {
|
23 - | use std::ops::Deref;
|
24 - | self.path.deref()
|
25 - | }
|
26 - | /// A detailed description of the validation failure.
|
27 - | pub fn message(&self) -> &str {
|
28 - | use std::ops::Deref;
|
29 - | self.message.deref()
|
30 - | }
|
31 - | }
|
8 + | pub struct EmptyStruct {}
|
32 9 | #[allow(clippy::new_without_default)]
|
33 10 | #[allow(clippy::too_many_arguments)]
|
34 11 | #[::pyo3::pymethods]
|
35 - | impl ValidationExceptionField {
|
12 + | impl EmptyStruct {
|
36 13 | #[new]
|
37 - | pub fn new(path: ::std::string::String, message: ::std::string::String) -> Self {
|
38 - | Self { path, message }
|
14 + | pub fn new() -> Self {
|
15 + | Self {}
|
39 16 | }
|
40 17 | fn __repr__(&self) -> String {
|
41 18 | format!("{self:?}")
|
42 19 | }
|
43 20 | fn __str__(&self) -> String {
|
44 21 | format!("{self:?}")
|
45 22 | }
|
46 23 | }
|
47 - | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<ValidationExceptionField> {
|
24 + | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<EmptyStruct> {
|
48 25 | fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
49 - | ob.extract::<ValidationExceptionField>().map(Box::new)
|
26 + | ob.extract::<EmptyStruct>().map(Box::new)
|
50 27 | }
|
51 28 | }
|
52 29 |
|
53 - | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<ValidationExceptionField> {
|
30 + | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<EmptyStruct> {
|
54 31 | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
55 32 | (*self).into_py(py)
|
56 33 | }
|
57 34 | }
|
58 - | impl ValidationExceptionField {
|
59 - | /// Creates a new builder-style object to manufacture [`ValidationExceptionField`](crate::model::ValidationExceptionField).
|
60 - | pub fn builder() -> crate::model::validation_exception_field::Builder {
|
61 - | crate::model::validation_exception_field::Builder::default()
|
35 + | impl crate::constrained::Constrained for crate::model::EmptyStruct {
|
36 + | type Unconstrained = crate::model::empty_struct_internal::Builder;
|
37 + | }
|
38 + | impl EmptyStruct {
|
39 + | /// Creates a new builder-style object to manufacture [`EmptyStruct`](crate::model::EmptyStruct).
|
40 + | pub fn builder() -> crate::model::empty_struct::Builder {
|
41 + | crate::model::empty_struct::Builder::default()
|
62 42 | }
|
63 43 | }
|
64 44 |
|
65 - | /// A union with a representative set of types for members.
|
66 - | #[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
67 - | pub enum MyUnion {
|
45 + | #[::pyo3::pyclass]
|
46 + | /// :param blob typing.Optional\[json_rpc11.types.Blob\]:
|
47 + | /// :param boolean typing.Optional\[bool\]:
|
48 + | /// :param double typing.Optional\[float\]:
|
49 + | /// :param empty_struct typing.Optional\[json_rpc11.model.EmptyStruct\]:
|
50 + | /// :param float typing.Optional\[float\]:
|
51 + | /// :param httpdate_timestamp typing.Optional\[json_rpc11.types.DateTime\]:
|
52 + | /// :param integer typing.Optional\[int\]:
|
53 + | /// :param iso8601_timestamp typing.Optional\[json_rpc11.types.DateTime\]:
|
54 + | /// :param json_value typing.Optional\[str\]:
|
55 + | /// :param list_of_lists typing.Optional\[typing.List\[typing.List\[str\]\]\]:
|
56 + | /// :param list_of_maps_of_strings typing.Optional\[typing.List\[typing.Dict\[str, str\]\]\]:
|
57 + | /// :param list_of_strings typing.Optional\[typing.List\[str\]\]:
|
58 + | /// :param list_of_structs typing.Optional\[typing.List\[json_rpc11.model.SimpleStruct\]\]:
|
59 + | /// :param long typing.Optional\[int\]:
|
60 + | /// :param map_of_lists_of_strings typing.Optional\[typing.Dict\[str, typing.List\[str\]\]\]:
|
61 + | /// :param map_of_maps typing.Optional\[typing.Dict\[str, typing.Dict\[str, str\]\]\]:
|
62 + | /// :param map_of_strings typing.Optional\[typing.Dict\[str, str\]\]:
|
63 + | /// :param map_of_structs typing.Optional\[typing.Dict\[str, json_rpc11.model.SimpleStruct\]\]:
|
64 + | /// :param recursive_list typing.Optional\[typing.List\[json_rpc11.model.KitchenSink\]\]:
|
65 + | /// :param recursive_map typing.Optional\[typing.Dict\[str, json_rpc11.model.KitchenSink\]\]:
|
66 + | /// :param recursive_struct typing.Optional\[json_rpc11.model.KitchenSink\]:
|
67 + | /// :param simple_struct typing.Optional\[json_rpc11.model.SimpleStruct\]:
|
68 + | /// :param string typing.Optional\[str\]:
|
69 + | /// :param struct_with_json_name typing.Optional\[json_rpc11.model.StructWithJsonName\]:
|
70 + | /// :param timestamp typing.Optional\[json_rpc11.types.DateTime\]:
|
71 + | /// :param unix_timestamp typing.Optional\[json_rpc11.types.DateTime\]:
|
72 + | /// :rtype None:
|
73 + | #[allow(missing_docs)] // documentation missing in model
|
74 + | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
75 + | pub struct KitchenSink {
|
76 + | #[pyo3(get, set)]
|
77 + | /// :type typing.Optional\[json_rpc11.types.Blob\]:
|
68 78 | #[allow(missing_docs)] // documentation missing in model
|
69 - | BlobValue(::aws_smithy_http_server_python::types::Blob),
|
79 + | pub blob: ::std::option::Option<::aws_smithy_http_server_python::types::Blob>,
|
80 + | #[pyo3(get, set)]
|
81 + | /// :type typing.Optional\[bool\]:
|
70 82 | #[allow(missing_docs)] // documentation missing in model
|
71 - | BooleanValue(bool),
|
83 + | pub boolean: ::std::option::Option<bool>,
|
84 + | #[pyo3(get, set)]
|
85 + | /// :type typing.Optional\[float\]:
|
72 86 | #[allow(missing_docs)] // documentation missing in model
|
73 - | EnumValue(crate::model::FooEnum),
|
87 + | pub double: ::std::option::Option<f64>,
|
88 + | #[pyo3(get, set)]
|
89 + | /// :type typing.Optional\[json_rpc11.model.EmptyStruct\]:
|
74 90 | #[allow(missing_docs)] // documentation missing in model
|
75 - | ListValue(::std::vec::Vec<::std::string::String>),
|
91 + | pub empty_struct: ::std::option::Option<crate::model::EmptyStruct>,
|
92 + | #[pyo3(get, set)]
|
93 + | /// :type typing.Optional\[float\]:
|
76 94 | #[allow(missing_docs)] // documentation missing in model
|
77 - | MapValue(::std::collections::HashMap<::std::string::String, ::std::string::String>),
|
95 + | pub float: ::std::option::Option<f32>,
|
96 + | #[pyo3(get, set)]
|
97 + | /// :type typing.Optional\[json_rpc11.types.DateTime\]:
|
78 98 | #[allow(missing_docs)] // documentation missing in model
|
79 - | NumberValue(i32),
|
99 + | pub httpdate_timestamp: ::std::option::Option<::aws_smithy_http_server_python::types::DateTime>,
|
100 + | #[pyo3(get, set)]
|
101 + | /// :type typing.Optional\[int\]:
|
80 102 | #[allow(missing_docs)] // documentation missing in model
|
81 - | StringValue(::std::string::String),
|
103 + | pub integer: ::std::option::Option<i32>,
|
104 + | #[pyo3(get, set)]
|
105 + | /// :type typing.Optional\[json_rpc11.types.DateTime\]:
|
82 106 | #[allow(missing_docs)] // documentation missing in model
|
83 - | StructureValue(crate::model::GreetingStruct),
|
107 + | pub iso8601_timestamp: ::std::option::Option<::aws_smithy_http_server_python::types::DateTime>,
|
108 + | #[pyo3(get, set)]
|
109 + | /// :type typing.Optional\[str\]:
|
84 110 | #[allow(missing_docs)] // documentation missing in model
|
85 - | TimestampValue(::aws_smithy_http_server_python::types::DateTime),
|
111 + | pub json_value: ::std::option::Option<::std::string::String>,
|
112 + | #[pyo3(get, set)]
|
113 + | /// :type typing.Optional\[typing.List\[typing.List\[str\]\]\]:
|
114 + | #[allow(missing_docs)] // documentation missing in model
|
115 + | pub list_of_lists:
|
116 + | ::std::option::Option<::std::vec::Vec<::std::vec::Vec<::std::string::String>>>,
|
117 + | #[pyo3(get, set)]
|
118 + | /// :type typing.Optional\[typing.List\[typing.Dict\[str, str\]\]\]:
|
119 + | #[allow(missing_docs)] // documentation missing in model
|
120 + | pub list_of_maps_of_strings: ::std::option::Option<
|
121 + | ::std::vec::Vec<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
|
122 + | >,
|
123 + | #[pyo3(get, set)]
|
124 + | /// :type typing.Optional\[typing.List\[str\]\]:
|
125 + | #[allow(missing_docs)] // documentation missing in model
|
126 + | pub list_of_strings: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
|
127 + | #[pyo3(get, set)]
|
128 + | /// :type typing.Optional\[typing.List\[json_rpc11.model.SimpleStruct\]\]:
|
129 + | #[allow(missing_docs)] // documentation missing in model
|
130 + | pub list_of_structs: ::std::option::Option<::std::vec::Vec<crate::model::SimpleStruct>>,
|
131 + | #[pyo3(get, set)]
|
132 + | /// :type typing.Optional\[int\]:
|
133 + | #[allow(missing_docs)] // documentation missing in model
|
134 + | pub long: ::std::option::Option<i64>,
|
135 + | #[pyo3(get, set)]
|
136 + | /// :type typing.Optional\[typing.Dict\[str, typing.List\[str\]\]\]:
|
137 + | #[allow(missing_docs)] // documentation missing in model
|
138 + | pub map_of_lists_of_strings: ::std::option::Option<
|
139 + | ::std::collections::HashMap<::std::string::String, ::std::vec::Vec<::std::string::String>>,
|
140 + | >,
|
141 + | #[pyo3(get, set)]
|
142 + | /// :type typing.Optional\[typing.Dict\[str, typing.Dict\[str, str\]\]\]:
|
143 + | #[allow(missing_docs)] // documentation missing in model
|
144 + | pub map_of_maps: ::std::option::Option<
|
145 + | ::std::collections::HashMap<
|
146 + | ::std::string::String,
|
147 + | ::std::collections::HashMap<::std::string::String, ::std::string::String>,
|
148 + | >,
|
149 + | >,
|
150 + | #[pyo3(get, set)]
|
151 + | /// :type typing.Optional\[typing.Dict\[str, str\]\]:
|
152 + | #[allow(missing_docs)] // documentation missing in model
|
153 + | pub map_of_strings: ::std::option::Option<
|
154 + | ::std::collections::HashMap<::std::string::String, ::std::string::String>,
|
155 + | >,
|
156 + | #[pyo3(get, set)]
|
157 + | /// :type typing.Optional\[typing.Dict\[str, json_rpc11.model.SimpleStruct\]\]:
|
158 + | #[allow(missing_docs)] // documentation missing in model
|
159 + | pub map_of_structs: ::std::option::Option<
|
160 + | ::std::collections::HashMap<::std::string::String, crate::model::SimpleStruct>,
|
161 + | >,
|
162 + | #[pyo3(get, set)]
|
163 + | /// :type typing.Optional\[typing.List\[json_rpc11.model.KitchenSink\]\]:
|
164 + | #[allow(missing_docs)] // documentation missing in model
|
165 + | pub recursive_list: ::std::option::Option<::std::vec::Vec<crate::model::KitchenSink>>,
|
166 + | #[pyo3(get, set)]
|
167 + | /// :type typing.Optional\[typing.Dict\[str, json_rpc11.model.KitchenSink\]\]:
|
168 + | #[allow(missing_docs)] // documentation missing in model
|
169 + | pub recursive_map: ::std::option::Option<
|
170 + | ::std::collections::HashMap<::std::string::String, crate::model::KitchenSink>,
|
171 + | >,
|
172 + | #[pyo3(get, set)]
|
173 + | /// :type typing.Optional\[json_rpc11.model.KitchenSink\]:
|
174 + | #[allow(missing_docs)] // documentation missing in model
|
175 + | pub recursive_struct: ::std::option::Option<::std::boxed::Box<crate::model::KitchenSink>>,
|
176 + | #[pyo3(get, set)]
|
177 + | /// :type typing.Optional\[json_rpc11.model.SimpleStruct\]:
|
178 + | #[allow(missing_docs)] // documentation missing in model
|
179 + | pub simple_struct: ::std::option::Option<crate::model::SimpleStruct>,
|
180 + | #[pyo3(get, set)]
|
181 + | /// :type typing.Optional\[str\]:
|
182 + | #[allow(missing_docs)] // documentation missing in model
|
183 + | pub string: ::std::option::Option<::std::string::String>,
|
184 + | #[pyo3(get, set)]
|
185 + | /// :type typing.Optional\[json_rpc11.model.StructWithJsonName\]:
|
186 + | #[allow(missing_docs)] // documentation missing in model
|
187 + | pub struct_with_json_name: ::std::option::Option<crate::model::StructWithJsonName>,
|
188 + | #[pyo3(get, set)]
|
189 + | /// :type typing.Optional\[json_rpc11.types.DateTime\]:
|
190 + | #[allow(missing_docs)] // documentation missing in model
|
191 + | pub timestamp: ::std::option::Option<::aws_smithy_http_server_python::types::DateTime>,
|
192 + | #[pyo3(get, set)]
|
193 + | /// :type typing.Optional\[json_rpc11.types.DateTime\]:
|
194 + | #[allow(missing_docs)] // documentation missing in model
|
195 + | pub unix_timestamp: ::std::option::Option<::aws_smithy_http_server_python::types::DateTime>,
|
86 196 | }
|
87 - | impl MyUnion {
|
88 - | /// Tries to convert the enum instance into [`BlobValue`](crate::model::MyUnion::BlobValue), extracting the inner [`Blob`](::aws_smithy_http_server_python::types::Blob).
|
89 - | /// Returns `Err(&Self)` if it can't be converted.
|
90 - | pub fn as_blob_value(
|
91 - | &self,
|
92 - | ) -> ::std::result::Result<&::aws_smithy_http_server_python::types::Blob, &Self> {
|
93 - | if let MyUnion::BlobValue(val) = &self {
|
94 - | ::std::result::Result::Ok(val)
|
95 - | } else {
|
96 - | ::std::result::Result::Err(self)
|
97 - | }
|
197 + | impl KitchenSink {
|
198 + | #[allow(missing_docs)] // documentation missing in model
|
199 + | pub fn blob(&self) -> ::std::option::Option<&::aws_smithy_http_server_python::types::Blob> {
|
200 + | self.blob.as_ref()
|
98 201 | }
|
99 - | /// Returns true if this is a [`BlobValue`](crate::model::MyUnion::BlobValue).
|
100 - | pub fn is_blob_value(&self) -> bool {
|
101 - | self.as_blob_value().is_ok()
|
202 + | #[allow(missing_docs)] // documentation missing in model
|
203 + | pub fn boolean(&self) -> ::std::option::Option<bool> {
|
204 + | self.boolean
|
102 205 | }
|
103 - | /// Tries to convert the enum instance into [`BooleanValue`](crate::model::MyUnion::BooleanValue), extracting the inner [`bool`](bool).
|
104 - | /// Returns `Err(&Self)` if it can't be converted.
|
105 - | pub fn as_boolean_value(&self) -> ::std::result::Result<&bool, &Self> {
|
106 - | if let MyUnion::BooleanValue(val) = &self {
|
107 - | ::std::result::Result::Ok(val)
|
108 - | } else {
|
109 - | ::std::result::Result::Err(self)
|
206 + | #[allow(missing_docs)] // documentation missing in model
|
207 + | pub fn double(&self) -> ::std::option::Option<f64> {
|
208 + | self.double
|
110 209 | }
|
210 + | #[allow(missing_docs)] // documentation missing in model
|
211 + | pub fn empty_struct(&self) -> ::std::option::Option<&crate::model::EmptyStruct> {
|
212 + | self.empty_struct.as_ref()
|
111 213 | }
|
112 - | /// Returns true if this is a [`BooleanValue`](crate::model::MyUnion::BooleanValue).
|
113 - | pub fn is_boolean_value(&self) -> bool {
|
114 - | self.as_boolean_value().is_ok()
|
214 + | #[allow(missing_docs)] // documentation missing in model
|
215 + | pub fn float(&self) -> ::std::option::Option<f32> {
|
216 + | self.float
|
115 217 | }
|
116 - | /// Tries to convert the enum instance into [`EnumValue`](crate::model::MyUnion::EnumValue), extracting the inner [`FooEnum`](crate::model::FooEnum).
|
117 - | /// Returns `Err(&Self)` if it can't be converted.
|
118 - | pub fn as_enum_value(&self) -> ::std::result::Result<&crate::model::FooEnum, &Self> {
|
119 - | if let MyUnion::EnumValue(val) = &self {
|
120 - | ::std::result::Result::Ok(val)
|
121 - | } else {
|
122 - | ::std::result::Result::Err(self)
|
123 - | }
|
124 - | }
|
125 - | /// Returns true if this is a [`EnumValue`](crate::model::MyUnion::EnumValue).
|
126 - | pub fn is_enum_value(&self) -> bool {
|
127 - | self.as_enum_value().is_ok()
|
128 - | }
|
129 - | /// Tries to convert the enum instance into [`ListValue`](crate::model::MyUnion::ListValue), extracting the inner [`Vec`](::std::vec::Vec).
|
130 - | /// Returns `Err(&Self)` if it can't be converted.
|
131 - | pub fn as_list_value(
|
132 - | &self,
|
133 - | ) -> ::std::result::Result<&::std::vec::Vec<::std::string::String>, &Self> {
|
134 - | if let MyUnion::ListValue(val) = &self {
|
135 - | ::std::result::Result::Ok(val)
|
136 - | } else {
|
137 - | ::std::result::Result::Err(self)
|
138 - | }
|
139 - | }
|
140 - | /// Returns true if this is a [`ListValue`](crate::model::MyUnion::ListValue).
|
141 - | pub fn is_list_value(&self) -> bool {
|
142 - | self.as_list_value().is_ok()
|
143 - | }
|
144 - | /// Tries to convert the enum instance into [`MapValue`](crate::model::MyUnion::MapValue), extracting the inner [`HashMap`](::std::collections::HashMap).
|
145 - | /// Returns `Err(&Self)` if it can't be converted.
|
146 - | pub fn as_map_value(
|
147 - | &self,
|
148 - | ) -> ::std::result::Result<
|
149 - | &::std::collections::HashMap<::std::string::String, ::std::string::String>,
|
150 - | &Self,
|
151 - | > {
|
152 - | if let MyUnion::MapValue(val) = &self {
|
153 - | ::std::result::Result::Ok(val)
|
154 - | } else {
|
155 - | ::std::result::Result::Err(self)
|
156 - | }
|
157 - | }
|
158 - | /// Returns true if this is a [`MapValue`](crate::model::MyUnion::MapValue).
|
159 - | pub fn is_map_value(&self) -> bool {
|
160 - | self.as_map_value().is_ok()
|
161 - | }
|
162 - | /// Tries to convert the enum instance into [`NumberValue`](crate::model::MyUnion::NumberValue), extracting the inner [`i32`](i32).
|
163 - | /// Returns `Err(&Self)` if it can't be converted.
|
164 - | pub fn as_number_value(&self) -> ::std::result::Result<&i32, &Self> {
|
165 - | if let MyUnion::NumberValue(val) = &self {
|
166 - | ::std::result::Result::Ok(val)
|
167 - | } else {
|
168 - | ::std::result::Result::Err(self)
|
169 - | }
|
170 - | }
|
171 - | /// Returns true if this is a [`NumberValue`](crate::model::MyUnion::NumberValue).
|
172 - | pub fn is_number_value(&self) -> bool {
|
173 - | self.as_number_value().is_ok()
|
174 - | }
|
175 - | /// Tries to convert the enum instance into [`StringValue`](crate::model::MyUnion::StringValue), extracting the inner [`String`](::std::string::String).
|
176 - | /// Returns `Err(&Self)` if it can't be converted.
|
177 - | pub fn as_string_value(&self) -> ::std::result::Result<&::std::string::String, &Self> {
|
178 - | if let MyUnion::StringValue(val) = &self {
|
179 - | ::std::result::Result::Ok(val)
|
180 - | } else {
|
181 - | ::std::result::Result::Err(self)
|
182 - | }
|
183 - | }
|
184 - | /// Returns true if this is a [`StringValue`](crate::model::MyUnion::StringValue).
|
185 - | pub fn is_string_value(&self) -> bool {
|
186 - | self.as_string_value().is_ok()
|
187 - | }
|
188 - | /// Tries to convert the enum instance into [`StructureValue`](crate::model::MyUnion::StructureValue), extracting the inner [`GreetingStruct`](crate::model::GreetingStruct).
|
189 - | /// Returns `Err(&Self)` if it can't be converted.
|
190 - | pub fn as_structure_value(
|
191 - | &self,
|
192 - | ) -> ::std::result::Result<&crate::model::GreetingStruct, &Self> {
|
193 - | if let MyUnion::StructureValue(val) = &self {
|
194 - | ::std::result::Result::Ok(val)
|
195 - | } else {
|
196 - | ::std::result::Result::Err(self)
|
197 - | }
|
198 - | }
|
199 - | /// Returns true if this is a [`StructureValue`](crate::model::MyUnion::StructureValue).
|
200 - | pub fn is_structure_value(&self) -> bool {
|
201 - | self.as_structure_value().is_ok()
|
202 - | }
|
203 - | /// Tries to convert the enum instance into [`TimestampValue`](crate::model::MyUnion::TimestampValue), extracting the inner [`DateTime`](::aws_smithy_http_server_python::types::DateTime).
|
204 - | /// Returns `Err(&Self)` if it can't be converted.
|
205 - | pub fn as_timestamp_value(
|
206 - | &self,
|
207 - | ) -> ::std::result::Result<&::aws_smithy_http_server_python::types::DateTime, &Self> {
|
208 - | if let MyUnion::TimestampValue(val) = &self {
|
209 - | ::std::result::Result::Ok(val)
|
210 - | } else {
|
211 - | ::std::result::Result::Err(self)
|
212 - | }
|
213 - | }
|
214 - | /// Returns true if this is a [`TimestampValue`](crate::model::MyUnion::TimestampValue).
|
215 - | pub fn is_timestamp_value(&self) -> bool {
|
216 - | self.as_timestamp_value().is_ok()
|
217 - | }
|
218 - | }
|
219 - | #[pyo3::pyclass(name = "MyUnion")]
|
220 - | #[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
221 - | pub struct PyUnionMarkerMyUnion(pub MyUnion);
|
222 - | #[::pyo3::pymethods]
|
223 - | impl PyUnionMarkerMyUnion {
|
224 - | #[staticmethod]
|
225 - | /// Creates a new union instance of [`BlobValue`](crate::model::MyUnion::BlobValue)
|
226 - | /// :param data json_rpc11.types.Blob:
|
227 - | /// :rtype MyUnion:
|
228 - | pub fn blob_value(data: ::aws_smithy_http_server_python::types::Blob) -> Self {
|
229 - | Self(MyUnion::BlobValue(data))
|
230 - | }
|
231 - | /// Tries to convert the enum instance into [`BlobValue`](crate::model::MyUnion::BlobValue), extracting the inner [`Blob`](::aws_smithy_http_server_python::types::Blob).
|
232 - | /// :rtype json_rpc11.types.Blob:
|
233 - | pub fn as_blob_value(&self) -> ::pyo3::PyResult<::aws_smithy_http_server_python::types::Blob> {
|
234 - | match self.0.as_blob_value() {
|
235 - | Ok(variant) => Ok(variant.clone()),
|
236 - | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
237 - | r"MyUnion variant is not of type json_rpc11.types.Blob",
|
238 - | )),
|
239 - | }
|
240 - | }
|
241 - | /// Returns true if this is a [`BlobValue`](crate::model::MyUnion::BlobValue).
|
242 - | /// :rtype bool:
|
243 - | pub fn is_blob_value(&self) -> bool {
|
244 - | self.0.is_blob_value()
|
245 - | }
|
246 - | #[staticmethod]
|
247 - | /// Creates a new union instance of [`BooleanValue`](crate::model::MyUnion::BooleanValue)
|
248 - | /// :param data bool:
|
249 - | /// :rtype MyUnion:
|
250 - | pub fn boolean_value(data: bool) -> Self {
|
251 - | Self(MyUnion::BooleanValue(data))
|
252 - | }
|
253 - | /// Tries to convert the enum instance into [`BooleanValue`](crate::model::MyUnion::BooleanValue), extracting the inner [`bool`](bool).
|
254 - | /// :rtype bool:
|
255 - | pub fn as_boolean_value(&self) -> ::pyo3::PyResult<bool> {
|
256 - | match self.0.as_boolean_value() {
|
257 - | Ok(variant) => Ok(*variant),
|
258 - | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
259 - | r"MyUnion variant is not of type bool",
|
260 - | )),
|
261 - | }
|
262 - | }
|
263 - | /// Returns true if this is a [`BooleanValue`](crate::model::MyUnion::BooleanValue).
|
264 - | /// :rtype bool:
|
265 - | pub fn is_boolean_value(&self) -> bool {
|
266 - | self.0.is_boolean_value()
|
267 - | }
|
268 - | #[staticmethod]
|
269 - | /// Creates a new union instance of [`EnumValue`](crate::model::MyUnion::EnumValue)
|
270 - | /// :param data json_rpc11.model.FooEnum:
|
271 - | /// :rtype MyUnion:
|
272 - | pub fn enum_value(data: crate::model::FooEnum) -> Self {
|
273 - | Self(MyUnion::EnumValue(data))
|
274 - | }
|
275 - | /// Tries to convert the enum instance into [`EnumValue`](crate::model::MyUnion::EnumValue), extracting the inner [`FooEnum`](crate::model::FooEnum).
|
276 - | /// :rtype json_rpc11.model.FooEnum:
|
277 - | pub fn as_enum_value(&self) -> ::pyo3::PyResult<crate::model::FooEnum> {
|
278 - | match self.0.as_enum_value() {
|
279 - | Ok(variant) => Ok(variant.clone()),
|
280 - | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
281 - | r"MyUnion variant is not of type json_rpc11.model.FooEnum",
|
282 - | )),
|
283 - | }
|
284 - | }
|
285 - | /// Returns true if this is a [`EnumValue`](crate::model::MyUnion::EnumValue).
|
286 - | /// :rtype bool:
|
287 - | pub fn is_enum_value(&self) -> bool {
|
288 - | self.0.is_enum_value()
|
289 - | }
|
290 - | #[staticmethod]
|
291 - | /// Creates a new union instance of [`ListValue`](crate::model::MyUnion::ListValue)
|
292 - | /// :param data typing.List\[str\]:
|
293 - | /// :rtype MyUnion:
|
294 - | pub fn list_value(data: ::std::vec::Vec<::std::string::String>) -> Self {
|
295 - | Self(MyUnion::ListValue(data))
|
296 - | }
|
297 - | /// Tries to convert the enum instance into [`ListValue`](crate::model::MyUnion::ListValue), extracting the inner [`Vec`](::std::vec::Vec).
|
298 - | /// :rtype typing.List\[str\]:
|
299 - | pub fn as_list_value(&self) -> ::pyo3::PyResult<::std::vec::Vec<::std::string::String>> {
|
300 - | match self.0.as_list_value() {
|
301 - | Ok(variant) => Ok(variant.clone()),
|
302 - | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
303 - | r"MyUnion variant is not of type typing.List\[str\]",
|
304 - | )),
|
305 - | }
|
306 - | }
|
307 - | /// Returns true if this is a [`ListValue`](crate::model::MyUnion::ListValue).
|
308 - | /// :rtype bool:
|
309 - | pub fn is_list_value(&self) -> bool {
|
310 - | self.0.is_list_value()
|
311 - | }
|
312 - | #[staticmethod]
|
313 - | /// Creates a new union instance of [`MapValue`](crate::model::MyUnion::MapValue)
|
314 - | /// :param data typing.Dict\[str, str\]:
|
315 - | /// :rtype MyUnion:
|
316 - | pub fn map_value(
|
317 - | data: ::std::collections::HashMap<::std::string::String, ::std::string::String>,
|
318 - | ) -> Self {
|
319 - | Self(MyUnion::MapValue(data))
|
320 - | }
|
321 - | /// Tries to convert the enum instance into [`MapValue`](crate::model::MyUnion::MapValue), extracting the inner [`HashMap`](::std::collections::HashMap).
|
322 - | /// :rtype typing.Dict\[str, str\]:
|
323 - | pub fn as_map_value(
|
324 - | &self,
|
325 - | ) -> ::pyo3::PyResult<::std::collections::HashMap<::std::string::String, ::std::string::String>>
|
326 - | {
|
327 - | match self.0.as_map_value() {
|
328 - | Ok(variant) => Ok(variant.clone()),
|
329 - | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
330 - | r"MyUnion variant is not of type typing.Dict\[str, str\]",
|
331 - | )),
|
332 - | }
|
333 - | }
|
334 - | /// Returns true if this is a [`MapValue`](crate::model::MyUnion::MapValue).
|
335 - | /// :rtype bool:
|
336 - | pub fn is_map_value(&self) -> bool {
|
337 - | self.0.is_map_value()
|
338 - | }
|
339 - | #[staticmethod]
|
340 - | /// Creates a new union instance of [`NumberValue`](crate::model::MyUnion::NumberValue)
|
341 - | /// :param data int:
|
342 - | /// :rtype MyUnion:
|
343 - | pub fn number_value(data: i32) -> Self {
|
344 - | Self(MyUnion::NumberValue(data))
|
345 - | }
|
346 - | /// Tries to convert the enum instance into [`NumberValue`](crate::model::MyUnion::NumberValue), extracting the inner [`i32`](i32).
|
347 - | /// :rtype int:
|
348 - | pub fn as_number_value(&self) -> ::pyo3::PyResult<i32> {
|
349 - | match self.0.as_number_value() {
|
350 - | Ok(variant) => Ok(*variant),
|
351 - | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
352 - | r"MyUnion variant is not of type int",
|
353 - | )),
|
354 - | }
|
355 - | }
|
356 - | /// Returns true if this is a [`NumberValue`](crate::model::MyUnion::NumberValue).
|
357 - | /// :rtype bool:
|
358 - | pub fn is_number_value(&self) -> bool {
|
359 - | self.0.is_number_value()
|
360 - | }
|
361 - | #[staticmethod]
|
362 - | /// Creates a new union instance of [`StringValue`](crate::model::MyUnion::StringValue)
|
363 - | /// :param data str:
|
364 - | /// :rtype MyUnion:
|
365 - | pub fn string_value(data: ::std::string::String) -> Self {
|
366 - | Self(MyUnion::StringValue(data))
|
367 - | }
|
368 - | /// Tries to convert the enum instance into [`StringValue`](crate::model::MyUnion::StringValue), extracting the inner [`String`](::std::string::String).
|
369 - | /// :rtype str:
|
370 - | pub fn as_string_value(&self) -> ::pyo3::PyResult<::std::string::String> {
|
371 - | match self.0.as_string_value() {
|
372 - | Ok(variant) => Ok(variant.clone()),
|
373 - | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
374 - | r"MyUnion variant is not of type str",
|
375 - | )),
|
376 - | }
|
377 - | }
|
378 - | /// Returns true if this is a [`StringValue`](crate::model::MyUnion::StringValue).
|
379 - | /// :rtype bool:
|
380 - | pub fn is_string_value(&self) -> bool {
|
381 - | self.0.is_string_value()
|
382 - | }
|
383 - | #[staticmethod]
|
384 - | /// Creates a new union instance of [`StructureValue`](crate::model::MyUnion::StructureValue)
|
385 - | /// :param data json_rpc11.model.GreetingStruct:
|
386 - | /// :rtype MyUnion:
|
387 - | pub fn structure_value(data: crate::model::GreetingStruct) -> Self {
|
388 - | Self(MyUnion::StructureValue(data))
|
389 - | }
|
390 - | /// Tries to convert the enum instance into [`StructureValue`](crate::model::MyUnion::StructureValue), extracting the inner [`GreetingStruct`](crate::model::GreetingStruct).
|
391 - | /// :rtype json_rpc11.model.GreetingStruct:
|
392 - | pub fn as_structure_value(&self) -> ::pyo3::PyResult<crate::model::GreetingStruct> {
|
393 - | match self.0.as_structure_value() {
|
394 - | Ok(variant) => Ok(variant.clone()),
|
395 - | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
396 - | r"MyUnion variant is not of type json_rpc11.model.GreetingStruct",
|
397 - | )),
|
398 - | }
|
399 - | }
|
400 - | /// Returns true if this is a [`StructureValue`](crate::model::MyUnion::StructureValue).
|
401 - | /// :rtype bool:
|
402 - | pub fn is_structure_value(&self) -> bool {
|
403 - | self.0.is_structure_value()
|
404 - | }
|
405 - | #[staticmethod]
|
406 - | /// Creates a new union instance of [`TimestampValue`](crate::model::MyUnion::TimestampValue)
|
407 - | /// :param data json_rpc11.types.DateTime:
|
408 - | /// :rtype MyUnion:
|
409 - | pub fn timestamp_value(data: ::aws_smithy_http_server_python::types::DateTime) -> Self {
|
410 - | Self(MyUnion::TimestampValue(data))
|
411 - | }
|
412 - | /// Tries to convert the enum instance into [`TimestampValue`](crate::model::MyUnion::TimestampValue), extracting the inner [`DateTime`](::aws_smithy_http_server_python::types::DateTime).
|
413 - | /// :rtype json_rpc11.types.DateTime:
|
414 - | pub fn as_timestamp_value(
|
415 - | &self,
|
416 - | ) -> ::pyo3::PyResult<::aws_smithy_http_server_python::types::DateTime> {
|
417 - | match self.0.as_timestamp_value() {
|
418 - | Ok(variant) => Ok(variant.clone()),
|
419 - | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
420 - | r"MyUnion variant is not of type json_rpc11.types.DateTime",
|
421 - | )),
|
422 - | }
|
423 - | }
|
424 - | /// Returns true if this is a [`TimestampValue`](crate::model::MyUnion::TimestampValue).
|
425 - | /// :rtype bool:
|
426 - | pub fn is_timestamp_value(&self) -> bool {
|
427 - | self.0.is_timestamp_value()
|
428 - | }
|
429 - | }
|
430 - | impl ::pyo3::IntoPy<::pyo3::PyObject> for MyUnion {
|
431 - | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
432 - | PyUnionMarkerMyUnion(self).into_py(py)
|
433 - | }
|
434 - | }
|
435 - | impl<'source> ::pyo3::FromPyObject<'source> for MyUnion {
|
436 - | fn extract(obj: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
437 - | let data: PyUnionMarkerMyUnion = obj.extract()?;
|
438 - | Ok(data.0)
|
439 - | }
|
440 - | }
|
441 - |
|
442 - | #[::pyo3::pyclass]
|
443 - | /// :param hi typing.Optional\[str\]:
|
444 - | /// :rtype None:
|
445 - | #[allow(missing_docs)] // documentation missing in model
|
446 - | #[derive(
|
447 - | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
448 - | )]
|
449 - | pub struct GreetingStruct {
|
450 - | #[pyo3(get, set)]
|
451 - | /// :type typing.Optional\[str\]:
|
452 - | #[allow(missing_docs)] // documentation missing in model
|
453 - | pub hi: ::std::option::Option<::std::string::String>,
|
454 - | }
|
455 - | impl GreetingStruct {
|
456 - | #[allow(missing_docs)] // documentation missing in model
|
457 - | pub fn hi(&self) -> ::std::option::Option<&str> {
|
458 - | self.hi.as_deref()
|
459 - | }
|
460 - | }
|
461 - | #[allow(clippy::new_without_default)]
|
462 - | #[allow(clippy::too_many_arguments)]
|
463 - | #[::pyo3::pymethods]
|
464 - | impl GreetingStruct {
|
465 - | #[new]
|
466 - | pub fn new(hi: ::std::option::Option<::std::string::String>) -> Self {
|
467 - | Self { hi }
|
468 - | }
|
469 - | fn __repr__(&self) -> String {
|
470 - | format!("{self:?}")
|
471 - | }
|
472 - | fn __str__(&self) -> String {
|
473 - | format!("{self:?}")
|
474 - | }
|
475 - | }
|
476 - | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<GreetingStruct> {
|
477 - | fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
478 - | ob.extract::<GreetingStruct>().map(Box::new)
|
479 - | }
|
480 - | }
|
481 - |
|
482 - | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<GreetingStruct> {
|
483 - | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
484 - | (*self).into_py(py)
|
485 - | }
|
486 - | }
|
487 - | impl crate::constrained::Constrained for crate::model::GreetingStruct {
|
488 - | type Unconstrained = crate::model::greeting_struct_internal::Builder;
|
489 - | }
|
490 - | impl GreetingStruct {
|
491 - | /// Creates a new builder-style object to manufacture [`GreetingStruct`](crate::model::GreetingStruct).
|
492 - | pub fn builder() -> crate::model::greeting_struct::Builder {
|
493 - | crate::model::greeting_struct::Builder::default()
|
494 - | }
|
495 - | }
|
496 - |
|
497 - | #[::pyo3::pyclass]
|
498 - | #[allow(missing_docs)] // documentation missing in model
|
499 - | #[derive(
|
500 - | ::std::clone::Clone,
|
501 - | ::std::cmp::Eq,
|
502 - | ::std::cmp::Ord,
|
503 - | ::std::cmp::PartialEq,
|
504 - | ::std::cmp::PartialOrd,
|
505 - | ::std::fmt::Debug,
|
506 - | ::std::hash::Hash,
|
507 - | )]
|
508 - | pub enum FooEnum {
|
509 - | #[allow(missing_docs)] // documentation missing in model
|
510 - | Zero,
|
511 - | #[allow(missing_docs)] // documentation missing in model
|
512 - | One,
|
513 - | #[allow(missing_docs)] // documentation missing in model
|
514 - | Bar,
|
515 - | #[allow(missing_docs)] // documentation missing in model
|
516 - | Baz,
|
517 - | #[allow(missing_docs)] // documentation missing in model
|
518 - | Foo,
|
519 - | }
|
520 - | pub(crate) mod foo_enum_internal {
|
521 - | #[derive(Debug, PartialEq)]
|
522 - | pub struct ConstraintViolation(pub(crate) ::std::string::String);
|
523 - |
|
524 - | impl ::std::fmt::Display for ConstraintViolation {
|
525 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
526 - | write!(
|
527 - | f,
|
528 - | r#"Value provided for 'aws.protocoltests.shared#FooEnum' failed to satisfy constraint: Member must satisfy enum value set: [Foo, Baz, Bar, 1, 0]"#
|
529 - | )
|
530 - | }
|
531 - | }
|
532 - |
|
533 - | impl ::std::error::Error for ConstraintViolation {}
|
534 - | impl ConstraintViolation {
|
535 - | pub(crate) fn as_validation_exception_field(
|
536 - | self,
|
537 - | path: ::std::string::String,
|
538 - | ) -> crate::model::ValidationExceptionField {
|
539 - | crate::model::ValidationExceptionField {
|
540 - | message: format!(
|
541 - | r#"Value at '{}' failed to satisfy constraint: Member must satisfy enum value set: [Foo, Baz, Bar, 1, 0]"#,
|
542 - | &path
|
543 - | ),
|
544 - | path,
|
545 - | }
|
546 - | }
|
547 - | }
|
548 - | }
|
549 - | impl ::std::convert::TryFrom<&str> for FooEnum {
|
550 - | type Error = crate::model::foo_enum_internal::ConstraintViolation;
|
551 - | fn try_from(
|
552 - | s: &str,
|
553 - | ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<&str>>::Error> {
|
554 - | match s {
|
555 - | "0" => Ok(FooEnum::Zero),
|
556 - | "1" => Ok(FooEnum::One),
|
557 - | "Bar" => Ok(FooEnum::Bar),
|
558 - | "Baz" => Ok(FooEnum::Baz),
|
559 - | "Foo" => Ok(FooEnum::Foo),
|
560 - | _ => Err(crate::model::foo_enum_internal::ConstraintViolation(
|
561 - | s.to_owned(),
|
562 - | )),
|
563 - | }
|
564 - | }
|
565 - | }
|
566 - | impl ::std::convert::TryFrom<::std::string::String> for FooEnum {
|
567 - | type Error = crate::model::foo_enum_internal::ConstraintViolation;
|
568 - | fn try_from(
|
569 - | s: ::std::string::String,
|
570 - | ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<::std::string::String>>::Error>
|
571 - | {
|
572 - | s.as_str().try_into()
|
573 - | }
|
574 - | }
|
575 - | impl std::str::FromStr for FooEnum {
|
576 - | type Err = crate::model::foo_enum_internal::ConstraintViolation;
|
577 - | fn from_str(s: &str) -> std::result::Result<Self, <Self as std::str::FromStr>::Err> {
|
578 - | Self::try_from(s)
|
579 - | }
|
580 - | }
|
581 - | impl FooEnum {
|
582 - | /// Returns the `&str` value of the enum member.
|
583 - | pub fn as_str(&self) -> &str {
|
584 - | match self {
|
585 - | FooEnum::Zero => "0",
|
586 - | FooEnum::One => "1",
|
587 - | FooEnum::Bar => "Bar",
|
588 - | FooEnum::Baz => "Baz",
|
589 - | FooEnum::Foo => "Foo",
|
590 - | }
|
591 - | }
|
592 - | /// Returns all the `&str` representations of the enum members.
|
593 - | pub const fn values() -> &'static [&'static str] {
|
594 - | &["0", "1", "Bar", "Baz", "Foo"]
|
595 - | }
|
596 - | }
|
597 - | impl ::std::convert::AsRef<str> for FooEnum {
|
598 - | fn as_ref(&self) -> &str {
|
599 - | self.as_str()
|
600 - | }
|
601 - | }
|
602 - | #[::pyo3::pymethods]
|
603 - | impl FooEnum {
|
604 - | #[getter]
|
605 - | pub fn name(&self) -> &str {
|
606 - | match self {
|
607 - | FooEnum::Zero => "Zero",
|
608 - | FooEnum::One => "One",
|
609 - | FooEnum::Bar => "Bar",
|
610 - | FooEnum::Baz => "Baz",
|
611 - | FooEnum::Foo => "Foo",
|
612 - | }
|
613 - | }
|
614 - | #[getter]
|
615 - | pub fn value(&self) -> &str {
|
616 - | self.as_str()
|
617 - | }
|
618 - | fn __repr__(&self) -> String {
|
619 - | self.as_str().to_owned()
|
620 - | }
|
621 - | fn __str__(&self) -> String {
|
622 - | self.as_str().to_owned()
|
623 - | }
|
624 - | }
|
625 - | impl crate::constrained::Constrained for FooEnum {
|
626 - | type Unconstrained = ::std::string::String;
|
627 - | }
|
628 - |
|
629 - | impl ::std::convert::From<::std::string::String>
|
630 - | for crate::constrained::MaybeConstrained<crate::model::FooEnum>
|
631 - | {
|
632 - | fn from(value: ::std::string::String) -> Self {
|
633 - | Self::Unconstrained(value)
|
634 - | }
|
635 - | }
|
636 - |
|
637 - | #[::pyo3::pyclass]
|
638 - | /// :param foo typing.Optional\[str\]:
|
639 - | /// :rtype None:
|
640 - | #[allow(missing_docs)] // documentation missing in model
|
641 - | #[derive(
|
642 - | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
643 - | )]
|
644 - | pub struct ComplexNestedErrorData {
|
645 - | #[pyo3(get, set)]
|
646 - | /// :type typing.Optional\[str\]:
|
647 - | #[allow(missing_docs)] // documentation missing in model
|
648 - | pub foo: ::std::option::Option<::std::string::String>,
|
649 - | }
|
650 - | impl ComplexNestedErrorData {
|
651 - | #[allow(missing_docs)] // documentation missing in model
|
652 - | pub fn foo(&self) -> ::std::option::Option<&str> {
|
653 - | self.foo.as_deref()
|
654 - | }
|
655 - | }
|
656 - | #[allow(clippy::new_without_default)]
|
657 - | #[allow(clippy::too_many_arguments)]
|
658 - | #[::pyo3::pymethods]
|
659 - | impl ComplexNestedErrorData {
|
660 - | #[new]
|
661 - | pub fn new(foo: ::std::option::Option<::std::string::String>) -> Self {
|
662 - | Self { foo }
|
663 - | }
|
664 - | fn __repr__(&self) -> String {
|
665 - | format!("{self:?}")
|
666 - | }
|
667 - | fn __str__(&self) -> String {
|
668 - | format!("{self:?}")
|
669 - | }
|
670 - | }
|
671 - | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<ComplexNestedErrorData> {
|
672 - | fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
673 - | ob.extract::<ComplexNestedErrorData>().map(Box::new)
|
674 - | }
|
675 - | }
|
676 - |
|
677 - | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<ComplexNestedErrorData> {
|
678 - | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
679 - | (*self).into_py(py)
|
680 - | }
|
681 - | }
|
682 - | impl ComplexNestedErrorData {
|
683 - | /// Creates a new builder-style object to manufacture [`ComplexNestedErrorData`](crate::model::ComplexNestedErrorData).
|
684 - | pub fn builder() -> crate::model::complex_nested_error_data::Builder {
|
685 - | crate::model::complex_nested_error_data::Builder::default()
|
686 - | }
|
687 - | }
|
688 - |
|
689 - | #[allow(missing_docs)] // documentation missing in model
|
690 - | ///
|
691 - | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
692 - | /// [constraint traits]. Use [`IntegerEnumSet::try_from`] to construct values of this type.
|
693 - | ///
|
694 - | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
695 - | ///
|
696 - | #[derive(
|
697 - | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
698 - | )]
|
699 - | pub(crate) struct IntegerEnumSet(pub(crate) ::std::vec::Vec<i32>);
|
700 - | impl IntegerEnumSet {
|
701 - | /// Consumes the value, returning the underlying [`::std::vec::Vec<i32>`].
|
702 - | pub fn into_inner(self) -> ::std::vec::Vec<i32> {
|
703 - | self.0
|
704 - | }
|
705 - |
|
706 - | fn check_unique_items(
|
707 - | items: ::std::vec::Vec<i32>,
|
708 - | ) -> ::std::result::Result<
|
709 - | ::std::vec::Vec<i32>,
|
710 - | crate::model::integer_enum_set_internal::ConstraintViolation,
|
711 - | > {
|
712 - | let mut seen = ::std::collections::HashMap::new();
|
713 - | let mut duplicate_indices = ::std::vec::Vec::new();
|
714 - | for (idx, item) in items.iter().enumerate() {
|
715 - | if let Some(prev_idx) = seen.insert(item, idx) {
|
716 - | duplicate_indices.push(prev_idx);
|
717 - | }
|
718 - | }
|
719 - |
|
720 - | let mut last_duplicate_indices = ::std::vec::Vec::new();
|
721 - | for idx in &duplicate_indices {
|
722 - | if let Some(prev_idx) = seen.remove(&items[*idx]) {
|
723 - | last_duplicate_indices.push(prev_idx);
|
724 - | }
|
725 - | }
|
726 - | duplicate_indices.extend(last_duplicate_indices);
|
727 - |
|
728 - | if !duplicate_indices.is_empty() {
|
729 - | debug_assert!(duplicate_indices.len() >= 2);
|
730 - | Err(
|
731 - | crate::model::integer_enum_set_internal::ConstraintViolation::UniqueItems {
|
732 - | duplicate_indices,
|
733 - | original: items,
|
734 - | },
|
735 - | )
|
736 - | } else {
|
737 - | Ok(items)
|
738 - | }
|
739 - | }
|
740 - | }
|
741 - | impl ::std::convert::TryFrom<::std::vec::Vec<i32>> for IntegerEnumSet {
|
742 - | type Error = crate::model::integer_enum_set_internal::ConstraintViolation;
|
743 - |
|
744 - | /// Constructs a `IntegerEnumSet` from an [`::std::vec::Vec<i32>`], failing when the provided value does not satisfy the modeled constraints.
|
745 - | fn try_from(value: ::std::vec::Vec<i32>) -> ::std::result::Result<Self, Self::Error> {
|
746 - | let value = Self::check_unique_items(value)?;
|
747 - |
|
748 - | Ok(Self(value))
|
749 - | }
|
750 - | }
|
751 - |
|
752 - | impl ::std::convert::From<IntegerEnumSet> for ::std::vec::Vec<i32> {
|
753 - | fn from(value: IntegerEnumSet) -> Self {
|
754 - | value.into_inner()
|
755 - | }
|
756 - | }
|
757 - | impl crate::constrained::Constrained for IntegerEnumSet {
|
758 - | type Unconstrained =
|
759 - | crate::unconstrained::integer_enum_set_unconstrained::IntegerEnumSetUnconstrained;
|
760 - | }
|
761 - |
|
762 - | #[allow(missing_docs)] // documentation missing in model
|
763 - | ///
|
764 - | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
765 - | /// [constraint traits]. Use [`FooEnumSet::try_from`] to construct values of this type.
|
766 - | ///
|
767 - | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
768 - | ///
|
769 - | #[derive(
|
770 - | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
771 - | )]
|
772 - | pub(crate) struct FooEnumSet(pub(crate) ::std::vec::Vec<crate::model::FooEnum>);
|
773 - | impl FooEnumSet {
|
774 - | /// Consumes the value, returning the underlying [`::std::vec::Vec<crate::model::FooEnum>`].
|
775 - | pub fn into_inner(self) -> ::std::vec::Vec<crate::model::FooEnum> {
|
776 - | self.0
|
777 - | }
|
778 - |
|
779 - | fn check_unique_items(
|
780 - | items: ::std::vec::Vec<crate::model::FooEnum>,
|
781 - | ) -> ::std::result::Result<
|
782 - | ::std::vec::Vec<crate::model::FooEnum>,
|
783 - | crate::model::foo_enum_set_internal::ConstraintViolation,
|
784 - | > {
|
785 - | let mut seen = ::std::collections::HashMap::new();
|
786 - | let mut duplicate_indices = ::std::vec::Vec::new();
|
787 - | for (idx, item) in items.iter().enumerate() {
|
788 - | if let Some(prev_idx) = seen.insert(item, idx) {
|
789 - | duplicate_indices.push(prev_idx);
|
790 - | }
|
791 - | }
|
792 - |
|
793 - | let mut last_duplicate_indices = ::std::vec::Vec::new();
|
794 - | for idx in &duplicate_indices {
|
795 - | if let Some(prev_idx) = seen.remove(&items[*idx]) {
|
796 - | last_duplicate_indices.push(prev_idx);
|
797 - | }
|
798 - | }
|
799 - | duplicate_indices.extend(last_duplicate_indices);
|
800 - |
|
801 - | if !duplicate_indices.is_empty() {
|
802 - | debug_assert!(duplicate_indices.len() >= 2);
|
803 - | Err(
|
804 - | crate::model::foo_enum_set_internal::ConstraintViolation::UniqueItems {
|
805 - | duplicate_indices,
|
806 - | original: items,
|
807 - | },
|
808 - | )
|
809 - | } else {
|
810 - | Ok(items)
|
811 - | }
|
812 - | }
|
813 - | }
|
814 - | impl ::std::convert::TryFrom<::std::vec::Vec<crate::model::FooEnum>> for FooEnumSet {
|
815 - | type Error = crate::model::foo_enum_set_internal::ConstraintViolation;
|
816 - |
|
817 - | /// Constructs a `FooEnumSet` from an [`::std::vec::Vec<crate::model::FooEnum>`], failing when the provided value does not satisfy the modeled constraints.
|
818 - | fn try_from(
|
819 - | value: ::std::vec::Vec<crate::model::FooEnum>,
|
820 - | ) -> ::std::result::Result<Self, Self::Error> {
|
821 - | let value = Self::check_unique_items(value)?;
|
822 - |
|
823 - | Ok(Self(value))
|
824 - | }
|
825 - | }
|
826 - |
|
827 - | impl ::std::convert::From<FooEnumSet> for ::std::vec::Vec<crate::model::FooEnum> {
|
828 - | fn from(value: FooEnumSet) -> Self {
|
829 - | value.into_inner()
|
830 - | }
|
831 - | }
|
832 - | impl crate::constrained::Constrained for FooEnumSet {
|
833 - | type Unconstrained = crate::unconstrained::foo_enum_set_unconstrained::FooEnumSetUnconstrained;
|
834 - | }
|
835 - |
|
836 - | #[::pyo3::pyclass]
|
837 - | /// :param blob typing.Optional\[json_rpc11.types.Blob\]:
|
838 - | /// :param boolean typing.Optional\[bool\]:
|
839 - | /// :param double typing.Optional\[float\]:
|
840 - | /// :param empty_struct typing.Optional\[json_rpc11.model.EmptyStruct\]:
|
841 - | /// :param float typing.Optional\[float\]:
|
842 - | /// :param httpdate_timestamp typing.Optional\[json_rpc11.types.DateTime\]:
|
843 - | /// :param integer typing.Optional\[int\]:
|
844 - | /// :param iso8601_timestamp typing.Optional\[json_rpc11.types.DateTime\]:
|
845 - | /// :param json_value typing.Optional\[str\]:
|
846 - | /// :param list_of_lists typing.Optional\[typing.List\[typing.List\[str\]\]\]:
|
847 - | /// :param list_of_maps_of_strings typing.Optional\[typing.List\[typing.Dict\[str, str\]\]\]:
|
848 - | /// :param list_of_strings typing.Optional\[typing.List\[str\]\]:
|
849 - | /// :param list_of_structs typing.Optional\[typing.List\[json_rpc11.model.SimpleStruct\]\]:
|
850 - | /// :param long typing.Optional\[int\]:
|
851 - | /// :param map_of_lists_of_strings typing.Optional\[typing.Dict\[str, typing.List\[str\]\]\]:
|
852 - | /// :param map_of_maps typing.Optional\[typing.Dict\[str, typing.Dict\[str, str\]\]\]:
|
853 - | /// :param map_of_strings typing.Optional\[typing.Dict\[str, str\]\]:
|
854 - | /// :param map_of_structs typing.Optional\[typing.Dict\[str, json_rpc11.model.SimpleStruct\]\]:
|
855 - | /// :param recursive_list typing.Optional\[typing.List\[json_rpc11.model.KitchenSink\]\]:
|
856 - | /// :param recursive_map typing.Optional\[typing.Dict\[str, json_rpc11.model.KitchenSink\]\]:
|
857 - | /// :param recursive_struct typing.Optional\[json_rpc11.model.KitchenSink\]:
|
858 - | /// :param simple_struct typing.Optional\[json_rpc11.model.SimpleStruct\]:
|
859 - | /// :param string typing.Optional\[str\]:
|
860 - | /// :param struct_with_json_name typing.Optional\[json_rpc11.model.StructWithJsonName\]:
|
861 - | /// :param timestamp typing.Optional\[json_rpc11.types.DateTime\]:
|
862 - | /// :param unix_timestamp typing.Optional\[json_rpc11.types.DateTime\]:
|
863 - | /// :rtype None:
|
864 - | #[allow(missing_docs)] // documentation missing in model
|
865 - | #[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
866 - | pub struct KitchenSink {
|
867 - | #[pyo3(get, set)]
|
868 - | /// :type typing.Optional\[json_rpc11.types.Blob\]:
|
869 - | #[allow(missing_docs)] // documentation missing in model
|
870 - | pub blob: ::std::option::Option<::aws_smithy_http_server_python::types::Blob>,
|
871 - | #[pyo3(get, set)]
|
872 - | /// :type typing.Optional\[bool\]:
|
873 - | #[allow(missing_docs)] // documentation missing in model
|
874 - | pub boolean: ::std::option::Option<bool>,
|
875 - | #[pyo3(get, set)]
|
876 - | /// :type typing.Optional\[float\]:
|
877 - | #[allow(missing_docs)] // documentation missing in model
|
878 - | pub double: ::std::option::Option<f64>,
|
879 - | #[pyo3(get, set)]
|
880 - | /// :type typing.Optional\[json_rpc11.model.EmptyStruct\]:
|
881 - | #[allow(missing_docs)] // documentation missing in model
|
882 - | pub empty_struct: ::std::option::Option<crate::model::EmptyStruct>,
|
883 - | #[pyo3(get, set)]
|
884 - | /// :type typing.Optional\[float\]:
|
885 - | #[allow(missing_docs)] // documentation missing in model
|
886 - | pub float: ::std::option::Option<f32>,
|
887 - | #[pyo3(get, set)]
|
888 - | /// :type typing.Optional\[json_rpc11.types.DateTime\]:
|
889 - | #[allow(missing_docs)] // documentation missing in model
|
890 - | pub httpdate_timestamp: ::std::option::Option<::aws_smithy_http_server_python::types::DateTime>,
|
891 - | #[pyo3(get, set)]
|
892 - | /// :type typing.Optional\[int\]:
|
893 - | #[allow(missing_docs)] // documentation missing in model
|
894 - | pub integer: ::std::option::Option<i32>,
|
895 - | #[pyo3(get, set)]
|
896 - | /// :type typing.Optional\[json_rpc11.types.DateTime\]:
|
897 - | #[allow(missing_docs)] // documentation missing in model
|
898 - | pub iso8601_timestamp: ::std::option::Option<::aws_smithy_http_server_python::types::DateTime>,
|
899 - | #[pyo3(get, set)]
|
900 - | /// :type typing.Optional\[str\]:
|
901 - | #[allow(missing_docs)] // documentation missing in model
|
902 - | pub json_value: ::std::option::Option<::std::string::String>,
|
903 - | #[pyo3(get, set)]
|
904 - | /// :type typing.Optional\[typing.List\[typing.List\[str\]\]\]:
|
905 - | #[allow(missing_docs)] // documentation missing in model
|
906 - | pub list_of_lists:
|
907 - | ::std::option::Option<::std::vec::Vec<::std::vec::Vec<::std::string::String>>>,
|
908 - | #[pyo3(get, set)]
|
909 - | /// :type typing.Optional\[typing.List\[typing.Dict\[str, str\]\]\]:
|
910 - | #[allow(missing_docs)] // documentation missing in model
|
911 - | pub list_of_maps_of_strings: ::std::option::Option<
|
912 - | ::std::vec::Vec<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
|
913 - | >,
|
914 - | #[pyo3(get, set)]
|
915 - | /// :type typing.Optional\[typing.List\[str\]\]:
|
916 - | #[allow(missing_docs)] // documentation missing in model
|
917 - | pub list_of_strings: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
|
918 - | #[pyo3(get, set)]
|
919 - | /// :type typing.Optional\[typing.List\[json_rpc11.model.SimpleStruct\]\]:
|
920 - | #[allow(missing_docs)] // documentation missing in model
|
921 - | pub list_of_structs: ::std::option::Option<::std::vec::Vec<crate::model::SimpleStruct>>,
|
922 - | #[pyo3(get, set)]
|
923 - | /// :type typing.Optional\[int\]:
|
924 - | #[allow(missing_docs)] // documentation missing in model
|
925 - | pub long: ::std::option::Option<i64>,
|
926 - | #[pyo3(get, set)]
|
927 - | /// :type typing.Optional\[typing.Dict\[str, typing.List\[str\]\]\]:
|
928 - | #[allow(missing_docs)] // documentation missing in model
|
929 - | pub map_of_lists_of_strings: ::std::option::Option<
|
930 - | ::std::collections::HashMap<::std::string::String, ::std::vec::Vec<::std::string::String>>,
|
931 - | >,
|
932 - | #[pyo3(get, set)]
|
933 - | /// :type typing.Optional\[typing.Dict\[str, typing.Dict\[str, str\]\]\]:
|
934 - | #[allow(missing_docs)] // documentation missing in model
|
935 - | pub map_of_maps: ::std::option::Option<
|
936 - | ::std::collections::HashMap<
|
937 - | ::std::string::String,
|
938 - | ::std::collections::HashMap<::std::string::String, ::std::string::String>,
|
939 - | >,
|
940 - | >,
|
941 - | #[pyo3(get, set)]
|
942 - | /// :type typing.Optional\[typing.Dict\[str, str\]\]:
|
943 - | #[allow(missing_docs)] // documentation missing in model
|
944 - | pub map_of_strings: ::std::option::Option<
|
945 - | ::std::collections::HashMap<::std::string::String, ::std::string::String>,
|
946 - | >,
|
947 - | #[pyo3(get, set)]
|
948 - | /// :type typing.Optional\[typing.Dict\[str, json_rpc11.model.SimpleStruct\]\]:
|
949 - | #[allow(missing_docs)] // documentation missing in model
|
950 - | pub map_of_structs: ::std::option::Option<
|
951 - | ::std::collections::HashMap<::std::string::String, crate::model::SimpleStruct>,
|
952 - | >,
|
953 - | #[pyo3(get, set)]
|
954 - | /// :type typing.Optional\[typing.List\[json_rpc11.model.KitchenSink\]\]:
|
955 - | #[allow(missing_docs)] // documentation missing in model
|
956 - | pub recursive_list: ::std::option::Option<::std::vec::Vec<crate::model::KitchenSink>>,
|
957 - | #[pyo3(get, set)]
|
958 - | /// :type typing.Optional\[typing.Dict\[str, json_rpc11.model.KitchenSink\]\]:
|
959 - | #[allow(missing_docs)] // documentation missing in model
|
960 - | pub recursive_map: ::std::option::Option<
|
961 - | ::std::collections::HashMap<::std::string::String, crate::model::KitchenSink>,
|
962 - | >,
|
963 - | #[pyo3(get, set)]
|
964 - | /// :type typing.Optional\[json_rpc11.model.KitchenSink\]:
|
965 - | #[allow(missing_docs)] // documentation missing in model
|
966 - | pub recursive_struct: ::std::option::Option<::std::boxed::Box<crate::model::KitchenSink>>,
|
967 - | #[pyo3(get, set)]
|
968 - | /// :type typing.Optional\[json_rpc11.model.SimpleStruct\]:
|
969 - | #[allow(missing_docs)] // documentation missing in model
|
970 - | pub simple_struct: ::std::option::Option<crate::model::SimpleStruct>,
|
971 - | #[pyo3(get, set)]
|
972 - | /// :type typing.Optional\[str\]:
|
973 - | #[allow(missing_docs)] // documentation missing in model
|
974 - | pub string: ::std::option::Option<::std::string::String>,
|
975 - | #[pyo3(get, set)]
|
976 - | /// :type typing.Optional\[json_rpc11.model.StructWithJsonName\]:
|
977 - | #[allow(missing_docs)] // documentation missing in model
|
978 - | pub struct_with_json_name: ::std::option::Option<crate::model::StructWithJsonName>,
|
979 - | #[pyo3(get, set)]
|
980 - | /// :type typing.Optional\[json_rpc11.types.DateTime\]:
|
981 - | #[allow(missing_docs)] // documentation missing in model
|
982 - | pub timestamp: ::std::option::Option<::aws_smithy_http_server_python::types::DateTime>,
|
983 - | #[pyo3(get, set)]
|
984 - | /// :type typing.Optional\[json_rpc11.types.DateTime\]:
|
985 - | #[allow(missing_docs)] // documentation missing in model
|
986 - | pub unix_timestamp: ::std::option::Option<::aws_smithy_http_server_python::types::DateTime>,
|
987 - | }
|
988 - | impl KitchenSink {
|
989 - | #[allow(missing_docs)] // documentation missing in model
|
990 - | pub fn blob(&self) -> ::std::option::Option<&::aws_smithy_http_server_python::types::Blob> {
|
991 - | self.blob.as_ref()
|
992 - | }
|
993 - | #[allow(missing_docs)] // documentation missing in model
|
994 - | pub fn boolean(&self) -> ::std::option::Option<bool> {
|
995 - | self.boolean
|
996 - | }
|
997 - | #[allow(missing_docs)] // documentation missing in model
|
998 - | pub fn double(&self) -> ::std::option::Option<f64> {
|
999 - | self.double
|
1000 - | }
|
1001 - | #[allow(missing_docs)] // documentation missing in model
|
1002 - | pub fn empty_struct(&self) -> ::std::option::Option<&crate::model::EmptyStruct> {
|
1003 - | self.empty_struct.as_ref()
|
1004 - | }
|
1005 - | #[allow(missing_docs)] // documentation missing in model
|
1006 - | pub fn float(&self) -> ::std::option::Option<f32> {
|
1007 - | self.float
|
1008 - | }
|
1009 - | #[allow(missing_docs)] // documentation missing in model
|
1010 - | pub fn httpdate_timestamp(
|
1011 - | &self,
|
1012 - | ) -> ::std::option::Option<&::aws_smithy_http_server_python::types::DateTime> {
|
1013 - | self.httpdate_timestamp.as_ref()
|
218 + | #[allow(missing_docs)] // documentation missing in model
|
219 + | pub fn httpdate_timestamp(
|
220 + | &self,
|
221 + | ) -> ::std::option::Option<&::aws_smithy_http_server_python::types::DateTime> {
|
222 + | self.httpdate_timestamp.as_ref()
|
1014 223 | }
|
1015 224 | #[allow(missing_docs)] // documentation missing in model
|
1016 225 | pub fn integer(&self) -> ::std::option::Option<i32> {
|
1017 226 | self.integer
|
1018 227 | }
|
1019 228 | #[allow(missing_docs)] // documentation missing in model
|
1020 229 | pub fn iso8601_timestamp(
|
1021 230 | &self,
|
1022 231 | ) -> ::std::option::Option<&::aws_smithy_http_server_python::types::DateTime> {
|
1023 232 | self.iso8601_timestamp.as_ref()
|
1208 417 | recursive_map,
|
1209 418 | recursive_struct,
|
1210 419 | simple_struct,
|
1211 420 | string,
|
1212 421 | struct_with_json_name,
|
1213 422 | timestamp,
|
1214 423 | unix_timestamp,
|
1215 424 | }
|
1216 425 | }
|
1217 426 | fn __repr__(&self) -> String {
|
1218 - | format!("{self:?}")
|
427 + | format!("{self:?}")
|
428 + | }
|
429 + | fn __str__(&self) -> String {
|
430 + | format!("{self:?}")
|
431 + | }
|
432 + | }
|
433 + | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<KitchenSink> {
|
434 + | fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
435 + | ob.extract::<KitchenSink>().map(Box::new)
|
436 + | }
|
437 + | }
|
438 + |
|
439 + | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<KitchenSink> {
|
440 + | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
441 + | (*self).into_py(py)
|
442 + | }
|
443 + | }
|
444 + | impl crate::constrained::Constrained for crate::model::KitchenSink {
|
445 + | type Unconstrained = crate::model::kitchen_sink_internal::Builder;
|
446 + | }
|
447 + | impl KitchenSink {
|
448 + | /// Creates a new builder-style object to manufacture [`KitchenSink`](crate::model::KitchenSink).
|
449 + | pub fn builder() -> crate::model::kitchen_sink::Builder {
|
450 + | crate::model::kitchen_sink::Builder::default()
|
451 + | }
|
452 + | }
|
453 + |
|
454 + | #[::pyo3::pyclass]
|
455 + | /// :param value typing.Optional\[str\]:
|
456 + | /// :rtype None:
|
457 + | #[allow(missing_docs)] // documentation missing in model
|
458 + | #[derive(
|
459 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
460 + | )]
|
461 + | pub struct SimpleStruct {
|
462 + | #[pyo3(get, set)]
|
463 + | /// :type typing.Optional\[str\]:
|
464 + | #[allow(missing_docs)] // documentation missing in model
|
465 + | pub value: ::std::option::Option<::std::string::String>,
|
466 + | }
|
467 + | impl SimpleStruct {
|
468 + | #[allow(missing_docs)] // documentation missing in model
|
469 + | pub fn value(&self) -> ::std::option::Option<&str> {
|
470 + | self.value.as_deref()
|
471 + | }
|
472 + | }
|
473 + | #[allow(clippy::new_without_default)]
|
474 + | #[allow(clippy::too_many_arguments)]
|
475 + | #[::pyo3::pymethods]
|
476 + | impl SimpleStruct {
|
477 + | #[new]
|
478 + | pub fn new(value: ::std::option::Option<::std::string::String>) -> Self {
|
479 + | Self { value }
|
480 + | }
|
481 + | fn __repr__(&self) -> String {
|
482 + | format!("{self:?}")
|
483 + | }
|
484 + | fn __str__(&self) -> String {
|
485 + | format!("{self:?}")
|
486 + | }
|
487 + | }
|
488 + | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<SimpleStruct> {
|
489 + | fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
490 + | ob.extract::<SimpleStruct>().map(Box::new)
|
491 + | }
|
492 + | }
|
493 + |
|
494 + | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<SimpleStruct> {
|
495 + | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
496 + | (*self).into_py(py)
|
497 + | }
|
498 + | }
|
499 + | impl crate::constrained::Constrained for crate::model::SimpleStruct {
|
500 + | type Unconstrained = crate::model::simple_struct_internal::Builder;
|
501 + | }
|
502 + | impl SimpleStruct {
|
503 + | /// Creates a new builder-style object to manufacture [`SimpleStruct`](crate::model::SimpleStruct).
|
504 + | pub fn builder() -> crate::model::simple_struct::Builder {
|
505 + | crate::model::simple_struct::Builder::default()
|
506 + | }
|
507 + | }
|
508 + |
|
509 + | #[::pyo3::pyclass]
|
510 + | /// :param value typing.Optional\[str\]:
|
511 + | /// :rtype None:
|
512 + | #[allow(missing_docs)] // documentation missing in model
|
513 + | #[derive(
|
514 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
515 + | )]
|
516 + | pub struct StructWithJsonName {
|
517 + | #[pyo3(get, set)]
|
518 + | /// :type typing.Optional\[str\]:
|
519 + | #[allow(missing_docs)] // documentation missing in model
|
520 + | pub value: ::std::option::Option<::std::string::String>,
|
521 + | }
|
522 + | impl StructWithJsonName {
|
523 + | #[allow(missing_docs)] // documentation missing in model
|
524 + | pub fn value(&self) -> ::std::option::Option<&str> {
|
525 + | self.value.as_deref()
|
526 + | }
|
527 + | }
|
528 + | #[allow(clippy::new_without_default)]
|
529 + | #[allow(clippy::too_many_arguments)]
|
530 + | #[::pyo3::pymethods]
|
531 + | impl StructWithJsonName {
|
532 + | #[new]
|
533 + | pub fn new(value: ::std::option::Option<::std::string::String>) -> Self {
|
534 + | Self { value }
|
535 + | }
|
536 + | fn __repr__(&self) -> String {
|
537 + | format!("{self:?}")
|
538 + | }
|
539 + | fn __str__(&self) -> String {
|
540 + | format!("{self:?}")
|
541 + | }
|
542 + | }
|
543 + | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<StructWithJsonName> {
|
544 + | fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
545 + | ob.extract::<StructWithJsonName>().map(Box::new)
|
546 + | }
|
547 + | }
|
548 + |
|
549 + | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<StructWithJsonName> {
|
550 + | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
551 + | (*self).into_py(py)
|
552 + | }
|
553 + | }
|
554 + | impl crate::constrained::Constrained for crate::model::StructWithJsonName {
|
555 + | type Unconstrained = crate::model::struct_with_json_name_internal::Builder;
|
556 + | }
|
557 + | impl StructWithJsonName {
|
558 + | /// Creates a new builder-style object to manufacture [`StructWithJsonName`](crate::model::StructWithJsonName).
|
559 + | pub fn builder() -> crate::model::struct_with_json_name::Builder {
|
560 + | crate::model::struct_with_json_name::Builder::default()
|
561 + | }
|
562 + | }
|
563 + |
|
564 + | #[::pyo3::pyclass]
|
565 + | #[allow(missing_docs)] // documentation missing in model
|
566 + | #[derive(
|
567 + | ::std::clone::Clone,
|
568 + | ::std::cmp::Eq,
|
569 + | ::std::cmp::Ord,
|
570 + | ::std::cmp::PartialEq,
|
571 + | ::std::cmp::PartialOrd,
|
572 + | ::std::fmt::Debug,
|
573 + | ::std::hash::Hash,
|
574 + | )]
|
575 + | pub enum FooEnum {
|
576 + | #[allow(missing_docs)] // documentation missing in model
|
577 + | Zero,
|
578 + | #[allow(missing_docs)] // documentation missing in model
|
579 + | One,
|
580 + | #[allow(missing_docs)] // documentation missing in model
|
581 + | Bar,
|
582 + | #[allow(missing_docs)] // documentation missing in model
|
583 + | Baz,
|
584 + | #[allow(missing_docs)] // documentation missing in model
|
585 + | Foo,
|
586 + | }
|
587 + | pub(crate) mod foo_enum_internal {
|
588 + | #[derive(Debug, PartialEq)]
|
589 + | pub struct ConstraintViolation(pub(crate) ::std::string::String);
|
590 + |
|
591 + | impl ::std::fmt::Display for ConstraintViolation {
|
592 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
593 + | write!(
|
594 + | f,
|
595 + | r#"Value provided for 'aws.protocoltests.shared#FooEnum' failed to satisfy constraint: Member must satisfy enum value set: [Foo, Baz, Bar, 1, 0]"#
|
596 + | )
|
597 + | }
|
598 + | }
|
599 + |
|
600 + | impl ::std::error::Error for ConstraintViolation {}
|
601 + | impl ConstraintViolation {
|
602 + | pub(crate) fn as_validation_exception_field(
|
603 + | self,
|
604 + | path: ::std::string::String,
|
605 + | ) -> crate::model::ValidationExceptionField {
|
606 + | crate::model::ValidationExceptionField {
|
607 + | message: format!(
|
608 + | r#"Value at '{}' failed to satisfy constraint: Member must satisfy enum value set: [Foo, Baz, Bar, 1, 0]"#,
|
609 + | &path
|
610 + | ),
|
611 + | path,
|
612 + | }
|
613 + | }
|
614 + | }
|
615 + | }
|
616 + | impl ::std::convert::TryFrom<&str> for FooEnum {
|
617 + | type Error = crate::model::foo_enum_internal::ConstraintViolation;
|
618 + | fn try_from(
|
619 + | s: &str,
|
620 + | ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<&str>>::Error> {
|
621 + | match s {
|
622 + | "0" => Ok(FooEnum::Zero),
|
623 + | "1" => Ok(FooEnum::One),
|
624 + | "Bar" => Ok(FooEnum::Bar),
|
625 + | "Baz" => Ok(FooEnum::Baz),
|
626 + | "Foo" => Ok(FooEnum::Foo),
|
627 + | _ => Err(crate::model::foo_enum_internal::ConstraintViolation(
|
628 + | s.to_owned(),
|
629 + | )),
|
630 + | }
|
631 + | }
|
632 + | }
|
633 + | impl ::std::convert::TryFrom<::std::string::String> for FooEnum {
|
634 + | type Error = crate::model::foo_enum_internal::ConstraintViolation;
|
635 + | fn try_from(
|
636 + | s: ::std::string::String,
|
637 + | ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<::std::string::String>>::Error>
|
638 + | {
|
639 + | s.as_str().try_into()
|
640 + | }
|
641 + | }
|
642 + | impl std::str::FromStr for FooEnum {
|
643 + | type Err = crate::model::foo_enum_internal::ConstraintViolation;
|
644 + | fn from_str(s: &str) -> std::result::Result<Self, <Self as std::str::FromStr>::Err> {
|
645 + | Self::try_from(s)
|
646 + | }
|
647 + | }
|
648 + | impl FooEnum {
|
649 + | /// Returns the `&str` value of the enum member.
|
650 + | pub fn as_str(&self) -> &str {
|
651 + | match self {
|
652 + | FooEnum::Zero => "0",
|
653 + | FooEnum::One => "1",
|
654 + | FooEnum::Bar => "Bar",
|
655 + | FooEnum::Baz => "Baz",
|
656 + | FooEnum::Foo => "Foo",
|
657 + | }
|
658 + | }
|
659 + | /// Returns all the `&str` representations of the enum members.
|
660 + | pub const fn values() -> &'static [&'static str] {
|
661 + | &["0", "1", "Bar", "Baz", "Foo"]
|
662 + | }
|
663 + | }
|
664 + | impl ::std::convert::AsRef<str> for FooEnum {
|
665 + | fn as_ref(&self) -> &str {
|
666 + | self.as_str()
|
667 + | }
|
668 + | }
|
669 + | #[::pyo3::pymethods]
|
670 + | impl FooEnum {
|
671 + | #[getter]
|
672 + | pub fn name(&self) -> &str {
|
673 + | match self {
|
674 + | FooEnum::Zero => "Zero",
|
675 + | FooEnum::One => "One",
|
676 + | FooEnum::Bar => "Bar",
|
677 + | FooEnum::Baz => "Baz",
|
678 + | FooEnum::Foo => "Foo",
|
679 + | }
|
680 + | }
|
681 + | #[getter]
|
682 + | pub fn value(&self) -> &str {
|
683 + | self.as_str()
|
684 + | }
|
685 + | fn __repr__(&self) -> String {
|
686 + | self.as_str().to_owned()
|
1219 687 | }
|
1220 688 | fn __str__(&self) -> String {
|
1221 - | format!("{self:?}")
|
689 + | self.as_str().to_owned()
|
1222 690 | }
|
1223 691 | }
|
1224 - | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<KitchenSink> {
|
1225 - | fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
1226 - | ob.extract::<KitchenSink>().map(Box::new)
|
692 + | impl crate::constrained::Constrained for FooEnum {
|
693 + | type Unconstrained = ::std::string::String;
|
694 + | }
|
695 + |
|
696 + | impl ::std::convert::From<::std::string::String>
|
697 + | for crate::constrained::MaybeConstrained<crate::model::FooEnum>
|
698 + | {
|
699 + | fn from(value: ::std::string::String) -> Self {
|
700 + | Self::Unconstrained(value)
|
1227 701 | }
|
1228 702 | }
|
1229 703 |
|
1230 - | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<KitchenSink> {
|
1231 - | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
1232 - | (*self).into_py(py)
|
704 + | #[allow(missing_docs)] // documentation missing in model
|
705 + | ///
|
706 + | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
707 + | /// [constraint traits]. Use [`FooEnumSet::try_from`] to construct values of this type.
|
708 + | ///
|
709 + | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
710 + | ///
|
711 + | #[derive(
|
712 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
713 + | )]
|
714 + | pub(crate) struct FooEnumSet(pub(crate) ::std::vec::Vec<crate::model::FooEnum>);
|
715 + | impl FooEnumSet {
|
716 + | /// Consumes the value, returning the underlying [`::std::vec::Vec<crate::model::FooEnum>`].
|
717 + | pub fn into_inner(self) -> ::std::vec::Vec<crate::model::FooEnum> {
|
718 + | self.0
|
719 + | }
|
720 + |
|
721 + | fn check_unique_items(
|
722 + | items: ::std::vec::Vec<crate::model::FooEnum>,
|
723 + | ) -> ::std::result::Result<
|
724 + | ::std::vec::Vec<crate::model::FooEnum>,
|
725 + | crate::model::foo_enum_set_internal::ConstraintViolation,
|
726 + | > {
|
727 + | let mut seen = ::std::collections::HashMap::new();
|
728 + | let mut duplicate_indices = ::std::vec::Vec::new();
|
729 + | for (idx, item) in items.iter().enumerate() {
|
730 + | if let Some(prev_idx) = seen.insert(item, idx) {
|
731 + | duplicate_indices.push(prev_idx);
|
732 + | }
|
733 + | }
|
734 + |
|
735 + | let mut last_duplicate_indices = ::std::vec::Vec::new();
|
736 + | for idx in &duplicate_indices {
|
737 + | if let Some(prev_idx) = seen.remove(&items[*idx]) {
|
738 + | last_duplicate_indices.push(prev_idx);
|
739 + | }
|
740 + | }
|
741 + | duplicate_indices.extend(last_duplicate_indices);
|
742 + |
|
743 + | if !duplicate_indices.is_empty() {
|
744 + | debug_assert!(duplicate_indices.len() >= 2);
|
745 + | Err(
|
746 + | crate::model::foo_enum_set_internal::ConstraintViolation::UniqueItems {
|
747 + | duplicate_indices,
|
748 + | original: items,
|
749 + | },
|
750 + | )
|
751 + | } else {
|
752 + | Ok(items)
|
753 + | }
|
1233 754 | }
|
1234 755 | }
|
1235 - | impl crate::constrained::Constrained for crate::model::KitchenSink {
|
1236 - | type Unconstrained = crate::model::kitchen_sink_internal::Builder;
|
756 + | impl ::std::convert::TryFrom<::std::vec::Vec<crate::model::FooEnum>> for FooEnumSet {
|
757 + | type Error = crate::model::foo_enum_set_internal::ConstraintViolation;
|
758 + |
|
759 + | /// Constructs a `FooEnumSet` from an [`::std::vec::Vec<crate::model::FooEnum>`], failing when the provided value does not satisfy the modeled constraints.
|
760 + | fn try_from(
|
761 + | value: ::std::vec::Vec<crate::model::FooEnum>,
|
762 + | ) -> ::std::result::Result<Self, Self::Error> {
|
763 + | let value = Self::check_unique_items(value)?;
|
764 + |
|
765 + | Ok(Self(value))
|
766 + | }
|
1237 767 | }
|
1238 - | impl KitchenSink {
|
1239 - | /// Creates a new builder-style object to manufacture [`KitchenSink`](crate::model::KitchenSink).
|
1240 - | pub fn builder() -> crate::model::kitchen_sink::Builder {
|
1241 - | crate::model::kitchen_sink::Builder::default()
|
768 + |
|
769 + | impl ::std::convert::From<FooEnumSet> for ::std::vec::Vec<crate::model::FooEnum> {
|
770 + | fn from(value: FooEnumSet) -> Self {
|
771 + | value.into_inner()
|
1242 772 | }
|
1243 773 | }
|
774 + | impl crate::constrained::Constrained for FooEnumSet {
|
775 + | type Unconstrained = crate::unconstrained::foo_enum_set_unconstrained::FooEnumSetUnconstrained;
|
776 + | }
|
1244 777 |
|
1245 - | #[::pyo3::pyclass]
|
1246 - | /// :param value typing.Optional\[str\]:
|
1247 - | /// :rtype None:
|
1248 778 | #[allow(missing_docs)] // documentation missing in model
|
779 + | ///
|
780 + | /// This is a constrained type because its corresponding modeled Smithy shape has one or more
|
781 + | /// [constraint traits]. Use [`IntegerEnumSet::try_from`] to construct values of this type.
|
782 + | ///
|
783 + | /// [constraint traits]: https://smithy.io/2.0/spec/constraint-traits.html
|
784 + | ///
|
1249 785 | #[derive(
|
1250 786 | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
1251 787 | )]
|
1252 - | pub struct StructWithJsonName {
|
1253 - | #[pyo3(get, set)]
|
1254 - | /// :type typing.Optional\[str\]:
|
1255 - | #[allow(missing_docs)] // documentation missing in model
|
1256 - | pub value: ::std::option::Option<::std::string::String>,
|
1257 - | }
|
1258 - | impl StructWithJsonName {
|
1259 - | #[allow(missing_docs)] // documentation missing in model
|
1260 - | pub fn value(&self) -> ::std::option::Option<&str> {
|
1261 - | self.value.as_deref()
|
788 + | pub(crate) struct IntegerEnumSet(pub(crate) ::std::vec::Vec<i32>);
|
789 + | impl IntegerEnumSet {
|
790 + | /// Consumes the value, returning the underlying [`::std::vec::Vec<i32>`].
|
791 + | pub fn into_inner(self) -> ::std::vec::Vec<i32> {
|
792 + | self.0
|
1262 793 | }
|
1263 - | }
|
1264 - | #[allow(clippy::new_without_default)]
|
1265 - | #[allow(clippy::too_many_arguments)]
|
1266 - | #[::pyo3::pymethods]
|
1267 - | impl StructWithJsonName {
|
1268 - | #[new]
|
1269 - | pub fn new(value: ::std::option::Option<::std::string::String>) -> Self {
|
1270 - | Self { value }
|
794 + |
|
795 + | fn check_unique_items(
|
796 + | items: ::std::vec::Vec<i32>,
|
797 + | ) -> ::std::result::Result<
|
798 + | ::std::vec::Vec<i32>,
|
799 + | crate::model::integer_enum_set_internal::ConstraintViolation,
|
800 + | > {
|
801 + | let mut seen = ::std::collections::HashMap::new();
|
802 + | let mut duplicate_indices = ::std::vec::Vec::new();
|
803 + | for (idx, item) in items.iter().enumerate() {
|
804 + | if let Some(prev_idx) = seen.insert(item, idx) {
|
805 + | duplicate_indices.push(prev_idx);
|
1271 806 | }
|
1272 - | fn __repr__(&self) -> String {
|
1273 - | format!("{self:?}")
|
1274 807 | }
|
1275 - | fn __str__(&self) -> String {
|
1276 - | format!("{self:?}")
|
808 + |
|
809 + | let mut last_duplicate_indices = ::std::vec::Vec::new();
|
810 + | for idx in &duplicate_indices {
|
811 + | if let Some(prev_idx) = seen.remove(&items[*idx]) {
|
812 + | last_duplicate_indices.push(prev_idx);
|
1277 813 | }
|
1278 - | }
|
1279 - | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<StructWithJsonName> {
|
1280 - | fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
1281 - | ob.extract::<StructWithJsonName>().map(Box::new)
|
1282 814 | }
|
1283 - | }
|
815 + | duplicate_indices.extend(last_duplicate_indices);
|
1284 816 |
|
1285 - | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<StructWithJsonName> {
|
1286 - | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
1287 - | (*self).into_py(py)
|
817 + | if !duplicate_indices.is_empty() {
|
818 + | debug_assert!(duplicate_indices.len() >= 2);
|
819 + | Err(
|
820 + | crate::model::integer_enum_set_internal::ConstraintViolation::UniqueItems {
|
821 + | duplicate_indices,
|
822 + | original: items,
|
823 + | },
|
824 + | )
|
825 + | } else {
|
826 + | Ok(items)
|
827 + | }
|
1288 828 | }
|
1289 829 | }
|
1290 - | impl crate::constrained::Constrained for crate::model::StructWithJsonName {
|
1291 - | type Unconstrained = crate::model::struct_with_json_name_internal::Builder;
|
830 + | impl ::std::convert::TryFrom<::std::vec::Vec<i32>> for IntegerEnumSet {
|
831 + | type Error = crate::model::integer_enum_set_internal::ConstraintViolation;
|
832 + |
|
833 + | /// Constructs a `IntegerEnumSet` from an [`::std::vec::Vec<i32>`], failing when the provided value does not satisfy the modeled constraints.
|
834 + | fn try_from(value: ::std::vec::Vec<i32>) -> ::std::result::Result<Self, Self::Error> {
|
835 + | let value = Self::check_unique_items(value)?;
|
836 + |
|
837 + | Ok(Self(value))
|
838 + | }
|
1292 839 | }
|
1293 - | impl StructWithJsonName {
|
1294 - | /// Creates a new builder-style object to manufacture [`StructWithJsonName`](crate::model::StructWithJsonName).
|
1295 - | pub fn builder() -> crate::model::struct_with_json_name::Builder {
|
1296 - | crate::model::struct_with_json_name::Builder::default()
|
840 + |
|
841 + | impl ::std::convert::From<IntegerEnumSet> for ::std::vec::Vec<i32> {
|
842 + | fn from(value: IntegerEnumSet) -> Self {
|
843 + | value.into_inner()
|
1297 844 | }
|
1298 845 | }
|
846 + | impl crate::constrained::Constrained for IntegerEnumSet {
|
847 + | type Unconstrained =
|
848 + | crate::unconstrained::integer_enum_set_unconstrained::IntegerEnumSetUnconstrained;
|
849 + | }
|
1299 850 |
|
1300 851 | #[::pyo3::pyclass]
|
1301 - | /// :param value typing.Optional\[str\]:
|
852 + | /// :param foo typing.Optional\[str\]:
|
1302 853 | /// :rtype None:
|
1303 854 | #[allow(missing_docs)] // documentation missing in model
|
1304 855 | #[derive(
|
1305 856 | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
1306 857 | )]
|
1307 - | pub struct SimpleStruct {
|
858 + | pub struct ComplexNestedErrorData {
|
1308 859 | #[pyo3(get, set)]
|
1309 860 | /// :type typing.Optional\[str\]:
|
1310 861 | #[allow(missing_docs)] // documentation missing in model
|
1311 - | pub value: ::std::option::Option<::std::string::String>,
|
862 + | pub foo: ::std::option::Option<::std::string::String>,
|
1312 863 | }
|
1313 - | impl SimpleStruct {
|
864 + | impl ComplexNestedErrorData {
|
1314 865 | #[allow(missing_docs)] // documentation missing in model
|
1315 - | pub fn value(&self) -> ::std::option::Option<&str> {
|
1316 - | self.value.as_deref()
|
866 + | pub fn foo(&self) -> ::std::option::Option<&str> {
|
867 + | self.foo.as_deref()
|
1317 868 | }
|
1318 869 | }
|
1319 870 | #[allow(clippy::new_without_default)]
|
1320 871 | #[allow(clippy::too_many_arguments)]
|
1321 872 | #[::pyo3::pymethods]
|
1322 - | impl SimpleStruct {
|
873 + | impl ComplexNestedErrorData {
|
1323 874 | #[new]
|
1324 - | pub fn new(value: ::std::option::Option<::std::string::String>) -> Self {
|
1325 - | Self { value }
|
875 + | pub fn new(foo: ::std::option::Option<::std::string::String>) -> Self {
|
876 + | Self { foo }
|
1326 877 | }
|
1327 878 | fn __repr__(&self) -> String {
|
1328 879 | format!("{self:?}")
|
1329 880 | }
|
1330 881 | fn __str__(&self) -> String {
|
1331 882 | format!("{self:?}")
|
1332 883 | }
|
1333 884 | }
|
1334 - | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<SimpleStruct> {
|
885 + | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<ComplexNestedErrorData> {
|
1335 886 | fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
1336 - | ob.extract::<SimpleStruct>().map(Box::new)
|
887 + | ob.extract::<ComplexNestedErrorData>().map(Box::new)
|
1337 888 | }
|
1338 889 | }
|
1339 890 |
|
1340 - | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<SimpleStruct> {
|
891 + | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<ComplexNestedErrorData> {
|
1341 892 | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
1342 893 | (*self).into_py(py)
|
1343 894 | }
|
1344 895 | }
|
1345 - | impl crate::constrained::Constrained for crate::model::SimpleStruct {
|
1346 - | type Unconstrained = crate::model::simple_struct_internal::Builder;
|
1347 - | }
|
1348 - | impl SimpleStruct {
|
1349 - | /// Creates a new builder-style object to manufacture [`SimpleStruct`](crate::model::SimpleStruct).
|
1350 - | pub fn builder() -> crate::model::simple_struct::Builder {
|
1351 - | crate::model::simple_struct::Builder::default()
|
896 + | impl ComplexNestedErrorData {
|
897 + | /// Creates a new builder-style object to manufacture [`ComplexNestedErrorData`](crate::model::ComplexNestedErrorData).
|
898 + | pub fn builder() -> crate::model::complex_nested_error_data::Builder {
|
899 + | crate::model::complex_nested_error_data::Builder::default()
|
1352 900 | }
|
1353 901 | }
|
1354 902 |
|
1355 - | #[::pyo3::pyclass]
|
1356 - | /// :rtype None:
|
1357 - | #[allow(missing_docs)] // documentation missing in model
|
1358 - | #[derive(
|
1359 - | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
1360 - | )]
|
1361 - | pub struct EmptyStruct {}
|
1362 - | #[allow(clippy::new_without_default)]
|
1363 - | #[allow(clippy::too_many_arguments)]
|
1364 - | #[::pyo3::pymethods]
|
1365 - | impl EmptyStruct {
|
1366 - | #[new]
|
1367 - | pub fn new() -> Self {
|
1368 - | Self {}
|
903 + | /// A union with a representative set of types for members.
|
904 + | #[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
905 + | pub enum MyUnion {
|
906 + | #[allow(missing_docs)] // documentation missing in model
|
907 + | BlobValue(::aws_smithy_http_server_python::types::Blob),
|
908 + | #[allow(missing_docs)] // documentation missing in model
|
909 + | BooleanValue(bool),
|
910 + | #[allow(missing_docs)] // documentation missing in model
|
911 + | EnumValue(crate::model::FooEnum),
|
912 + | #[allow(missing_docs)] // documentation missing in model
|
913 + | ListValue(::std::vec::Vec<::std::string::String>),
|
914 + | #[allow(missing_docs)] // documentation missing in model
|
915 + | MapValue(::std::collections::HashMap<::std::string::String, ::std::string::String>),
|
916 + | #[allow(missing_docs)] // documentation missing in model
|
917 + | NumberValue(i32),
|
918 + | #[allow(missing_docs)] // documentation missing in model
|
919 + | StringValue(::std::string::String),
|
920 + | #[allow(missing_docs)] // documentation missing in model
|
921 + | StructureValue(crate::model::GreetingStruct),
|
922 + | #[allow(missing_docs)] // documentation missing in model
|
923 + | TimestampValue(::aws_smithy_http_server_python::types::DateTime),
|
924 + | }
|
925 + | impl MyUnion {
|
926 + | /// Tries to convert the enum instance into [`BlobValue`](crate::model::MyUnion::BlobValue), extracting the inner [`Blob`](::aws_smithy_http_server_python::types::Blob).
|
927 + | /// Returns `Err(&Self)` if it can't be converted.
|
928 + | pub fn as_blob_value(
|
929 + | &self,
|
930 + | ) -> ::std::result::Result<&::aws_smithy_http_server_python::types::Blob, &Self> {
|
931 + | if let MyUnion::BlobValue(val) = &self {
|
932 + | ::std::result::Result::Ok(val)
|
933 + | } else {
|
934 + | ::std::result::Result::Err(self)
|
1369 935 | }
|
1370 - | fn __repr__(&self) -> String {
|
1371 - | format!("{self:?}")
|
1372 936 | }
|
1373 - | fn __str__(&self) -> String {
|
1374 - | format!("{self:?}")
|
937 + | /// Returns true if this is a [`BlobValue`](crate::model::MyUnion::BlobValue).
|
938 + | pub fn is_blob_value(&self) -> bool {
|
939 + | self.as_blob_value().is_ok()
|
1375 940 | }
|
1376 - | }
|
1377 - | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<EmptyStruct> {
|
1378 - | fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
1379 - | ob.extract::<EmptyStruct>().map(Box::new)
|
941 + | /// Tries to convert the enum instance into [`BooleanValue`](crate::model::MyUnion::BooleanValue), extracting the inner [`bool`](bool).
|
942 + | /// Returns `Err(&Self)` if it can't be converted.
|
943 + | pub fn as_boolean_value(&self) -> ::std::result::Result<&bool, &Self> {
|
944 + | if let MyUnion::BooleanValue(val) = &self {
|
945 + | ::std::result::Result::Ok(val)
|
946 + | } else {
|
947 + | ::std::result::Result::Err(self)
|
1380 948 | }
|
1381 - | }
|
1382 - |
|
1383 - | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<EmptyStruct> {
|
1384 - | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
1385 - | (*self).into_py(py)
|
1386 949 | }
|
1387 - | }
|
1388 - | impl crate::constrained::Constrained for crate::model::EmptyStruct {
|
1389 - | type Unconstrained = crate::model::empty_struct_internal::Builder;
|
1390 - | }
|
1391 - | impl EmptyStruct {
|
1392 - | /// Creates a new builder-style object to manufacture [`EmptyStruct`](crate::model::EmptyStruct).
|
1393 - | pub fn builder() -> crate::model::empty_struct::Builder {
|
1394 - | crate::model::empty_struct::Builder::default()
|
950 + | /// Returns true if this is a [`BooleanValue`](crate::model::MyUnion::BooleanValue).
|
951 + | pub fn is_boolean_value(&self) -> bool {
|
952 + | self.as_boolean_value().is_ok()
|
1395 953 | }
|
1396 - | }
|
1397 - | /// See [`ValidationExceptionField`](crate::model::ValidationExceptionField).
|
1398 - | pub mod validation_exception_field {
|
1399 - |
|
1400 - | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
1401 - | /// Holds one variant for each of the ways the builder can fail.
|
1402 - | #[allow(clippy::enum_variant_names)]
|
1403 - | pub enum ConstraintViolation {
|
1404 - | /// `path` was not provided but it is required when building `ValidationExceptionField`.
|
1405 - | MissingPath,
|
1406 - | /// `message` was not provided but it is required when building `ValidationExceptionField`.
|
1407 - | MissingMessage,
|
954 + | /// Tries to convert the enum instance into [`EnumValue`](crate::model::MyUnion::EnumValue), extracting the inner [`FooEnum`](crate::model::FooEnum).
|
955 + | /// Returns `Err(&Self)` if it can't be converted.
|
956 + | pub fn as_enum_value(&self) -> ::std::result::Result<&crate::model::FooEnum, &Self> {
|
957 + | if let MyUnion::EnumValue(val) = &self {
|
958 + | ::std::result::Result::Ok(val)
|
959 + | } else {
|
960 + | ::std::result::Result::Err(self)
|
1408 961 | }
|
1409 - | impl ::std::fmt::Display for ConstraintViolation {
|
1410 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
1411 - | match self {
|
1412 - | ConstraintViolation::MissingPath => write!(f, "`path` was not provided but it is required when building `ValidationExceptionField`"),
|
1413 - | ConstraintViolation::MissingMessage => write!(f, "`message` was not provided but it is required when building `ValidationExceptionField`"),
|
1414 962 | }
|
963 + | /// Returns true if this is a [`EnumValue`](crate::model::MyUnion::EnumValue).
|
964 + | pub fn is_enum_value(&self) -> bool {
|
965 + | self.as_enum_value().is_ok()
|
1415 966 | }
|
967 + | /// Tries to convert the enum instance into [`ListValue`](crate::model::MyUnion::ListValue), extracting the inner [`Vec`](::std::vec::Vec).
|
968 + | /// Returns `Err(&Self)` if it can't be converted.
|
969 + | pub fn as_list_value(
|
970 + | &self,
|
971 + | ) -> ::std::result::Result<&::std::vec::Vec<::std::string::String>, &Self> {
|
972 + | if let MyUnion::ListValue(val) = &self {
|
973 + | ::std::result::Result::Ok(val)
|
974 + | } else {
|
975 + | ::std::result::Result::Err(self)
|
1416 976 | }
|
1417 - | impl ::std::error::Error for ConstraintViolation {}
|
1418 - | impl ::std::convert::TryFrom<Builder> for crate::model::ValidationExceptionField {
|
1419 - | type Error = ConstraintViolation;
|
1420 - |
|
1421 - | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
1422 - | builder.build()
|
977 + | }
|
978 + | /// Returns true if this is a [`ListValue`](crate::model::MyUnion::ListValue).
|
979 + | pub fn is_list_value(&self) -> bool {
|
980 + | self.as_list_value().is_ok()
|
981 + | }
|
982 + | /// Tries to convert the enum instance into [`MapValue`](crate::model::MyUnion::MapValue), extracting the inner [`HashMap`](::std::collections::HashMap).
|
983 + | /// Returns `Err(&Self)` if it can't be converted.
|
984 + | pub fn as_map_value(
|
985 + | &self,
|
986 + | ) -> ::std::result::Result<
|
987 + | &::std::collections::HashMap<::std::string::String, ::std::string::String>,
|
988 + | &Self,
|
989 + | > {
|
990 + | if let MyUnion::MapValue(val) = &self {
|
991 + | ::std::result::Result::Ok(val)
|
992 + | } else {
|
993 + | ::std::result::Result::Err(self)
|
994 + | }
|
995 + | }
|
996 + | /// Returns true if this is a [`MapValue`](crate::model::MyUnion::MapValue).
|
997 + | pub fn is_map_value(&self) -> bool {
|
998 + | self.as_map_value().is_ok()
|
999 + | }
|
1000 + | /// Tries to convert the enum instance into [`NumberValue`](crate::model::MyUnion::NumberValue), extracting the inner [`i32`](i32).
|
1001 + | /// Returns `Err(&Self)` if it can't be converted.
|
1002 + | pub fn as_number_value(&self) -> ::std::result::Result<&i32, &Self> {
|
1003 + | if let MyUnion::NumberValue(val) = &self {
|
1004 + | ::std::result::Result::Ok(val)
|
1005 + | } else {
|
1006 + | ::std::result::Result::Err(self)
|
1007 + | }
|
1008 + | }
|
1009 + | /// Returns true if this is a [`NumberValue`](crate::model::MyUnion::NumberValue).
|
1010 + | pub fn is_number_value(&self) -> bool {
|
1011 + | self.as_number_value().is_ok()
|
1012 + | }
|
1013 + | /// Tries to convert the enum instance into [`StringValue`](crate::model::MyUnion::StringValue), extracting the inner [`String`](::std::string::String).
|
1014 + | /// Returns `Err(&Self)` if it can't be converted.
|
1015 + | pub fn as_string_value(&self) -> ::std::result::Result<&::std::string::String, &Self> {
|
1016 + | if let MyUnion::StringValue(val) = &self {
|
1017 + | ::std::result::Result::Ok(val)
|
1018 + | } else {
|
1019 + | ::std::result::Result::Err(self)
|
1020 + | }
|
1021 + | }
|
1022 + | /// Returns true if this is a [`StringValue`](crate::model::MyUnion::StringValue).
|
1023 + | pub fn is_string_value(&self) -> bool {
|
1024 + | self.as_string_value().is_ok()
|
1025 + | }
|
1026 + | /// Tries to convert the enum instance into [`StructureValue`](crate::model::MyUnion::StructureValue), extracting the inner [`GreetingStruct`](crate::model::GreetingStruct).
|
1027 + | /// Returns `Err(&Self)` if it can't be converted.
|
1028 + | pub fn as_structure_value(
|
1029 + | &self,
|
1030 + | ) -> ::std::result::Result<&crate::model::GreetingStruct, &Self> {
|
1031 + | if let MyUnion::StructureValue(val) = &self {
|
1032 + | ::std::result::Result::Ok(val)
|
1033 + | } else {
|
1034 + | ::std::result::Result::Err(self)
|
1035 + | }
|
1036 + | }
|
1037 + | /// Returns true if this is a [`StructureValue`](crate::model::MyUnion::StructureValue).
|
1038 + | pub fn is_structure_value(&self) -> bool {
|
1039 + | self.as_structure_value().is_ok()
|
1040 + | }
|
1041 + | /// Tries to convert the enum instance into [`TimestampValue`](crate::model::MyUnion::TimestampValue), extracting the inner [`DateTime`](::aws_smithy_http_server_python::types::DateTime).
|
1042 + | /// Returns `Err(&Self)` if it can't be converted.
|
1043 + | pub fn as_timestamp_value(
|
1044 + | &self,
|
1045 + | ) -> ::std::result::Result<&::aws_smithy_http_server_python::types::DateTime, &Self> {
|
1046 + | if let MyUnion::TimestampValue(val) = &self {
|
1047 + | ::std::result::Result::Ok(val)
|
1048 + | } else {
|
1049 + | ::std::result::Result::Err(self)
|
1050 + | }
|
1051 + | }
|
1052 + | /// Returns true if this is a [`TimestampValue`](crate::model::MyUnion::TimestampValue).
|
1053 + | pub fn is_timestamp_value(&self) -> bool {
|
1054 + | self.as_timestamp_value().is_ok()
|
1055 + | }
|
1056 + | }
|
1057 + | #[pyo3::pyclass(name = "MyUnion")]
|
1058 + | #[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug)]
|
1059 + | pub struct PyUnionMarkerMyUnion(pub MyUnion);
|
1060 + | #[::pyo3::pymethods]
|
1061 + | impl PyUnionMarkerMyUnion {
|
1062 + | #[staticmethod]
|
1063 + | /// Creates a new union instance of [`BlobValue`](crate::model::MyUnion::BlobValue)
|
1064 + | /// :param data json_rpc11.types.Blob:
|
1065 + | /// :rtype MyUnion:
|
1066 + | pub fn blob_value(data: ::aws_smithy_http_server_python::types::Blob) -> Self {
|
1067 + | Self(MyUnion::BlobValue(data))
|
1068 + | }
|
1069 + | /// Tries to convert the enum instance into [`BlobValue`](crate::model::MyUnion::BlobValue), extracting the inner [`Blob`](::aws_smithy_http_server_python::types::Blob).
|
1070 + | /// :rtype json_rpc11.types.Blob:
|
1071 + | pub fn as_blob_value(&self) -> ::pyo3::PyResult<::aws_smithy_http_server_python::types::Blob> {
|
1072 + | match self.0.as_blob_value() {
|
1073 + | Ok(variant) => Ok(variant.clone()),
|
1074 + | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
1075 + | r"MyUnion variant is not of type json_rpc11.types.Blob",
|
1076 + | )),
|
1423 1077 | }
|
1424 1078 | }
|
1425 - | /// A builder for [`ValidationExceptionField`](crate::model::ValidationExceptionField).
|
1426 - | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
1427 - | pub struct Builder {
|
1428 - | pub(crate) path: ::std::option::Option<::std::string::String>,
|
1429 - | pub(crate) message: ::std::option::Option<::std::string::String>,
|
1079 + | /// Returns true if this is a [`BlobValue`](crate::model::MyUnion::BlobValue).
|
1080 + | /// :rtype bool:
|
1081 + | pub fn is_blob_value(&self) -> bool {
|
1082 + | self.0.is_blob_value()
|
1430 1083 | }
|
1431 - | impl Builder {
|
1432 - | /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
|
1433 - | pub fn path(mut self, input: ::std::string::String) -> Self {
|
1434 - | self.path = Some(input);
|
1435 - | self
|
1084 + | #[staticmethod]
|
1085 + | /// Creates a new union instance of [`BooleanValue`](crate::model::MyUnion::BooleanValue)
|
1086 + | /// :param data bool:
|
1087 + | /// :rtype MyUnion:
|
1088 + | pub fn boolean_value(data: bool) -> Self {
|
1089 + | Self(MyUnion::BooleanValue(data))
|
1436 1090 | }
|
1437 - | /// A detailed description of the validation failure.
|
1438 - | pub fn message(mut self, input: ::std::string::String) -> Self {
|
1439 - | self.message = Some(input);
|
1440 - | self
|
1091 + | /// Tries to convert the enum instance into [`BooleanValue`](crate::model::MyUnion::BooleanValue), extracting the inner [`bool`](bool).
|
1092 + | /// :rtype bool:
|
1093 + | pub fn as_boolean_value(&self) -> ::pyo3::PyResult<bool> {
|
1094 + | match self.0.as_boolean_value() {
|
1095 + | Ok(variant) => Ok(*variant),
|
1096 + | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
1097 + | r"MyUnion variant is not of type bool",
|
1098 + | )),
|
1441 1099 | }
|
1442 - | /// Consumes the builder and constructs a [`ValidationExceptionField`](crate::model::ValidationExceptionField).
|
1443 - | ///
|
1444 - | /// The builder fails to construct a [`ValidationExceptionField`](crate::model::ValidationExceptionField) if you do not provide a value for all non-`Option`al members.
|
1445 - | ///
|
1446 - | pub fn build(self) -> Result<crate::model::ValidationExceptionField, ConstraintViolation> {
|
1447 - | self.build_enforcing_required_and_enum_traits()
|
1448 1100 | }
|
1449 - | fn build_enforcing_required_and_enum_traits(
|
1450 - | self,
|
1451 - | ) -> Result<crate::model::ValidationExceptionField, ConstraintViolation> {
|
1452 - | Ok(crate::model::ValidationExceptionField {
|
1453 - | path: self.path.ok_or(ConstraintViolation::MissingPath)?,
|
1454 - | message: self.message.ok_or(ConstraintViolation::MissingMessage)?,
|
1455 - | })
|
1101 + | /// Returns true if this is a [`BooleanValue`](crate::model::MyUnion::BooleanValue).
|
1102 + | /// :rtype bool:
|
1103 + | pub fn is_boolean_value(&self) -> bool {
|
1104 + | self.0.is_boolean_value()
|
1456 1105 | }
|
1106 + | #[staticmethod]
|
1107 + | /// Creates a new union instance of [`EnumValue`](crate::model::MyUnion::EnumValue)
|
1108 + | /// :param data json_rpc11.model.FooEnum:
|
1109 + | /// :rtype MyUnion:
|
1110 + | pub fn enum_value(data: crate::model::FooEnum) -> Self {
|
1111 + | Self(MyUnion::EnumValue(data))
|
1457 1112 | }
|
1458 - | }
|
1459 - | pub(crate) mod my_union_internal {
|
1460 - |
|
1461 - | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
1462 - | #[allow(clippy::enum_variant_names)]
|
1463 - | pub(crate) enum ConstraintViolation {
|
1464 - | EnumValue(crate::model::foo_enum_internal::ConstraintViolation),
|
1113 + | /// Tries to convert the enum instance into [`EnumValue`](crate::model::MyUnion::EnumValue), extracting the inner [`FooEnum`](crate::model::FooEnum).
|
1114 + | /// :rtype json_rpc11.model.FooEnum:
|
1115 + | pub fn as_enum_value(&self) -> ::pyo3::PyResult<crate::model::FooEnum> {
|
1116 + | match self.0.as_enum_value() {
|
1117 + | Ok(variant) => Ok(variant.clone()),
|
1118 + | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
1119 + | r"MyUnion variant is not of type json_rpc11.model.FooEnum",
|
1120 + | )),
|
1465 1121 | }
|
1466 - | impl ::std::fmt::Display for ConstraintViolation {
|
1467 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
1468 - | match self {
|
1469 - | Self::EnumValue(inner) => write!(f, "{inner}"),
|
1470 1122 | }
|
1123 + | /// Returns true if this is a [`EnumValue`](crate::model::MyUnion::EnumValue).
|
1124 + | /// :rtype bool:
|
1125 + | pub fn is_enum_value(&self) -> bool {
|
1126 + | self.0.is_enum_value()
|
1471 1127 | }
|
1128 + | #[staticmethod]
|
1129 + | /// Creates a new union instance of [`ListValue`](crate::model::MyUnion::ListValue)
|
1130 + | /// :param data typing.List\[str\]:
|
1131 + | /// :rtype MyUnion:
|
1132 + | pub fn list_value(data: ::std::vec::Vec<::std::string::String>) -> Self {
|
1133 + | Self(MyUnion::ListValue(data))
|
1472 1134 | }
|
1473 - |
|
1474 - | impl ::std::error::Error for ConstraintViolation {}
|
1475 - | impl ConstraintViolation {
|
1476 - | pub(crate) fn as_validation_exception_field(
|
1477 - | self,
|
1478 - | path: ::std::string::String,
|
1479 - | ) -> crate::model::ValidationExceptionField {
|
1480 - | match self {
|
1481 - | Self::EnumValue(inner) => inner.as_validation_exception_field(path + "/enumValue"),
|
1135 + | /// Tries to convert the enum instance into [`ListValue`](crate::model::MyUnion::ListValue), extracting the inner [`Vec`](::std::vec::Vec).
|
1136 + | /// :rtype typing.List\[str\]:
|
1137 + | pub fn as_list_value(&self) -> ::pyo3::PyResult<::std::vec::Vec<::std::string::String>> {
|
1138 + | match self.0.as_list_value() {
|
1139 + | Ok(variant) => Ok(variant.clone()),
|
1140 + | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
1141 + | r"MyUnion variant is not of type typing.List\[str\]",
|
1142 + | )),
|
1482 1143 | }
|
1483 1144 | }
|
1145 + | /// Returns true if this is a [`ListValue`](crate::model::MyUnion::ListValue).
|
1146 + | /// :rtype bool:
|
1147 + | pub fn is_list_value(&self) -> bool {
|
1148 + | self.0.is_list_value()
|
1484 1149 | }
|
1485 - | }
|
1486 - | /// See [`GreetingStruct`](crate::model::GreetingStruct).
|
1487 - | pub(crate) mod greeting_struct_internal {
|
1488 - |
|
1489 - | impl ::std::convert::From<Builder> for crate::model::GreetingStruct {
|
1490 - | fn from(builder: Builder) -> Self {
|
1491 - | builder.build()
|
1150 + | #[staticmethod]
|
1151 + | /// Creates a new union instance of [`MapValue`](crate::model::MyUnion::MapValue)
|
1152 + | /// :param data typing.Dict\[str, str\]:
|
1153 + | /// :rtype MyUnion:
|
1154 + | pub fn map_value(
|
1155 + | data: ::std::collections::HashMap<::std::string::String, ::std::string::String>,
|
1156 + | ) -> Self {
|
1157 + | Self(MyUnion::MapValue(data))
|
1492 1158 | }
|
1159 + | /// Tries to convert the enum instance into [`MapValue`](crate::model::MyUnion::MapValue), extracting the inner [`HashMap`](::std::collections::HashMap).
|
1160 + | /// :rtype typing.Dict\[str, str\]:
|
1161 + | pub fn as_map_value(
|
1162 + | &self,
|
1163 + | ) -> ::pyo3::PyResult<::std::collections::HashMap<::std::string::String, ::std::string::String>>
|
1164 + | {
|
1165 + | match self.0.as_map_value() {
|
1166 + | Ok(variant) => Ok(variant.clone()),
|
1167 + | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
1168 + | r"MyUnion variant is not of type typing.Dict\[str, str\]",
|
1169 + | )),
|
1493 1170 | }
|
1494 - | /// A builder for [`GreetingStruct`](crate::model::GreetingStruct).
|
1495 - | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
1496 - | pub(crate) struct Builder {
|
1497 - | pub(crate) hi: ::std::option::Option<::std::string::String>,
|
1498 1171 | }
|
1499 - | impl Builder {
|
1500 - | #[allow(missing_docs)] // documentation missing in model
|
1501 - | pub(crate) fn set_hi(
|
1502 - | mut self,
|
1503 - | input: Option<impl ::std::convert::Into<::std::string::String>>,
|
1504 - | ) -> Self {
|
1505 - | self.hi = input.map(|v| v.into());
|
1506 - | self
|
1172 + | /// Returns true if this is a [`MapValue`](crate::model::MyUnion::MapValue).
|
1173 + | /// :rtype bool:
|
1174 + | pub fn is_map_value(&self) -> bool {
|
1175 + | self.0.is_map_value()
|
1507 1176 | }
|
1508 - | /// Consumes the builder and constructs a [`GreetingStruct`](crate::model::GreetingStruct).
|
1509 - | pub fn build(self) -> crate::model::GreetingStruct {
|
1510 - | self.build_enforcing_all_constraints()
|
1177 + | #[staticmethod]
|
1178 + | /// Creates a new union instance of [`NumberValue`](crate::model::MyUnion::NumberValue)
|
1179 + | /// :param data int:
|
1180 + | /// :rtype MyUnion:
|
1181 + | pub fn number_value(data: i32) -> Self {
|
1182 + | Self(MyUnion::NumberValue(data))
|
1511 1183 | }
|
1512 - | fn build_enforcing_all_constraints(self) -> crate::model::GreetingStruct {
|
1513 - | crate::model::GreetingStruct { hi: self.hi }
|
1184 + | /// Tries to convert the enum instance into [`NumberValue`](crate::model::MyUnion::NumberValue), extracting the inner [`i32`](i32).
|
1185 + | /// :rtype int:
|
1186 + | pub fn as_number_value(&self) -> ::pyo3::PyResult<i32> {
|
1187 + | match self.0.as_number_value() {
|
1188 + | Ok(variant) => Ok(*variant),
|
1189 + | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
1190 + | r"MyUnion variant is not of type int",
|
1191 + | )),
|
1514 1192 | }
|
1515 1193 | }
|
1516 - | }
|
1517 - | /// See [`GreetingStruct`](crate::model::GreetingStruct).
|
1518 - | pub mod greeting_struct {
|
1519 - |
|
1520 - | impl ::std::convert::From<Builder> for crate::model::GreetingStruct {
|
1521 - | fn from(builder: Builder) -> Self {
|
1522 - | builder.build()
|
1194 + | /// Returns true if this is a [`NumberValue`](crate::model::MyUnion::NumberValue).
|
1195 + | /// :rtype bool:
|
1196 + | pub fn is_number_value(&self) -> bool {
|
1197 + | self.0.is_number_value()
|
1523 1198 | }
|
1199 + | #[staticmethod]
|
1200 + | /// Creates a new union instance of [`StringValue`](crate::model::MyUnion::StringValue)
|
1201 + | /// :param data str:
|
1202 + | /// :rtype MyUnion:
|
1203 + | pub fn string_value(data: ::std::string::String) -> Self {
|
1204 + | Self(MyUnion::StringValue(data))
|
1524 1205 | }
|
1525 - | /// A builder for [`GreetingStruct`](crate::model::GreetingStruct).
|
1526 - | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
1527 - | pub struct Builder {
|
1528 - | pub(crate) hi: ::std::option::Option<::std::string::String>,
|
1206 + | /// Tries to convert the enum instance into [`StringValue`](crate::model::MyUnion::StringValue), extracting the inner [`String`](::std::string::String).
|
1207 + | /// :rtype str:
|
1208 + | pub fn as_string_value(&self) -> ::pyo3::PyResult<::std::string::String> {
|
1209 + | match self.0.as_string_value() {
|
1210 + | Ok(variant) => Ok(variant.clone()),
|
1211 + | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
1212 + | r"MyUnion variant is not of type str",
|
1213 + | )),
|
1529 1214 | }
|
1530 - | impl Builder {
|
1531 - | #[allow(missing_docs)] // documentation missing in model
|
1532 - | pub fn hi(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
1533 - | self.hi = input;
|
1534 - | self
|
1535 1215 | }
|
1536 - | /// Consumes the builder and constructs a [`GreetingStruct`](crate::model::GreetingStruct).
|
1537 - | pub fn build(self) -> crate::model::GreetingStruct {
|
1538 - | self.build_enforcing_required_and_enum_traits()
|
1216 + | /// Returns true if this is a [`StringValue`](crate::model::MyUnion::StringValue).
|
1217 + | /// :rtype bool:
|
1218 + | pub fn is_string_value(&self) -> bool {
|
1219 + | self.0.is_string_value()
|
1539 1220 | }
|
1540 - | fn build_enforcing_required_and_enum_traits(self) -> crate::model::GreetingStruct {
|
1541 - | crate::model::GreetingStruct { hi: self.hi }
|
1221 + | #[staticmethod]
|
1222 + | /// Creates a new union instance of [`StructureValue`](crate::model::MyUnion::StructureValue)
|
1223 + | /// :param data json_rpc11.model.GreetingStruct:
|
1224 + | /// :rtype MyUnion:
|
1225 + | pub fn structure_value(data: crate::model::GreetingStruct) -> Self {
|
1226 + | Self(MyUnion::StructureValue(data))
|
1542 1227 | }
|
1228 + | /// Tries to convert the enum instance into [`StructureValue`](crate::model::MyUnion::StructureValue), extracting the inner [`GreetingStruct`](crate::model::GreetingStruct).
|
1229 + | /// :rtype json_rpc11.model.GreetingStruct:
|
1230 + | pub fn as_structure_value(&self) -> ::pyo3::PyResult<crate::model::GreetingStruct> {
|
1231 + | match self.0.as_structure_value() {
|
1232 + | Ok(variant) => Ok(variant.clone()),
|
1233 + | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
1234 + | r"MyUnion variant is not of type json_rpc11.model.GreetingStruct",
|
1235 + | )),
|
1543 1236 | }
|
1544 - | }
|
1545 - | /// See [`ComplexNestedErrorData`](crate::model::ComplexNestedErrorData).
|
1546 - | pub mod complex_nested_error_data {
|
1547 - |
|
1548 - | impl ::std::convert::From<Builder> for crate::model::ComplexNestedErrorData {
|
1549 - | fn from(builder: Builder) -> Self {
|
1550 - | builder.build()
|
1551 1237 | }
|
1238 + | /// Returns true if this is a [`StructureValue`](crate::model::MyUnion::StructureValue).
|
1239 + | /// :rtype bool:
|
1240 + | pub fn is_structure_value(&self) -> bool {
|
1241 + | self.0.is_structure_value()
|
1552 1242 | }
|
1553 - | /// A builder for [`ComplexNestedErrorData`](crate::model::ComplexNestedErrorData).
|
1554 - | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
1555 - | pub struct Builder {
|
1556 - | pub(crate) foo: ::std::option::Option<::std::string::String>,
|
1243 + | #[staticmethod]
|
1244 + | /// Creates a new union instance of [`TimestampValue`](crate::model::MyUnion::TimestampValue)
|
1245 + | /// :param data json_rpc11.types.DateTime:
|
1246 + | /// :rtype MyUnion:
|
1247 + | pub fn timestamp_value(data: ::aws_smithy_http_server_python::types::DateTime) -> Self {
|
1248 + | Self(MyUnion::TimestampValue(data))
|
1557 1249 | }
|
1558 - | impl Builder {
|
1559 - | #[allow(missing_docs)] // documentation missing in model
|
1560 - | pub fn foo(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
1561 - | self.foo = input;
|
1562 - | self
|
1250 + | /// Tries to convert the enum instance into [`TimestampValue`](crate::model::MyUnion::TimestampValue), extracting the inner [`DateTime`](::aws_smithy_http_server_python::types::DateTime).
|
1251 + | /// :rtype json_rpc11.types.DateTime:
|
1252 + | pub fn as_timestamp_value(
|
1253 + | &self,
|
1254 + | ) -> ::pyo3::PyResult<::aws_smithy_http_server_python::types::DateTime> {
|
1255 + | match self.0.as_timestamp_value() {
|
1256 + | Ok(variant) => Ok(variant.clone()),
|
1257 + | Err(_) => Err(::pyo3::exceptions::PyValueError::new_err(
|
1258 + | r"MyUnion variant is not of type json_rpc11.types.DateTime",
|
1259 + | )),
|
1563 1260 | }
|
1564 - | /// Consumes the builder and constructs a [`ComplexNestedErrorData`](crate::model::ComplexNestedErrorData).
|
1565 - | pub fn build(self) -> crate::model::ComplexNestedErrorData {
|
1566 - | self.build_enforcing_required_and_enum_traits()
|
1567 1261 | }
|
1568 - | fn build_enforcing_required_and_enum_traits(self) -> crate::model::ComplexNestedErrorData {
|
1569 - | crate::model::ComplexNestedErrorData { foo: self.foo }
|
1262 + | /// Returns true if this is a [`TimestampValue`](crate::model::MyUnion::TimestampValue).
|
1263 + | /// :rtype bool:
|
1264 + | pub fn is_timestamp_value(&self) -> bool {
|
1265 + | self.0.is_timestamp_value()
|
1570 1266 | }
|
1267 + | }
|
1268 + | impl ::pyo3::IntoPy<::pyo3::PyObject> for MyUnion {
|
1269 + | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
1270 + | PyUnionMarkerMyUnion(self).into_py(py)
|
1571 1271 | }
|
1572 1272 | }
|
1573 - | pub(crate) mod integer_enum_set_internal {
|
1574 - |
|
1575 - | #[allow(clippy::enum_variant_names)]
|
1576 - | #[derive(Debug, PartialEq)]
|
1577 - | pub(crate) enum ConstraintViolation {
|
1578 - | /// Constraint violation error when the list does not contain unique items
|
1579 - | UniqueItems {
|
1580 - | /// A vector of indices into `original` pointing to all duplicate items. This vector has
|
1581 - | /// at least two elements.
|
1582 - | /// More specifically, for every element `idx_1` in `duplicate_indices`, there exists another
|
1583 - | /// distinct element `idx_2` such that `original[idx_1] == original[idx_2]` is `true`.
|
1584 - | /// Nothing is guaranteed about the order of the indices.
|
1585 - | duplicate_indices: ::std::vec::Vec<usize>,
|
1586 - | /// The original vector, that contains duplicate items.
|
1587 - | original: ::std::vec::Vec<i32>,
|
1588 - | },
|
1273 + | impl<'source> ::pyo3::FromPyObject<'source> for MyUnion {
|
1274 + | fn extract(obj: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
1275 + | let data: PyUnionMarkerMyUnion = obj.extract()?;
|
1276 + | Ok(data.0)
|
1589 1277 | }
|
1278 + | }
|
1590 1279 |
|
1591 - | impl ::std::fmt::Display for ConstraintViolation {
|
1592 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
1593 - | let message = match self {
|
1594 - | Self::UniqueItems { duplicate_indices, .. } =>
|
1595 - | format!("Value with repeated values at indices {:?} provided for 'aws.protocoltests.shared#IntegerEnumSet' failed to satisfy constraint: Member must have unique values", &duplicate_indices),
|
1596 - | };
|
1597 - | write!(f, "{message}")
|
1280 + | #[::pyo3::pyclass]
|
1281 + | /// :param path str:
|
1282 + | /// :param message str:
|
1283 + | /// :rtype None:
|
1284 + | /// Describes one specific validation failure for an input member.
|
1285 + | #[derive(
|
1286 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
1287 + | )]
|
1288 + | pub struct ValidationExceptionField {
|
1289 + | #[pyo3(get, set)]
|
1290 + | /// :type str:
|
1291 + | /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
|
1292 + | pub path: ::std::string::String,
|
1293 + | #[pyo3(get, set)]
|
1294 + | /// :type str:
|
1295 + | /// A detailed description of the validation failure.
|
1296 + | pub message: ::std::string::String,
|
1297 + | }
|
1298 + | impl ValidationExceptionField {
|
1299 + | /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
|
1300 + | pub fn path(&self) -> &str {
|
1301 + | use std::ops::Deref;
|
1302 + | self.path.deref()
|
1598 1303 | }
|
1304 + | /// A detailed description of the validation failure.
|
1305 + | pub fn message(&self) -> &str {
|
1306 + | use std::ops::Deref;
|
1307 + | self.message.deref()
|
1599 1308 | }
|
1600 - |
|
1601 - | impl ::std::error::Error for ConstraintViolation {}
|
1602 - | impl ConstraintViolation {
|
1603 - | pub(crate) fn as_validation_exception_field(
|
1604 - | self,
|
1605 - | path: ::std::string::String,
|
1606 - | ) -> crate::model::ValidationExceptionField {
|
1607 - | match self {
|
1608 - | Self::UniqueItems { duplicate_indices, .. } =>
|
1609 - | crate::model::ValidationExceptionField {
|
1610 - | message: format!("Value with repeated values at indices {:?} at '{}' failed to satisfy constraint: Member must have unique values", &duplicate_indices, &path),
|
1611 - | path,
|
1612 - | },
|
1309 + | }
|
1310 + | #[allow(clippy::new_without_default)]
|
1311 + | #[allow(clippy::too_many_arguments)]
|
1312 + | #[::pyo3::pymethods]
|
1313 + | impl ValidationExceptionField {
|
1314 + | #[new]
|
1315 + | pub fn new(path: ::std::string::String, message: ::std::string::String) -> Self {
|
1316 + | Self { path, message }
|
1613 1317 | }
|
1318 + | fn __repr__(&self) -> String {
|
1319 + | format!("{self:?}")
|
1614 1320 | }
|
1321 + | fn __str__(&self) -> String {
|
1322 + | format!("{self:?}")
|
1615 1323 | }
|
1616 1324 | }
|
1617 - | pub(crate) mod foo_enum_map_internal {
|
1618 - |
|
1619 - | #[allow(clippy::enum_variant_names)]
|
1620 - | #[derive(Debug, PartialEq)]
|
1621 - | pub(crate) enum ConstraintViolation {
|
1622 - | #[doc(hidden)]
|
1623 - | Value(
|
1624 - | ::std::string::String,
|
1625 - | crate::model::foo_enum_internal::ConstraintViolation,
|
1626 - | ),
|
1325 + | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<ValidationExceptionField> {
|
1326 + | fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
1327 + | ob.extract::<ValidationExceptionField>().map(Box::new)
|
1627 1328 | }
|
1329 + | }
|
1628 1330 |
|
1629 - | impl ::std::fmt::Display for ConstraintViolation {
|
1630 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
1631 - | match self {
|
1632 - | Self::Value(_, value_constraint_violation) => {
|
1633 - | write!(f, "{}", value_constraint_violation)
|
1634 - | }
|
1635 - | }
|
1331 + | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<ValidationExceptionField> {
|
1332 + | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
1333 + | (*self).into_py(py)
|
1636 1334 | }
|
1335 + | }
|
1336 + | impl ValidationExceptionField {
|
1337 + | /// Creates a new builder-style object to manufacture [`ValidationExceptionField`](crate::model::ValidationExceptionField).
|
1338 + | pub fn builder() -> crate::model::validation_exception_field::Builder {
|
1339 + | crate::model::validation_exception_field::Builder::default()
|
1637 1340 | }
|
1341 + | }
|
1638 1342 |
|
1639 - | impl ::std::error::Error for ConstraintViolation {}
|
1640 - | impl ConstraintViolation {
|
1641 - | pub(crate) fn as_validation_exception_field(
|
1642 - | self,
|
1643 - | path: ::std::string::String,
|
1644 - | ) -> crate::model::ValidationExceptionField {
|
1645 - | match self {
|
1646 - | Self::Value(key, value_constraint_violation) => value_constraint_violation
|
1647 - | .as_validation_exception_field(path + "/" + key.as_str()),
|
1343 + | #[::pyo3::pyclass]
|
1344 + | /// :param hi typing.Optional\[str\]:
|
1345 + | /// :rtype None:
|
1346 + | #[allow(missing_docs)] // documentation missing in model
|
1347 + | #[derive(
|
1348 + | ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
|
1349 + | )]
|
1350 + | pub struct GreetingStruct {
|
1351 + | #[pyo3(get, set)]
|
1352 + | /// :type typing.Optional\[str\]:
|
1353 + | #[allow(missing_docs)] // documentation missing in model
|
1354 + | pub hi: ::std::option::Option<::std::string::String>,
|
1355 + | }
|
1356 + | impl GreetingStruct {
|
1357 + | #[allow(missing_docs)] // documentation missing in model
|
1358 + | pub fn hi(&self) -> ::std::option::Option<&str> {
|
1359 + | self.hi.as_deref()
|
1360 + | }
|
1361 + | }
|
1362 + | #[allow(clippy::new_without_default)]
|
1363 + | #[allow(clippy::too_many_arguments)]
|
1364 + | #[::pyo3::pymethods]
|
1365 + | impl GreetingStruct {
|
1366 + | #[new]
|
1367 + | pub fn new(hi: ::std::option::Option<::std::string::String>) -> Self {
|
1368 + | Self { hi }
|
1648 1369 | }
|
1370 + | fn __repr__(&self) -> String {
|
1371 + | format!("{self:?}")
|
1649 1372 | }
|
1373 + | fn __str__(&self) -> String {
|
1374 + | format!("{self:?}")
|
1650 1375 | }
|
1651 1376 | }
|
1652 - | pub(crate) mod foo_enum_set_internal {
|
1653 - |
|
1654 - | #[allow(clippy::enum_variant_names)]
|
1655 - | #[derive(Debug, PartialEq)]
|
1656 - | pub(crate) enum ConstraintViolation {
|
1657 - | /// Constraint violation error when the list does not contain unique items
|
1658 - | UniqueItems {
|
1659 - | /// A vector of indices into `original` pointing to all duplicate items. This vector has
|
1660 - | /// at least two elements.
|
1661 - | /// More specifically, for every element `idx_1` in `duplicate_indices`, there exists another
|
1662 - | /// distinct element `idx_2` such that `original[idx_1] == original[idx_2]` is `true`.
|
1663 - | /// Nothing is guaranteed about the order of the indices.
|
1664 - | duplicate_indices: ::std::vec::Vec<usize>,
|
1665 - | /// The original vector, that contains duplicate items.
|
1666 - | original: ::std::vec::Vec<crate::model::FooEnum>,
|
1667 - | },
|
1668 - | /// Constraint violation error when an element doesn't satisfy its own constraints.
|
1669 - | /// The first component of the tuple is the index in the collection where the
|
1670 - | /// first constraint violation was found.
|
1671 - | #[doc(hidden)]
|
1672 - | Member(usize, crate::model::foo_enum_internal::ConstraintViolation),
|
1377 + | impl<'source> ::pyo3::FromPyObject<'source> for std::boxed::Box<GreetingStruct> {
|
1378 + | fn extract(ob: &'source ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
1379 + | ob.extract::<GreetingStruct>().map(Box::new)
|
1673 1380 | }
|
1381 + | }
|
1674 1382 |
|
1675 - | impl ::std::fmt::Display for ConstraintViolation {
|
1676 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
1677 - | let message = match self {
|
1678 - | Self::UniqueItems { duplicate_indices, .. } =>
|
1679 - | format!("Value with repeated values at indices {:?} provided for 'aws.protocoltests.shared#FooEnumSet' failed to satisfy constraint: Member must have unique values", &duplicate_indices),
|
1680 - | Self::Member(index, failing_member) => format!("Value at index {index} failed to satisfy constraint. {}",
|
1681 - | failing_member)
|
1682 - | };
|
1683 - | write!(f, "{message}")
|
1383 + | impl ::pyo3::IntoPy<::pyo3::PyObject> for std::boxed::Box<GreetingStruct> {
|
1384 + | fn into_py(self, py: ::pyo3::Python<'_>) -> ::pyo3::PyObject {
|
1385 + | (*self).into_py(py)
|
1684 1386 | }
|
1387 + | }
|
1388 + | impl crate::constrained::Constrained for crate::model::GreetingStruct {
|
1389 + | type Unconstrained = crate::model::greeting_struct_internal::Builder;
|
1390 + | }
|
1391 + | impl GreetingStruct {
|
1392 + | /// Creates a new builder-style object to manufacture [`GreetingStruct`](crate::model::GreetingStruct).
|
1393 + | pub fn builder() -> crate::model::greeting_struct::Builder {
|
1394 + | crate::model::greeting_struct::Builder::default()
|
1685 1395 | }
|
1396 + | }
|
1397 + | /// See [`EmptyStruct`](crate::model::EmptyStruct).
|
1398 + | pub(crate) mod empty_struct_internal {
|
1686 1399 |
|
1687 - | impl ::std::error::Error for ConstraintViolation {}
|
1688 - | impl ConstraintViolation {
|
1689 - | pub(crate) fn as_validation_exception_field(
|
1690 - | self,
|
1691 - | path: ::std::string::String,
|
1692 - | ) -> crate::model::ValidationExceptionField {
|
1693 - | match self {
|
1694 - | Self::UniqueItems { duplicate_indices, .. } =>
|
1695 - | crate::model::ValidationExceptionField {
|
1696 - | message: format!("Value with repeated values at indices {:?} at '{}' failed to satisfy constraint: Member must have unique values", &duplicate_indices, &path),
|
1697 - | path,
|
1698 - | },
|
1699 - | Self::Member(index, member_constraint_violation) =>
|
1700 - | member_constraint_violation.as_validation_exception_field(path + "/" + &index.to_string())
|
1400 + | impl ::std::convert::From<Builder> for crate::model::EmptyStruct {
|
1401 + | fn from(builder: Builder) -> Self {
|
1402 + | builder.build()
|
1701 1403 | }
|
1702 1404 | }
|
1405 + | /// A builder for [`EmptyStruct`](crate::model::EmptyStruct).
|
1406 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
1407 + | pub(crate) struct Builder {}
|
1408 + | impl Builder {
|
1409 + | /// Consumes the builder and constructs a [`EmptyStruct`](crate::model::EmptyStruct).
|
1410 + | pub fn build(self) -> crate::model::EmptyStruct {
|
1411 + | self.build_enforcing_all_constraints()
|
1703 1412 | }
|
1704 - | }
|
1705 - | pub(crate) mod foo_enum_list_internal {
|
1706 - |
|
1707 - | #[allow(clippy::enum_variant_names)]
|
1708 - | #[derive(Debug, PartialEq)]
|
1709 - | pub(crate) enum ConstraintViolation {
|
1710 - | /// Constraint violation error when an element doesn't satisfy its own constraints.
|
1711 - | /// The first component of the tuple is the index in the collection where the
|
1712 - | /// first constraint violation was found.
|
1713 - | #[doc(hidden)]
|
1714 - | Member(usize, crate::model::foo_enum_internal::ConstraintViolation),
|
1413 + | fn build_enforcing_all_constraints(self) -> crate::model::EmptyStruct {
|
1414 + | crate::model::EmptyStruct {}
|
1715 1415 | }
|
1416 + | }
|
1417 + | }
|
1418 + | /// See [`EmptyStruct`](crate::model::EmptyStruct).
|
1419 + | pub mod empty_struct {
|
1716 1420 |
|
1717 - | impl ::std::fmt::Display for ConstraintViolation {
|
1718 - | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
1719 - | let message = match self {
|
1720 - | Self::Member(index, failing_member) => format!(
|
1721 - | "Value at index {index} failed to satisfy constraint. {}",
|
1722 - | failing_member
|
1723 - | ),
|
1724 - | };
|
1725 - | write!(f, "{message}")
|
1421 + | impl ::std::convert::From<Builder> for crate::model::EmptyStruct {
|
1422 + | fn from(builder: Builder) -> Self {
|
1423 + | builder.build()
|
1726 1424 | }
|
1727 1425 | }
|
1728 - |
|
1729 - | impl ::std::error::Error for ConstraintViolation {}
|
1730 - | impl ConstraintViolation {
|
1731 - | pub(crate) fn as_validation_exception_field(
|
1732 - | self,
|
1733 - | path: ::std::string::String,
|
1734 - | ) -> crate::model::ValidationExceptionField {
|
1735 - | match self {
|
1736 - | Self::Member(index, member_constraint_violation) => member_constraint_violation
|
1737 - | .as_validation_exception_field(path + "/" + &index.to_string()),
|
1426 + | /// A builder for [`EmptyStruct`](crate::model::EmptyStruct).
|
1427 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
1428 + | pub struct Builder {}
|
1429 + | impl Builder {
|
1430 + | /// Consumes the builder and constructs a [`EmptyStruct`](crate::model::EmptyStruct).
|
1431 + | pub fn build(self) -> crate::model::EmptyStruct {
|
1432 + | self.build_enforcing_required_and_enum_traits()
|
1738 1433 | }
|
1434 + | fn build_enforcing_required_and_enum_traits(self) -> crate::model::EmptyStruct {
|
1435 + | crate::model::EmptyStruct {}
|
1739 1436 | }
|
1740 1437 | }
|
1741 1438 | }
|
1742 1439 | /// See [`KitchenSink`](crate::model::KitchenSink).
|
1743 1440 | pub(crate) mod kitchen_sink_internal {
|
1744 1441 |
|
1745 1442 | impl ::std::convert::From<Builder> for crate::model::KitchenSink {
|
1746 1443 | fn from(builder: Builder) -> Self {
|
1747 1444 | builder.build()
|
1748 1445 | }
|
2382 2079 | recursive_map: self.recursive_map,
|
2383 2080 | recursive_struct: self.recursive_struct,
|
2384 2081 | simple_struct: self.simple_struct,
|
2385 2082 | string: self.string,
|
2386 2083 | struct_with_json_name: self.struct_with_json_name,
|
2387 2084 | timestamp: self.timestamp,
|
2388 2085 | unix_timestamp: self.unix_timestamp,
|
2389 2086 | }
|
2390 2087 | }
|
2391 2088 | }
|
2392 - | }
|
2393 - | /// See [`StructWithJsonName`](crate::model::StructWithJsonName).
|
2394 - | pub(crate) mod struct_with_json_name_internal {
|
2089 + | }
|
2090 + | /// See [`SimpleStruct`](crate::model::SimpleStruct).
|
2091 + | pub(crate) mod simple_struct_internal {
|
2092 + |
|
2093 + | impl ::std::convert::From<Builder> for crate::model::SimpleStruct {
|
2094 + | fn from(builder: Builder) -> Self {
|
2095 + | builder.build()
|
2096 + | }
|
2097 + | }
|
2098 + | /// A builder for [`SimpleStruct`](crate::model::SimpleStruct).
|
2099 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
2100 + | pub(crate) struct Builder {
|
2101 + | pub(crate) value: ::std::option::Option<::std::string::String>,
|
2102 + | }
|
2103 + | impl Builder {
|
2104 + | #[allow(missing_docs)] // documentation missing in model
|
2105 + | pub(crate) fn set_value(
|
2106 + | mut self,
|
2107 + | input: Option<impl ::std::convert::Into<::std::string::String>>,
|
2108 + | ) -> Self {
|
2109 + | self.value = input.map(|v| v.into());
|
2110 + | self
|
2111 + | }
|
2112 + | /// Consumes the builder and constructs a [`SimpleStruct`](crate::model::SimpleStruct).
|
2113 + | pub fn build(self) -> crate::model::SimpleStruct {
|
2114 + | self.build_enforcing_all_constraints()
|
2115 + | }
|
2116 + | fn build_enforcing_all_constraints(self) -> crate::model::SimpleStruct {
|
2117 + | crate::model::SimpleStruct { value: self.value }
|
2118 + | }
|
2119 + | }
|
2120 + | }
|
2121 + | /// See [`SimpleStruct`](crate::model::SimpleStruct).
|
2122 + | pub mod simple_struct {
|
2123 + |
|
2124 + | impl ::std::convert::From<Builder> for crate::model::SimpleStruct {
|
2125 + | fn from(builder: Builder) -> Self {
|
2126 + | builder.build()
|
2127 + | }
|
2128 + | }
|
2129 + | /// A builder for [`SimpleStruct`](crate::model::SimpleStruct).
|
2130 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
2131 + | pub struct Builder {
|
2132 + | pub(crate) value: ::std::option::Option<::std::string::String>,
|
2133 + | }
|
2134 + | impl Builder {
|
2135 + | #[allow(missing_docs)] // documentation missing in model
|
2136 + | pub fn value(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
2137 + | self.value = input;
|
2138 + | self
|
2139 + | }
|
2140 + | /// Consumes the builder and constructs a [`SimpleStruct`](crate::model::SimpleStruct).
|
2141 + | pub fn build(self) -> crate::model::SimpleStruct {
|
2142 + | self.build_enforcing_required_and_enum_traits()
|
2143 + | }
|
2144 + | fn build_enforcing_required_and_enum_traits(self) -> crate::model::SimpleStruct {
|
2145 + | crate::model::SimpleStruct { value: self.value }
|
2146 + | }
|
2147 + | }
|
2148 + | }
|
2149 + | /// See [`StructWithJsonName`](crate::model::StructWithJsonName).
|
2150 + | pub(crate) mod struct_with_json_name_internal {
|
2151 + |
|
2152 + | impl ::std::convert::From<Builder> for crate::model::StructWithJsonName {
|
2153 + | fn from(builder: Builder) -> Self {
|
2154 + | builder.build()
|
2155 + | }
|
2156 + | }
|
2157 + | /// A builder for [`StructWithJsonName`](crate::model::StructWithJsonName).
|
2158 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
2159 + | pub(crate) struct Builder {
|
2160 + | pub(crate) value: ::std::option::Option<::std::string::String>,
|
2161 + | }
|
2162 + | impl Builder {
|
2163 + | #[allow(missing_docs)] // documentation missing in model
|
2164 + | pub(crate) fn set_value(
|
2165 + | mut self,
|
2166 + | input: Option<impl ::std::convert::Into<::std::string::String>>,
|
2167 + | ) -> Self {
|
2168 + | self.value = input.map(|v| v.into());
|
2169 + | self
|
2170 + | }
|
2171 + | /// Consumes the builder and constructs a [`StructWithJsonName`](crate::model::StructWithJsonName).
|
2172 + | pub fn build(self) -> crate::model::StructWithJsonName {
|
2173 + | self.build_enforcing_all_constraints()
|
2174 + | }
|
2175 + | fn build_enforcing_all_constraints(self) -> crate::model::StructWithJsonName {
|
2176 + | crate::model::StructWithJsonName { value: self.value }
|
2177 + | }
|
2178 + | }
|
2179 + | }
|
2180 + | /// See [`StructWithJsonName`](crate::model::StructWithJsonName).
|
2181 + | pub mod struct_with_json_name {
|
2182 + |
|
2183 + | impl ::std::convert::From<Builder> for crate::model::StructWithJsonName {
|
2184 + | fn from(builder: Builder) -> Self {
|
2185 + | builder.build()
|
2186 + | }
|
2187 + | }
|
2188 + | /// A builder for [`StructWithJsonName`](crate::model::StructWithJsonName).
|
2189 + | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
2190 + | pub struct Builder {
|
2191 + | pub(crate) value: ::std::option::Option<::std::string::String>,
|
2192 + | }
|
2193 + | impl Builder {
|
2194 + | #[allow(missing_docs)] // documentation missing in model
|
2195 + | pub fn value(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
2196 + | self.value = input;
|
2197 + | self
|
2198 + | }
|
2199 + | /// Consumes the builder and constructs a [`StructWithJsonName`](crate::model::StructWithJsonName).
|
2200 + | pub fn build(self) -> crate::model::StructWithJsonName {
|
2201 + | self.build_enforcing_required_and_enum_traits()
|
2202 + | }
|
2203 + | fn build_enforcing_required_and_enum_traits(self) -> crate::model::StructWithJsonName {
|
2204 + | crate::model::StructWithJsonName { value: self.value }
|
2205 + | }
|
2206 + | }
|
2207 + | }
|
2208 + | pub(crate) mod foo_enum_list_internal {
|
2209 + |
|
2210 + | #[allow(clippy::enum_variant_names)]
|
2211 + | #[derive(Debug, PartialEq)]
|
2212 + | pub(crate) enum ConstraintViolation {
|
2213 + | /// Constraint violation error when an element doesn't satisfy its own constraints.
|
2214 + | /// The first component of the tuple is the index in the collection where the
|
2215 + | /// first constraint violation was found.
|
2216 + | #[doc(hidden)]
|
2217 + | Member(usize, crate::model::foo_enum_internal::ConstraintViolation),
|
2218 + | }
|
2219 + |
|
2220 + | impl ::std::fmt::Display for ConstraintViolation {
|
2221 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
2222 + | let message = match self {
|
2223 + | Self::Member(index, failing_member) => format!(
|
2224 + | "Value at index {index} failed to satisfy constraint. {}",
|
2225 + | failing_member
|
2226 + | ),
|
2227 + | };
|
2228 + | write!(f, "{message}")
|
2229 + | }
|
2230 + | }
|
2231 + |
|
2232 + | impl ::std::error::Error for ConstraintViolation {}
|
2233 + | impl ConstraintViolation {
|
2234 + | pub(crate) fn as_validation_exception_field(
|
2235 + | self,
|
2236 + | path: ::std::string::String,
|
2237 + | ) -> crate::model::ValidationExceptionField {
|
2238 + | match self {
|
2239 + | Self::Member(index, member_constraint_violation) => member_constraint_violation
|
2240 + | .as_validation_exception_field(path + "/" + &index.to_string()),
|
2241 + | }
|
2242 + | }
|
2243 + | }
|
2244 + | }
|
2245 + | pub(crate) mod foo_enum_set_internal {
|
2246 + |
|
2247 + | #[allow(clippy::enum_variant_names)]
|
2248 + | #[derive(Debug, PartialEq)]
|
2249 + | pub(crate) enum ConstraintViolation {
|
2250 + | /// Constraint violation error when the list does not contain unique items
|
2251 + | UniqueItems {
|
2252 + | /// A vector of indices into `original` pointing to all duplicate items. This vector has
|
2253 + | /// at least two elements.
|
2254 + | /// More specifically, for every element `idx_1` in `duplicate_indices`, there exists another
|
2255 + | /// distinct element `idx_2` such that `original[idx_1] == original[idx_2]` is `true`.
|
2256 + | /// Nothing is guaranteed about the order of the indices.
|
2257 + | duplicate_indices: ::std::vec::Vec<usize>,
|
2258 + | /// The original vector, that contains duplicate items.
|
2259 + | original: ::std::vec::Vec<crate::model::FooEnum>,
|
2260 + | },
|
2261 + | /// Constraint violation error when an element doesn't satisfy its own constraints.
|
2262 + | /// The first component of the tuple is the index in the collection where the
|
2263 + | /// first constraint violation was found.
|
2264 + | #[doc(hidden)]
|
2265 + | Member(usize, crate::model::foo_enum_internal::ConstraintViolation),
|
2266 + | }
|
2267 + |
|
2268 + | impl ::std::fmt::Display for ConstraintViolation {
|
2269 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
2270 + | let message = match self {
|
2271 + | Self::UniqueItems { duplicate_indices, .. } =>
|
2272 + | format!("Value with repeated values at indices {:?} provided for 'aws.protocoltests.shared#FooEnumSet' failed to satisfy constraint: Member must have unique values", &duplicate_indices),
|
2273 + | Self::Member(index, failing_member) => format!("Value at index {index} failed to satisfy constraint. {}",
|
2274 + | failing_member)
|
2275 + | };
|
2276 + | write!(f, "{message}")
|
2277 + | }
|
2278 + | }
|
2279 + |
|
2280 + | impl ::std::error::Error for ConstraintViolation {}
|
2281 + | impl ConstraintViolation {
|
2282 + | pub(crate) fn as_validation_exception_field(
|
2283 + | self,
|
2284 + | path: ::std::string::String,
|
2285 + | ) -> crate::model::ValidationExceptionField {
|
2286 + | match self {
|
2287 + | Self::UniqueItems { duplicate_indices, .. } =>
|
2288 + | crate::model::ValidationExceptionField {
|
2289 + | message: format!("Value with repeated values at indices {:?} at '{}' failed to satisfy constraint: Member must have unique values", &duplicate_indices, &path),
|
2290 + | path,
|
2291 + | },
|
2292 + | Self::Member(index, member_constraint_violation) =>
|
2293 + | member_constraint_violation.as_validation_exception_field(path + "/" + &index.to_string())
|
2294 + | }
|
2295 + | }
|
2296 + | }
|
2297 + | }
|
2298 + | pub(crate) mod foo_enum_map_internal {
|
2299 + |
|
2300 + | #[allow(clippy::enum_variant_names)]
|
2301 + | #[derive(Debug, PartialEq)]
|
2302 + | pub(crate) enum ConstraintViolation {
|
2303 + | #[doc(hidden)]
|
2304 + | Value(
|
2305 + | ::std::string::String,
|
2306 + | crate::model::foo_enum_internal::ConstraintViolation,
|
2307 + | ),
|
2308 + | }
|
2309 + |
|
2310 + | impl ::std::fmt::Display for ConstraintViolation {
|
2311 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
2312 + | match self {
|
2313 + | Self::Value(_, value_constraint_violation) => {
|
2314 + | write!(f, "{}", value_constraint_violation)
|
2315 + | }
|
2316 + | }
|
2317 + | }
|
2318 + | }
|
2395 2319 |
|
2396 - | impl ::std::convert::From<Builder> for crate::model::StructWithJsonName {
|
2397 - | fn from(builder: Builder) -> Self {
|
2398 - | builder.build()
|
2320 + | impl ::std::error::Error for ConstraintViolation {}
|
2321 + | impl ConstraintViolation {
|
2322 + | pub(crate) fn as_validation_exception_field(
|
2323 + | self,
|
2324 + | path: ::std::string::String,
|
2325 + | ) -> crate::model::ValidationExceptionField {
|
2326 + | match self {
|
2327 + | Self::Value(key, value_constraint_violation) => value_constraint_violation
|
2328 + | .as_validation_exception_field(path + "/" + key.as_str()),
|
2399 2329 | }
|
2400 2330 | }
|
2401 - | /// A builder for [`StructWithJsonName`](crate::model::StructWithJsonName).
|
2402 - | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
2403 - | pub(crate) struct Builder {
|
2404 - | pub(crate) value: ::std::option::Option<::std::string::String>,
|
2405 2331 | }
|
2406 - | impl Builder {
|
2407 - | #[allow(missing_docs)] // documentation missing in model
|
2408 - | pub(crate) fn set_value(
|
2409 - | mut self,
|
2410 - | input: Option<impl ::std::convert::Into<::std::string::String>>,
|
2411 - | ) -> Self {
|
2412 - | self.value = input.map(|v| v.into());
|
2413 - | self
|
2332 + | }
|
2333 + | pub(crate) mod integer_enum_set_internal {
|
2334 + |
|
2335 + | #[allow(clippy::enum_variant_names)]
|
2336 + | #[derive(Debug, PartialEq)]
|
2337 + | pub(crate) enum ConstraintViolation {
|
2338 + | /// Constraint violation error when the list does not contain unique items
|
2339 + | UniqueItems {
|
2340 + | /// A vector of indices into `original` pointing to all duplicate items. This vector has
|
2341 + | /// at least two elements.
|
2342 + | /// More specifically, for every element `idx_1` in `duplicate_indices`, there exists another
|
2343 + | /// distinct element `idx_2` such that `original[idx_1] == original[idx_2]` is `true`.
|
2344 + | /// Nothing is guaranteed about the order of the indices.
|
2345 + | duplicate_indices: ::std::vec::Vec<usize>,
|
2346 + | /// The original vector, that contains duplicate items.
|
2347 + | original: ::std::vec::Vec<i32>,
|
2348 + | },
|
2414 2349 | }
|
2415 - | /// Consumes the builder and constructs a [`StructWithJsonName`](crate::model::StructWithJsonName).
|
2416 - | pub fn build(self) -> crate::model::StructWithJsonName {
|
2417 - | self.build_enforcing_all_constraints()
|
2350 + |
|
2351 + | impl ::std::fmt::Display for ConstraintViolation {
|
2352 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
2353 + | let message = match self {
|
2354 + | Self::UniqueItems { duplicate_indices, .. } =>
|
2355 + | format!("Value with repeated values at indices {:?} provided for 'aws.protocoltests.shared#IntegerEnumSet' failed to satisfy constraint: Member must have unique values", &duplicate_indices),
|
2356 + | };
|
2357 + | write!(f, "{message}")
|
2358 + | }
|
2359 + | }
|
2360 + |
|
2361 + | impl ::std::error::Error for ConstraintViolation {}
|
2362 + | impl ConstraintViolation {
|
2363 + | pub(crate) fn as_validation_exception_field(
|
2364 + | self,
|
2365 + | path: ::std::string::String,
|
2366 + | ) -> crate::model::ValidationExceptionField {
|
2367 + | match self {
|
2368 + | Self::UniqueItems { duplicate_indices, .. } =>
|
2369 + | crate::model::ValidationExceptionField {
|
2370 + | message: format!("Value with repeated values at indices {:?} at '{}' failed to satisfy constraint: Member must have unique values", &duplicate_indices, &path),
|
2371 + | path,
|
2372 + | },
|
2418 2373 | }
|
2419 - | fn build_enforcing_all_constraints(self) -> crate::model::StructWithJsonName {
|
2420 - | crate::model::StructWithJsonName { value: self.value }
|
2421 2374 | }
|
2422 2375 | }
|
2423 2376 | }
|
2424 - | /// See [`StructWithJsonName`](crate::model::StructWithJsonName).
|
2425 - | pub mod struct_with_json_name {
|
2377 + | /// See [`ComplexNestedErrorData`](crate::model::ComplexNestedErrorData).
|
2378 + | pub mod complex_nested_error_data {
|
2426 2379 |
|
2427 - | impl ::std::convert::From<Builder> for crate::model::StructWithJsonName {
|
2380 + | impl ::std::convert::From<Builder> for crate::model::ComplexNestedErrorData {
|
2428 2381 | fn from(builder: Builder) -> Self {
|
2429 2382 | builder.build()
|
2430 2383 | }
|
2431 2384 | }
|
2432 - | /// A builder for [`StructWithJsonName`](crate::model::StructWithJsonName).
|
2385 + | /// A builder for [`ComplexNestedErrorData`](crate::model::ComplexNestedErrorData).
|
2433 2386 | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
2434 2387 | pub struct Builder {
|
2435 - | pub(crate) value: ::std::option::Option<::std::string::String>,
|
2388 + | pub(crate) foo: ::std::option::Option<::std::string::String>,
|
2436 2389 | }
|
2437 2390 | impl Builder {
|
2438 2391 | #[allow(missing_docs)] // documentation missing in model
|
2439 - | pub fn value(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
2440 - | self.value = input;
|
2392 + | pub fn foo(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
2393 + | self.foo = input;
|
2441 2394 | self
|
2442 2395 | }
|
2443 - | /// Consumes the builder and constructs a [`StructWithJsonName`](crate::model::StructWithJsonName).
|
2444 - | pub fn build(self) -> crate::model::StructWithJsonName {
|
2396 + | /// Consumes the builder and constructs a [`ComplexNestedErrorData`](crate::model::ComplexNestedErrorData).
|
2397 + | pub fn build(self) -> crate::model::ComplexNestedErrorData {
|
2445 2398 | self.build_enforcing_required_and_enum_traits()
|
2446 2399 | }
|
2447 - | fn build_enforcing_required_and_enum_traits(self) -> crate::model::StructWithJsonName {
|
2448 - | crate::model::StructWithJsonName { value: self.value }
|
2400 + | fn build_enforcing_required_and_enum_traits(self) -> crate::model::ComplexNestedErrorData {
|
2401 + | crate::model::ComplexNestedErrorData { foo: self.foo }
|
2449 2402 | }
|
2450 2403 | }
|
2451 2404 | }
|
2452 - | /// See [`SimpleStruct`](crate::model::SimpleStruct).
|
2453 - | pub(crate) mod simple_struct_internal {
|
2405 + | pub(crate) mod my_union_internal {
|
2454 2406 |
|
2455 - | impl ::std::convert::From<Builder> for crate::model::SimpleStruct {
|
2456 - | fn from(builder: Builder) -> Self {
|
2457 - | builder.build()
|
2407 + | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
2408 + | #[allow(clippy::enum_variant_names)]
|
2409 + | pub(crate) enum ConstraintViolation {
|
2410 + | EnumValue(crate::model::foo_enum_internal::ConstraintViolation),
|
2458 2411 | }
|
2412 + | impl ::std::fmt::Display for ConstraintViolation {
|
2413 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
2414 + | match self {
|
2415 + | Self::EnumValue(inner) => write!(f, "{inner}"),
|
2459 2416 | }
|
2460 - | /// A builder for [`SimpleStruct`](crate::model::SimpleStruct).
|
2461 - | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
2462 - | pub(crate) struct Builder {
|
2463 - | pub(crate) value: ::std::option::Option<::std::string::String>,
|
2464 2417 | }
|
2465 - | impl Builder {
|
2466 - | #[allow(missing_docs)] // documentation missing in model
|
2467 - | pub(crate) fn set_value(
|
2468 - | mut self,
|
2469 - | input: Option<impl ::std::convert::Into<::std::string::String>>,
|
2470 - | ) -> Self {
|
2471 - | self.value = input.map(|v| v.into());
|
2472 - | self
|
2473 2418 | }
|
2474 - | /// Consumes the builder and constructs a [`SimpleStruct`](crate::model::SimpleStruct).
|
2475 - | pub fn build(self) -> crate::model::SimpleStruct {
|
2476 - | self.build_enforcing_all_constraints()
|
2419 + |
|
2420 + | impl ::std::error::Error for ConstraintViolation {}
|
2421 + | impl ConstraintViolation {
|
2422 + | pub(crate) fn as_validation_exception_field(
|
2423 + | self,
|
2424 + | path: ::std::string::String,
|
2425 + | ) -> crate::model::ValidationExceptionField {
|
2426 + | match self {
|
2427 + | Self::EnumValue(inner) => inner.as_validation_exception_field(path + "/enumValue"),
|
2477 2428 | }
|
2478 - | fn build_enforcing_all_constraints(self) -> crate::model::SimpleStruct {
|
2479 - | crate::model::SimpleStruct { value: self.value }
|
2480 2429 | }
|
2481 2430 | }
|
2482 2431 | }
|
2483 - | /// See [`SimpleStruct`](crate::model::SimpleStruct).
|
2484 - | pub mod simple_struct {
|
2432 + | /// See [`ValidationExceptionField`](crate::model::ValidationExceptionField).
|
2433 + | pub mod validation_exception_field {
|
2485 2434 |
|
2486 - | impl ::std::convert::From<Builder> for crate::model::SimpleStruct {
|
2487 - | fn from(builder: Builder) -> Self {
|
2435 + | #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
|
2436 + | /// Holds one variant for each of the ways the builder can fail.
|
2437 + | #[allow(clippy::enum_variant_names)]
|
2438 + | pub enum ConstraintViolation {
|
2439 + | /// `path` was not provided but it is required when building `ValidationExceptionField`.
|
2440 + | MissingPath,
|
2441 + | /// `message` was not provided but it is required when building `ValidationExceptionField`.
|
2442 + | MissingMessage,
|
2443 + | }
|
2444 + | impl ::std::fmt::Display for ConstraintViolation {
|
2445 + | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
2446 + | match self {
|
2447 + | ConstraintViolation::MissingPath => write!(f, "`path` was not provided but it is required when building `ValidationExceptionField`"),
|
2448 + | ConstraintViolation::MissingMessage => write!(f, "`message` was not provided but it is required when building `ValidationExceptionField`"),
|
2449 + | }
|
2450 + | }
|
2451 + | }
|
2452 + | impl ::std::error::Error for ConstraintViolation {}
|
2453 + | impl ::std::convert::TryFrom<Builder> for crate::model::ValidationExceptionField {
|
2454 + | type Error = ConstraintViolation;
|
2455 + |
|
2456 + | fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
|
2488 2457 | builder.build()
|
2489 2458 | }
|
2490 2459 | }
|
2491 - | /// A builder for [`SimpleStruct`](crate::model::SimpleStruct).
|
2460 + | /// A builder for [`ValidationExceptionField`](crate::model::ValidationExceptionField).
|
2492 2461 | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
2493 2462 | pub struct Builder {
|
2494 - | pub(crate) value: ::std::option::Option<::std::string::String>,
|
2463 + | pub(crate) path: ::std::option::Option<::std::string::String>,
|
2464 + | pub(crate) message: ::std::option::Option<::std::string::String>,
|
2495 2465 | }
|
2496 2466 | impl Builder {
|
2497 - | #[allow(missing_docs)] // documentation missing in model
|
2498 - | pub fn value(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
2499 - | self.value = input;
|
2467 + | /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
|
2468 + | pub fn path(mut self, input: ::std::string::String) -> Self {
|
2469 + | self.path = Some(input);
|
2500 2470 | self
|
2501 2471 | }
|
2502 - | /// Consumes the builder and constructs a [`SimpleStruct`](crate::model::SimpleStruct).
|
2503 - | pub fn build(self) -> crate::model::SimpleStruct {
|
2472 + | /// A detailed description of the validation failure.
|
2473 + | pub fn message(mut self, input: ::std::string::String) -> Self {
|
2474 + | self.message = Some(input);
|
2475 + | self
|
2476 + | }
|
2477 + | /// Consumes the builder and constructs a [`ValidationExceptionField`](crate::model::ValidationExceptionField).
|
2478 + | ///
|
2479 + | /// The builder fails to construct a [`ValidationExceptionField`](crate::model::ValidationExceptionField) if you do not provide a value for all non-`Option`al members.
|
2480 + | ///
|
2481 + | pub fn build(self) -> Result<crate::model::ValidationExceptionField, ConstraintViolation> {
|
2504 2482 | self.build_enforcing_required_and_enum_traits()
|
2505 2483 | }
|
2506 - | fn build_enforcing_required_and_enum_traits(self) -> crate::model::SimpleStruct {
|
2507 - | crate::model::SimpleStruct { value: self.value }
|
2484 + | fn build_enforcing_required_and_enum_traits(
|
2485 + | self,
|
2486 + | ) -> Result<crate::model::ValidationExceptionField, ConstraintViolation> {
|
2487 + | Ok(crate::model::ValidationExceptionField {
|
2488 + | path: self.path.ok_or(ConstraintViolation::MissingPath)?,
|
2489 + | message: self.message.ok_or(ConstraintViolation::MissingMessage)?,
|
2490 + | })
|
2508 2491 | }
|
2509 2492 | }
|
2510 2493 | }
|
2511 - | /// See [`EmptyStruct`](crate::model::EmptyStruct).
|
2512 - | pub(crate) mod empty_struct_internal {
|
2494 + | /// See [`GreetingStruct`](crate::model::GreetingStruct).
|
2495 + | pub(crate) mod greeting_struct_internal {
|
2513 2496 |
|
2514 - | impl ::std::convert::From<Builder> for crate::model::EmptyStruct {
|
2497 + | impl ::std::convert::From<Builder> for crate::model::GreetingStruct {
|
2515 2498 | fn from(builder: Builder) -> Self {
|
2516 2499 | builder.build()
|
2517 2500 | }
|
2518 2501 | }
|
2519 - | /// A builder for [`EmptyStruct`](crate::model::EmptyStruct).
|
2502 + | /// A builder for [`GreetingStruct`](crate::model::GreetingStruct).
|
2520 2503 | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
2521 - | pub(crate) struct Builder {}
|
2504 + | pub(crate) struct Builder {
|
2505 + | pub(crate) hi: ::std::option::Option<::std::string::String>,
|
2506 + | }
|
2522 2507 | impl Builder {
|
2523 - | /// Consumes the builder and constructs a [`EmptyStruct`](crate::model::EmptyStruct).
|
2524 - | pub fn build(self) -> crate::model::EmptyStruct {
|
2508 + | #[allow(missing_docs)] // documentation missing in model
|
2509 + | pub(crate) fn set_hi(
|
2510 + | mut self,
|
2511 + | input: Option<impl ::std::convert::Into<::std::string::String>>,
|
2512 + | ) -> Self {
|
2513 + | self.hi = input.map(|v| v.into());
|
2514 + | self
|
2515 + | }
|
2516 + | /// Consumes the builder and constructs a [`GreetingStruct`](crate::model::GreetingStruct).
|
2517 + | pub fn build(self) -> crate::model::GreetingStruct {
|
2525 2518 | self.build_enforcing_all_constraints()
|
2526 2519 | }
|
2527 - | fn build_enforcing_all_constraints(self) -> crate::model::EmptyStruct {
|
2528 - | crate::model::EmptyStruct {}
|
2520 + | fn build_enforcing_all_constraints(self) -> crate::model::GreetingStruct {
|
2521 + | crate::model::GreetingStruct { hi: self.hi }
|
2529 2522 | }
|
2530 2523 | }
|
2531 2524 | }
|
2532 - | /// See [`EmptyStruct`](crate::model::EmptyStruct).
|
2533 - | pub mod empty_struct {
|
2525 + | /// See [`GreetingStruct`](crate::model::GreetingStruct).
|
2526 + | pub mod greeting_struct {
|
2534 2527 |
|
2535 - | impl ::std::convert::From<Builder> for crate::model::EmptyStruct {
|
2528 + | impl ::std::convert::From<Builder> for crate::model::GreetingStruct {
|
2536 2529 | fn from(builder: Builder) -> Self {
|
2537 2530 | builder.build()
|
2538 2531 | }
|
2539 2532 | }
|
2540 - | /// A builder for [`EmptyStruct`](crate::model::EmptyStruct).
|
2533 + | /// A builder for [`GreetingStruct`](crate::model::GreetingStruct).
|
2541 2534 | #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
|
2542 - | pub struct Builder {}
|
2535 + | pub struct Builder {
|
2536 + | pub(crate) hi: ::std::option::Option<::std::string::String>,
|
2537 + | }
|
2543 2538 | impl Builder {
|
2544 - | /// Consumes the builder and constructs a [`EmptyStruct`](crate::model::EmptyStruct).
|
2545 - | pub fn build(self) -> crate::model::EmptyStruct {
|
2539 + | #[allow(missing_docs)] // documentation missing in model
|
2540 + | pub fn hi(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
|
2541 + | self.hi = input;
|
2542 + | self
|
2543 + | }
|
2544 + | /// Consumes the builder and constructs a [`GreetingStruct`](crate::model::GreetingStruct).
|
2545 + | pub fn build(self) -> crate::model::GreetingStruct {
|
2546 2546 | self.build_enforcing_required_and_enum_traits()
|
2547 2547 | }
|
2548 - | fn build_enforcing_required_and_enum_traits(self) -> crate::model::EmptyStruct {
|
2549 - | crate::model::EmptyStruct {}
|
2548 + | fn build_enforcing_required_and_enum_traits(self) -> crate::model::GreetingStruct {
|
2549 + | crate::model::GreetingStruct { hi: self.hi }
|
2550 2550 | }
|
2551 2551 | }
|
2552 2552 | }
|