@typespec/http-server-js 0.58.0-alpha.24-dev.0 → 0.58.0-alpha.24-dev.2

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.
@@ -250,7 +250,7 @@ function* emitRawServerOperation(
250
250
  let value: string;
251
251
 
252
252
  if (requiresJsonSerialization(ctx, module, body.type)) {
253
- if (body.type.kind === "Model" && isArrayModelType(ctx.program, body.type)) {
253
+ if (body.type.kind === "Model" && isArrayModelType(body.type)) {
254
254
  yield ` const __arrayBody = JSON.parse(body);`;
255
255
  yield ` if (!Array.isArray(__arrayBody)) {`;
256
256
  yield ` ${names.ctx}.errorHandlers.onInvalidRequest(`;
@@ -261,7 +261,7 @@ function* emitRawServerOperation(
261
261
  yield ` return reject();`;
262
262
  yield ` }`;
263
263
  value = transposeExpressionFromJson(ctx, body.type, `__arrayBody`, module);
264
- } else if (body.type.kind === "Model" && isRecordModelType(ctx.program, body.type)) {
264
+ } else if (body.type.kind === "Model" && isRecordModelType(body.type)) {
265
265
  yield ` const __recordBody = JSON.parse(body);`;
266
266
  yield ` if (typeof __recordBody !== "object" || __recordBody === null) {`;
267
267
  yield ` ${names.ctx}.errorHandlers.onInvalidRequest(`;
@@ -641,7 +641,7 @@ function* emitResultProcessingForType(
641
641
  } else {
642
642
  yield `${names.ctx}.response.end(globalThis.JSON.stringify(${names.result}.${bodyCase.camelCase}));`;
643
643
  }
644
- } else if (isArrayModelType(ctx.program, target)) {
644
+ } else if (isArrayModelType(target)) {
645
645
  const itemType = target.indexer.value;
646
646
 
647
647
  const serializationRequired = isSerializationRequired(
@@ -659,7 +659,7 @@ function* emitResultProcessingForType(
659
659
  } else {
660
660
  yield `${names.ctx}.response.end(globalThis.JSON.stringify(${names.result}));`;
661
661
  }
662
- } else if (isRecordModelType(ctx.program, target)) {
662
+ } else if (isRecordModelType(target)) {
663
663
  const itemType = target.indexer.value;
664
664
 
665
665
  const serializationRequired = isSerializationRequired(
@@ -676,7 +676,7 @@ export function differentiateModelTypes(
676
676
  let arrayVariant: Model | undefined = undefined;
677
677
 
678
678
  for (const model of models) {
679
- if (isArrayModelType(ctx.program, model) && model.properties.size === 0 && !arrayVariant) {
679
+ if (isArrayModelType(model) && model.properties.size === 0 && !arrayVariant) {
680
680
  arrayVariant = model;
681
681
  continue;
682
682
  }