@smithy/core 3.23.4 → 3.23.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -164,7 +164,8 @@ class HttpBindingProtocol extends HttpProtocol {
164
164
  const headers = {};
165
165
  const endpoint = await context.endpoint();
166
166
  const ns = schema.NormalizedSchema.of(operationSchema?.input);
167
- const schema$1 = ns.getSchema();
167
+ const payloadMemberNames = [];
168
+ const payloadMemberSchemas = [];
168
169
  let hasNonHttpBindingMember = false;
169
170
  let payload;
170
171
  const request = new protocolHttp.HttpRequest({
@@ -257,10 +258,29 @@ class HttpBindingProtocol extends HttpProtocol {
257
258
  }
258
259
  else {
259
260
  hasNonHttpBindingMember = true;
261
+ payloadMemberNames.push(memberName);
262
+ payloadMemberSchemas.push(memberNs);
260
263
  }
261
264
  }
262
265
  if (hasNonHttpBindingMember && input) {
263
- serializer.write(schema$1, input);
266
+ const [namespace, name] = (ns.getName(true) ?? "#Unknown").split("#");
267
+ const requiredMembers = ns.getSchema()[6];
268
+ const payloadSchema = [
269
+ 3,
270
+ namespace,
271
+ name,
272
+ ns.getMergedTraits(),
273
+ payloadMemberNames,
274
+ payloadMemberSchemas,
275
+ undefined,
276
+ ];
277
+ if (requiredMembers) {
278
+ payloadSchema[6] = requiredMembers;
279
+ }
280
+ else {
281
+ payloadSchema.pop();
282
+ }
283
+ serializer.write(payloadSchema, input);
264
284
  payload = serializer.flush();
265
285
  }
266
286
  request.headers = headers;
@@ -515,7 +535,7 @@ class RpcProtocol extends HttpProtocol {
515
535
  const resolvedPath = (resolvedPath, input, memberName, labelValueProvider, uriLabel, isGreedyLabel) => {
516
536
  if (input != null && input[memberName] !== undefined) {
517
537
  const labelValue = labelValueProvider();
518
- if (labelValue.length <= 0) {
538
+ if (labelValue == null || labelValue.length <= 0) {
519
539
  throw new Error("Empty value provided for input HTTP label: " + memberName + ".");
520
540
  }
521
541
  resolvedPath = resolvedPath.replace(uriLabel, isGreedyLabel
@@ -15,7 +15,8 @@ export class HttpBindingProtocol extends HttpProtocol {
15
15
  const headers = {};
16
16
  const endpoint = await context.endpoint();
17
17
  const ns = NormalizedSchema.of(operationSchema?.input);
18
- const schema = ns.getSchema();
18
+ const payloadMemberNames = [];
19
+ const payloadMemberSchemas = [];
19
20
  let hasNonHttpBindingMember = false;
20
21
  let payload;
21
22
  const request = new HttpRequest({
@@ -108,10 +109,29 @@ export class HttpBindingProtocol extends HttpProtocol {
108
109
  }
109
110
  else {
110
111
  hasNonHttpBindingMember = true;
112
+ payloadMemberNames.push(memberName);
113
+ payloadMemberSchemas.push(memberNs);
111
114
  }
112
115
  }
113
116
  if (hasNonHttpBindingMember && input) {
114
- serializer.write(schema, input);
117
+ const [namespace, name] = (ns.getName(true) ?? "#Unknown").split("#");
118
+ const requiredMembers = ns.getSchema()[6];
119
+ const payloadSchema = [
120
+ 3,
121
+ namespace,
122
+ name,
123
+ ns.getMergedTraits(),
124
+ payloadMemberNames,
125
+ payloadMemberSchemas,
126
+ undefined,
127
+ ];
128
+ if (requiredMembers) {
129
+ payloadSchema[6] = requiredMembers;
130
+ }
131
+ else {
132
+ payloadSchema.pop();
133
+ }
134
+ serializer.write(payloadSchema, input);
115
135
  payload = serializer.flush();
116
136
  }
117
137
  request.headers = headers;
@@ -2,7 +2,7 @@ import { extendedEncodeURIComponent } from "./extended-encode-uri-component";
2
2
  export const resolvedPath = (resolvedPath, input, memberName, labelValueProvider, uriLabel, isGreedyLabel) => {
3
3
  if (input != null && input[memberName] !== undefined) {
4
4
  const labelValue = labelValueProvider();
5
- if (labelValue.length <= 0) {
5
+ if (labelValue == null || labelValue.length <= 0) {
6
6
  throw new Error("Empty value provided for input HTTP label: " + memberName + ".");
7
7
  }
8
8
  resolvedPath = resolvedPath.replace(uriLabel, isGreedyLabel
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/core",
3
- "version": "3.23.4",
3
+ "version": "3.23.5",
4
4
  "scripts": {
5
5
  "build": "yarn lint && concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
6
6
  "build:cjs": "node ../../scripts/inline core",