30 30 | }
|
31 31 | static COMPLEXERROR_SCHEMA_ID: ::aws_smithy_schema::ShapeId =
|
32 32 | ::aws_smithy_schema::ShapeId::from_static("aws.protocoltests.restjson#ComplexError", "aws.protocoltests.restjson", "ComplexError");
|
33 33 | static COMPLEXERROR_MEMBER_HEADER: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
34 34 | ::aws_smithy_schema::ShapeId::from_static(
|
35 35 | "aws.protocoltests.restjson#ComplexError$Header",
|
36 36 | "aws.protocoltests.restjson",
|
37 37 | "ComplexError",
|
38 38 | ),
|
39 39 | ::aws_smithy_schema::ShapeType::String,
|
40 - | "header",
|
40 + | "Header",
|
41 41 | 0,
|
42 42 | )
|
43 43 | .with_http_header("X-Header");
|
44 44 | static COMPLEXERROR_MEMBER_TOP_LEVEL: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
45 45 | ::aws_smithy_schema::ShapeId::from_static(
|
46 46 | "aws.protocoltests.restjson#ComplexError$TopLevel",
|
47 47 | "aws.protocoltests.restjson",
|
48 48 | "ComplexError",
|
49 49 | ),
|
50 50 | ::aws_smithy_schema::ShapeType::String,
|
51 - | "top_level",
|
51 + | "TopLevel",
|
52 52 | 1,
|
53 53 | );
|
54 54 | static COMPLEXERROR_MEMBER_NESTED: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
55 55 | ::aws_smithy_schema::ShapeId::from_static(
|
56 56 | "aws.protocoltests.restjson#ComplexError$Nested",
|
57 57 | "aws.protocoltests.restjson",
|
58 58 | "ComplexError",
|
59 59 | ),
|
60 60 | ::aws_smithy_schema::ShapeType::Structure,
|
61 - | "nested",
|
61 + | "Nested",
|
62 62 | 2,
|
63 63 | );
|
64 64 | static COMPLEXERROR_MEMBER_MESSAGE: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
|
65 65 | ::aws_smithy_schema::ShapeId::from_static(
|
66 66 | "aws.protocoltests.restjson#ComplexError$Message",
|
67 67 | "aws.protocoltests.restjson",
|
68 68 | "ComplexError",
|
69 69 | ),
|
70 70 | ::aws_smithy_schema::ShapeType::String,
|
71 - | "message",
|
71 + | "Message",
|
72 72 | 3,
|
73 73 | );
|
74 74 | static COMPLEXERROR_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
|
75 75 | COMPLEXERROR_SCHEMA_ID,
|
76 76 | ::aws_smithy_schema::ShapeType::Structure,
|
77 77 | &[
|
78 78 | &COMPLEXERROR_MEMBER_HEADER,
|
79 79 | &COMPLEXERROR_MEMBER_TOP_LEVEL,
|
80 80 | &COMPLEXERROR_MEMBER_NESTED,
|
81 81 | &COMPLEXERROR_MEMBER_MESSAGE,
|
82 82 | ],
|
83 83 | );
|
84 84 | impl ComplexError {
|
85 85 | /// The schema for this shape.
|
86 86 | pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &COMPLEXERROR_SCHEMA;
|
87 87 | }
|
88 88 | impl ::aws_smithy_schema::serde::SerializableStruct for ComplexError {
|
89 89 | #[allow(unused_variables, clippy::diverging_sub_expression)]
|
90 90 | fn serialize_members(
|
91 91 | &self,
|
92 92 | ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
|
93 93 | ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
|
94 94 | if let Some(ref val) = self.header {
|
95 95 | ser.write_string(&COMPLEXERROR_MEMBER_HEADER, val)?;
|
96 96 | }
|
97 97 | if let Some(ref val) = self.top_level {
|
98 98 | ser.write_string(&COMPLEXERROR_MEMBER_TOP_LEVEL, val)?;
|
99 99 | }
|
100 100 | if let Some(ref val) = self.nested {
|
101 101 | ser.write_struct(&COMPLEXERROR_MEMBER_NESTED, val)?;
|
102 102 | }
|
103 103 | if let Some(ref val) = self.message {
|
104 104 | ser.write_string(&COMPLEXERROR_MEMBER_MESSAGE, val)?;
|
105 105 | }
|
106 106 | Ok(())
|
107 107 | }
|
108 108 | }
|
109 109 | impl ComplexError {
|
110 110 | /// Deserializes this structure from a [`ShapeDeserializer`].
|
111 - | pub fn deserialize<D: ::aws_smithy_schema::serde::ShapeDeserializer>(
|
112 - | deserializer: &mut D,
|
111 + | pub fn deserialize(
|
112 + | deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
|
113 113 | ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
|
114 114 | #[allow(unused_variables, unused_mut)]
|
115 115 | let mut builder = Self::builder();
|
116 116 | #[allow(
|
117 117 | unused_variables,
|
118 118 | unreachable_code,
|
119 119 | clippy::single_match,
|
120 120 | clippy::match_single_binding,
|
121 121 | clippy::diverging_sub_expression
|
122 122 | )]
|
123 - | deserializer.read_struct(&COMPLEXERROR_SCHEMA, (), |_, member, deser| {
|
123 + | deserializer.read_struct(&COMPLEXERROR_SCHEMA, &mut |member, deser| {
|
124 124 | match member.member_index() {
|
125 125 | Some(0) => {
|
126 126 | builder.header = Some(deser.read_string(member)?);
|
127 127 | }
|
128 128 | Some(1) => {
|
129 129 | builder.top_level = Some(deser.read_string(member)?);
|
130 130 | }
|
131 131 | Some(2) => {
|
132 132 | builder.nested = Some(crate::types::ComplexNestedErrorData::deserialize(deser)?);
|
133 133 | }
|
134 134 | Some(3) => {
|
135 135 | builder.message = Some(deser.read_string(member)?);
|
136 136 | }
|
137 137 | _ => {}
|
138 138 | }
|
139 139 | Ok(())
|
140 140 | })?;
|
141 141 | Ok(builder.build())
|
142 142 | }
|
143 143 | }
|
144 + | impl ComplexError {
|
145 + | /// Deserializes this structure from a body deserializer and HTTP response headers.
|
146 + | /// Header-bound members are read directly from headers, avoiding runtime
|
147 + | /// member iteration overhead. Body members are read via the deserializer.
|
148 + | pub fn deserialize_with_response(
|
149 + | deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
|
150 + | headers: &::aws_smithy_runtime_api::http::Headers,
|
151 + | _status: u16,
|
152 + | _body: &[u8],
|
153 + | ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
|
154 + | #[allow(unused_variables, unused_mut)]
|
155 + | let mut builder = Self::builder();
|
156 + | if let Some(val) = headers.get("X-Header") {
|
157 + | builder.header = Some(val.to_string());
|
158 + | }
|
159 + | #[allow(
|
160 + | unused_variables,
|
161 + | unreachable_code,
|
162 + | clippy::single_match,
|
163 + | clippy::match_single_binding,
|
164 + | clippy::diverging_sub_expression
|
165 + | )]
|
166 + | deserializer.read_struct(&COMPLEXERROR_SCHEMA, &mut |member, deser| {
|
167 + | match member.member_index() {
|
168 + | Some(0) => { /* read from headers above */ }
|
169 + | Some(1) => {
|
170 + | builder.top_level = Some(deser.read_string(member)?);
|
171 + | }
|
172 + | Some(2) => {
|
173 + | builder.nested = Some(crate::types::ComplexNestedErrorData::deserialize(deser)?);
|
174 + | }
|
175 + | Some(3) => {
|
176 + | builder.message = Some(deser.read_string(member)?);
|
177 + | }
|
178 + | _ => {}
|
179 + | }
|
180 + | Ok(())
|
181 + | })?;
|
182 + | Ok(builder.build())
|
183 + | }
|
184 + | }
|
144 185 | impl ComplexError {
|
145 186 | /// Returns the error message.
|
146 187 | pub fn message(&self) -> ::std::option::Option<&str> {
|
147 188 | self.message.as_deref()
|
148 189 | }
|
149 190 | }
|
150 191 | impl ::std::fmt::Display for ComplexError {
|
151 192 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
152 193 | ::std::write!(f, "ComplexError")?;
|
153 194 | if let ::std::option::Option::Some(inner_1) = &self.message {
|