@microsoft/m365-spec-parser 0.2.2-alpha.746b3b22c.0 → 0.2.2-alpha.7ed8295c4.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.
@@ -100,6 +100,7 @@ exports.WarningType = void 0;
100
100
  WarningType["GenerateCardFailed"] = "generate-card-failed";
101
101
  WarningType["OperationOnlyContainsOptionalParam"] = "operation-only-contains-optional-param";
102
102
  WarningType["ConvertSwaggerToOpenAPI"] = "convert-swagger-to-openapi";
103
+ WarningType["FuncDescriptionTooLong"] = "function-description-too-long";
103
104
  WarningType["Unknown"] = "unknown";
104
105
  })(exports.WarningType || (exports.WarningType = {}));
105
106
  /**
@@ -138,6 +139,7 @@ ConstantString.SwaggerNotSupported = "Swagger 2.0 is not supported. Please conve
138
139
  ConstantString.SpecVersionNotSupported = "Unsupported OpenAPI version %s. Please use version 3.0.x.";
139
140
  ConstantString.MultipleAuthNotSupported = "Multiple authentication methods are unsupported. Ensure all selected APIs use identical authentication.";
140
141
  ConstantString.UnsupportedSchema = "Unsupported schema in %s %s: %s";
142
+ 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.";
141
143
  ConstantString.WrappedCardVersion = "devPreview";
142
144
  ConstantString.WrappedCardSchema = "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.ResponseRenderingTemplate.schema.json";
143
145
  ConstantString.WrappedCardResponseLayout = "list";
@@ -217,6 +219,7 @@ ConstantString.ConversationStarterMaxLens = 50;
217
219
  ConstantString.CommandTitleMaxLens = 32;
218
220
  ConstantString.ParameterTitleMaxLens = 32;
219
221
  ConstantString.SMERequiredParamsMaxNum = 5;
222
+ ConstantString.FunctionDescriptionMaxLens = 100;
220
223
  ConstantString.DefaultPluginId = "plugin_1";
221
224
  ConstantString.PluginManifestSchema = "https://aka.ms/json-schemas/copilot-extensions/v2.1/plugin.schema.json";
222
225
 
@@ -1738,9 +1741,18 @@ class ManifestUpdater {
1738
1741
  throw new SpecParserError(Utils.format(ConstantString.UnsupportedSchema, method, pathUrl, JSON.stringify(requestBodySchema)), exports.ErrorType.UpdateManifestFailed);
1739
1742
  }
1740
1743
  }
1744
+ let funcDescription = operationItem.description || operationItem.summary || "";
1745
+ if (funcDescription.length > ConstantString.FunctionDescriptionMaxLens) {
1746
+ warnings.push({
1747
+ type: exports.WarningType.FuncDescriptionTooLong,
1748
+ content: Utils.format(ConstantString.FuncDescriptionTooLong, safeFunctionName, funcDescription.length.toString(), ConstantString.FunctionDescriptionMaxLens.toString()),
1749
+ data: safeFunctionName,
1750
+ });
1751
+ funcDescription = funcDescription.slice(0, ConstantString.FunctionDescriptionMaxLens);
1752
+ }
1741
1753
  const funcObj = {
1742
1754
  name: safeFunctionName,
1743
- description: description,
1755
+ description: funcDescription,
1744
1756
  };
1745
1757
  if (options.allowResponseSemantics) {
1746
1758
  try {