@microsoft/m365-spec-parser 0.2.2-alpha.8020c3125.0 → 0.2.2-alpha.82b9276fd.0

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.
@@ -84,6 +84,7 @@ var WarningType;
84
84
  WarningType["GenerateCardFailed"] = "generate-card-failed";
85
85
  WarningType["OperationOnlyContainsOptionalParam"] = "operation-only-contains-optional-param";
86
86
  WarningType["ConvertSwaggerToOpenAPI"] = "convert-swagger-to-openapi";
87
+ WarningType["FuncDescriptionTooLong"] = "function-description-too-long";
87
88
  WarningType["Unknown"] = "unknown";
88
89
  })(WarningType || (WarningType = {}));
89
90
  /**
@@ -130,6 +131,7 @@ ConstantString.SwaggerNotSupported = "Swagger 2.0 is not supported. Please conve
130
131
  ConstantString.SpecVersionNotSupported = "Unsupported OpenAPI version %s. Please use version 3.0.x.";
131
132
  ConstantString.MultipleAuthNotSupported = "Multiple authentication methods are unsupported. Ensure all selected APIs use identical authentication.";
132
133
  ConstantString.UnsupportedSchema = "Unsupported schema in %s %s: %s";
134
+ ConstantString.FuncDescriptionTooLong = "The description of the function '%s' is too long. The current length is %s characters, while the maximum allowed length is %s characters.";
133
135
  ConstantString.WrappedCardVersion = "devPreview";
134
136
  ConstantString.WrappedCardSchema = "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.ResponseRenderingTemplate.schema.json";
135
137
  ConstantString.WrappedCardResponseLayout = "list";
@@ -209,6 +211,7 @@ ConstantString.ConversationStarterMaxLens = 50;
209
211
  ConstantString.CommandTitleMaxLens = 32;
210
212
  ConstantString.ParameterTitleMaxLens = 32;
211
213
  ConstantString.SMERequiredParamsMaxNum = 5;
214
+ ConstantString.FunctionDescriptionMaxLens = 100;
212
215
  ConstantString.DefaultPluginId = "plugin_1";
213
216
  ConstantString.PluginManifestSchema = "https://aka.ms/json-schemas/copilot-extensions/v2.1/plugin.schema.json";
214
217
 
@@ -286,23 +289,28 @@ class Utils {
286
289
  return str.charAt(0).toUpperCase() + str.slice(1);
287
290
  }
288
291
  static getResponseJson(operationObject, allowMultipleMediaType = false) {
289
- var _a, _b;
292
+ var _a;
290
293
  let json = {};
291
294
  let multipleMediaType = false;
292
295
  for (const code of ConstantString.ResponseCodeFor20X) {
293
296
  const responseObject = (_a = operationObject === null || operationObject === void 0 ? void 0 : operationObject.responses) === null || _a === void 0 ? void 0 : _a[code];
294
- if ((_b = responseObject === null || responseObject === void 0 ? void 0 : responseObject.content) === null || _b === void 0 ? void 0 : _b["application/json"]) {
295
- multipleMediaType = false;
296
- json = responseObject.content["application/json"];
297
- if (Utils.containMultipleMediaTypes(responseObject)) {
298
- multipleMediaType = true;
299
- if (!allowMultipleMediaType) {
300
- json = {};
297
+ if (responseObject === null || responseObject === void 0 ? void 0 : responseObject.content) {
298
+ for (const contentType of Object.keys(responseObject.content)) {
299
+ // json media type can also be "application/json; charset=utf-8"
300
+ if (contentType.indexOf("application/json") >= 0) {
301
+ multipleMediaType = false;
302
+ json = responseObject.content[contentType];
303
+ if (Utils.containMultipleMediaTypes(responseObject)) {
304
+ multipleMediaType = true;
305
+ if (!allowMultipleMediaType) {
306
+ json = {};
307
+ }
308
+ }
309
+ else {
310
+ return { json, multipleMediaType };
311
+ }
301
312
  }
302
313
  }
303
- else {
304
- break;
305
- }
306
314
  }
307
315
  }
308
316
  return { json, multipleMediaType };
@@ -576,10 +584,11 @@ class Utils {
576
584
  currentCount += items.length;
577
585
  }
578
586
  else {
579
- if (currentCount < maxCount) {
580
- result.push(element);
581
- currentCount++;
582
- }
587
+ result.push(element);
588
+ currentCount++;
589
+ }
590
+ if (currentCount >= maxCount) {
591
+ break;
583
592
  }
584
593
  }
585
594
  return result;