@microsoft/m365-spec-parser 0.2.2-alpha.7f0eac5b0.0 → 0.2.2-alpha.8810e8d21.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.
@@ -58,6 +58,7 @@ var WarningType;
58
58
  WarningType["GenerateCardFailed"] = "generate-card-failed";
59
59
  WarningType["OperationOnlyContainsOptionalParam"] = "operation-only-contains-optional-param";
60
60
  WarningType["ConvertSwaggerToOpenAPI"] = "convert-swagger-to-openapi";
61
+ WarningType["FuncDescriptionTooLong"] = "function-description-too-long";
61
62
  WarningType["Unknown"] = "unknown";
62
63
  })(WarningType || (WarningType = {}));
63
64
  /**
@@ -96,6 +97,7 @@ ConstantString.SwaggerNotSupported = "Swagger 2.0 is not supported. Please conve
96
97
  ConstantString.SpecVersionNotSupported = "Unsupported OpenAPI version %s. Please use version 3.0.x.";
97
98
  ConstantString.MultipleAuthNotSupported = "Multiple authentication methods are unsupported. Ensure all selected APIs use identical authentication.";
98
99
  ConstantString.UnsupportedSchema = "Unsupported schema in %s %s: %s";
100
+ 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.";
99
101
  ConstantString.WrappedCardVersion = "devPreview";
100
102
  ConstantString.WrappedCardSchema = "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.ResponseRenderingTemplate.schema.json";
101
103
  ConstantString.WrappedCardResponseLayout = "list";
@@ -175,6 +177,7 @@ ConstantString.ConversationStarterMaxLens = 50;
175
177
  ConstantString.CommandTitleMaxLens = 32;
176
178
  ConstantString.ParameterTitleMaxLens = 32;
177
179
  ConstantString.SMERequiredParamsMaxNum = 5;
180
+ ConstantString.FunctionDescriptionMaxLens = 100;
178
181
  ConstantString.DefaultPluginId = "plugin_1";
179
182
  ConstantString.PluginManifestSchema = "https://aka.ms/json-schemas/copilot-extensions/v2.1/plugin.schema.json";
180
183
 
@@ -1693,9 +1696,18 @@ class ManifestUpdater {
1693
1696
  throw new SpecParserError(Utils.format(ConstantString.UnsupportedSchema, method, pathUrl, JSON.stringify(requestBodySchema)), ErrorType.UpdateManifestFailed);
1694
1697
  }
1695
1698
  }
1699
+ let funcDescription = operationItem.description || operationItem.summary || "";
1700
+ if (funcDescription.length > ConstantString.FunctionDescriptionMaxLens) {
1701
+ warnings.push({
1702
+ type: WarningType.FuncDescriptionTooLong,
1703
+ content: Utils.format(ConstantString.FuncDescriptionTooLong, safeFunctionName, funcDescription.length.toString(), ConstantString.FunctionDescriptionMaxLens.toString()),
1704
+ data: safeFunctionName,
1705
+ });
1706
+ funcDescription = funcDescription.slice(0, ConstantString.FunctionDescriptionMaxLens);
1707
+ }
1696
1708
  const funcObj = {
1697
1709
  name: safeFunctionName,
1698
- description: description,
1710
+ description: funcDescription,
1699
1711
  };
1700
1712
  if (options.allowResponseSemantics) {
1701
1713
  try {