@microsoft/m365-spec-parser 0.1.1-alpha.cf377d39f.0 → 0.1.1-alpha.fc0606a28.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.
@@ -74,6 +74,7 @@ ConstantString.OperationOnlyContainsOptionalParam = "Operation %s contains multi
74
74
  ConstantString.ConvertSwaggerToOpenAPI = "The Swagger 2.0 file has been converted to OpenAPI 3.0.";
75
75
  ConstantString.SwaggerNotSupported = "Swagger 2.0 is not supported. Please convert to OpenAPI 3.0 manually before proceeding.";
76
76
  ConstantString.MultipleAPIKeyNotSupported = "Multiple API keys are not supported. Please make sure that all selected APIs use the same API key.";
77
+ ConstantString.UnsupportedSchema = "Unsupported schema in %s %s: %s";
77
78
  ConstantString.WrappedCardVersion = "devPreview";
78
79
  ConstantString.WrappedCardSchema = "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.ResponseRenderingTemplate.schema.json";
79
80
  ConstantString.WrappedCardResponseLayout = "list";
@@ -148,7 +149,18 @@ ConstantString.ParameterTitleMaxLens = 32;
148
149
 
149
150
  // Copyright (c) Microsoft Corporation.
150
151
  class Utils {
151
- static checkParameters(paramObject) {
152
+ static hasNestedObjectInSchema(schema) {
153
+ if (schema.type === "object") {
154
+ for (const property in schema.properties) {
155
+ const nestedSchema = schema.properties[property];
156
+ if (nestedSchema.type === "object") {
157
+ return true;
158
+ }
159
+ }
160
+ }
161
+ return false;
162
+ }
163
+ static checkParameters(paramObject, isCopilot) {
152
164
  const paramResult = {
153
165
  requiredNum: 0,
154
166
  optionalNum: 0,
@@ -160,7 +172,20 @@ class Utils {
160
172
  for (let i = 0; i < paramObject.length; i++) {
161
173
  const param = paramObject[i];
162
174
  const schema = param.schema;
175
+ if (isCopilot && this.hasNestedObjectInSchema(schema)) {
176
+ paramResult.isValid = false;
177
+ continue;
178
+ }
163
179
  const isRequiredWithoutDefault = param.required && schema.default === undefined;
180
+ if (isCopilot) {
181
+ if (isRequiredWithoutDefault) {
182
+ paramResult.requiredNum = paramResult.requiredNum + 1;
183
+ }
184
+ else {
185
+ paramResult.optionalNum = paramResult.optionalNum + 1;
186
+ }
187
+ continue;
188
+ }
164
189
  if (param.in === "header" || param.in === "cookie") {
165
190
  if (isRequiredWithoutDefault) {
166
191
  paramResult.isValid = false;
@@ -187,7 +212,7 @@ class Utils {
187
212
  }
188
213
  return paramResult;
189
214
  }
190
- static checkPostBody(schema, isRequired = false) {
215
+ static checkPostBody(schema, isRequired = false, isCopilot = false) {
191
216
  var _a;
192
217
  const paramResult = {
193
218
  requiredNum: 0,
@@ -198,6 +223,10 @@ class Utils {
198
223
  return paramResult;
199
224
  }
200
225
  const isRequiredWithoutDefault = isRequired && schema.default === undefined;
226
+ if (isCopilot && this.hasNestedObjectInSchema(schema)) {
227
+ paramResult.isValid = false;
228
+ return paramResult;
229
+ }
201
230
  if (schema.type === "string" ||
202
231
  schema.type === "integer" ||
203
232
  schema.type === "boolean" ||
@@ -216,14 +245,14 @@ class Utils {
216
245
  if (schema.required && ((_a = schema.required) === null || _a === void 0 ? void 0 : _a.indexOf(property)) >= 0) {
217
246
  isRequired = true;
218
247
  }
219
- const result = Utils.checkPostBody(properties[property], isRequired);
248
+ const result = Utils.checkPostBody(properties[property], isRequired, isCopilot);
220
249
  paramResult.requiredNum += result.requiredNum;
221
250
  paramResult.optionalNum += result.optionalNum;
222
251
  paramResult.isValid = paramResult.isValid && result.isValid;
223
252
  }
224
253
  }
225
254
  else {
226
- if (isRequiredWithoutDefault) {
255
+ if (isRequiredWithoutDefault && !isCopilot) {
227
256
  paramResult.isValid = false;
228
257
  }
229
258
  }
@@ -243,7 +272,7 @@ class Utils {
243
272
  * 5. response body should be “application/json” and not empty, and response code should be 20X
244
273
  * 6. only support request body with “application/json” content type
245
274
  */
246
- static isSupportedApi(method, path, spec, allowMissingId, allowAPIKeyAuth, allowMultipleParameters, allowOauth2) {
275
+ static isSupportedApi(method, path, spec, allowMissingId, allowAPIKeyAuth, allowMultipleParameters, allowOauth2, isCopilot) {
247
276
  const pathObj = spec.paths[path];
248
277
  method = method.toLocaleLowerCase();
249
278
  if (pathObj) {
@@ -276,15 +305,22 @@ class Utils {
276
305
  };
277
306
  if (requestJsonBody) {
278
307
  const requestBodySchema = requestJsonBody.schema;
279
- requestBodyParamResult = Utils.checkPostBody(requestBodySchema, requestBody.required);
308
+ if (isCopilot && requestBodySchema.type !== "object") {
309
+ return false;
310
+ }
311
+ requestBodyParamResult = Utils.checkPostBody(requestBodySchema, requestBody.required, isCopilot);
280
312
  }
281
313
  if (!requestBodyParamResult.isValid) {
282
314
  return false;
283
315
  }
284
- const paramResult = Utils.checkParameters(paramObject);
316
+ const paramResult = Utils.checkParameters(paramObject, isCopilot);
285
317
  if (!paramResult.isValid) {
286
318
  return false;
287
319
  }
320
+ // Copilot support arbitrary parameters
321
+ if (isCopilot) {
322
+ return true;
323
+ }
288
324
  if (requestBodyParamResult.requiredNum + paramResult.requiredNum > 1) {
289
325
  if (allowMultipleParameters &&
290
326
  requestBodyParamResult.requiredNum + paramResult.requiredNum <= 5) {
@@ -455,7 +491,7 @@ class Utils {
455
491
  }
456
492
  return errors;
457
493
  }
458
- static validateServer(spec, allowMissingId, allowAPIKeyAuth, allowMultipleParameters, allowOauth2) {
494
+ static validateServer(spec, allowMissingId, allowAPIKeyAuth, allowMultipleParameters, allowOauth2, isCopilot) {
459
495
  const errors = [];
460
496
  let hasTopLevelServers = false;
461
497
  let hasPathLevelServers = false;
@@ -476,7 +512,7 @@ class Utils {
476
512
  }
477
513
  for (const method in methods) {
478
514
  const operationObject = methods[method];
479
- if (Utils.isSupportedApi(method, path, spec, allowMissingId, allowAPIKeyAuth, allowMultipleParameters, allowOauth2)) {
515
+ if (Utils.isSupportedApi(method, path, spec, allowMissingId, allowAPIKeyAuth, allowMultipleParameters, allowOauth2, isCopilot)) {
480
516
  if ((operationObject === null || operationObject === void 0 ? void 0 : operationObject.servers) && operationObject.servers.length >= 1) {
481
517
  hasOperationLevelServers = true;
482
518
  const serverErrors = Utils.checkServerUrl(operationObject.servers);
@@ -626,14 +662,14 @@ class Utils {
626
662
  }
627
663
  return [command, warning];
628
664
  }
629
- static listSupportedAPIs(spec, allowMissingId, allowAPIKeyAuth, allowMultipleParameters, allowOauth2) {
665
+ static listSupportedAPIs(spec, allowMissingId, allowAPIKeyAuth, allowMultipleParameters, allowOauth2, isCopilot) {
630
666
  const paths = spec.paths;
631
667
  const result = {};
632
668
  for (const path in paths) {
633
669
  const methods = paths[path];
634
670
  for (const method in methods) {
635
671
  // For developer preview, only support GET operation with only 1 parameter without auth
636
- if (Utils.isSupportedApi(method, path, spec, allowMissingId, allowAPIKeyAuth, allowMultipleParameters, allowOauth2)) {
672
+ if (Utils.isSupportedApi(method, path, spec, allowMissingId, allowAPIKeyAuth, allowMultipleParameters, allowOauth2, isCopilot)) {
637
673
  const operationObject = methods[method];
638
674
  result[`${method.toUpperCase()} ${path}`] = operationObject;
639
675
  }
@@ -641,7 +677,7 @@ class Utils {
641
677
  }
642
678
  return result;
643
679
  }
644
- static validateSpec(spec, parser, isSwaggerFile, allowMissingId, allowAPIKeyAuth, allowMultipleParameters, allowOauth2) {
680
+ static validateSpec(spec, parser, isSwaggerFile, allowMissingId, allowAPIKeyAuth, allowMultipleParameters, allowOauth2, isCopilot) {
645
681
  const errors = [];
646
682
  const warnings = [];
647
683
  if (isSwaggerFile) {
@@ -651,7 +687,7 @@ class Utils {
651
687
  });
652
688
  }
653
689
  // Server validation
654
- const serverErrors = Utils.validateServer(spec, allowMissingId, allowAPIKeyAuth, allowMultipleParameters, allowOauth2);
690
+ const serverErrors = Utils.validateServer(spec, allowMissingId, allowAPIKeyAuth, allowMultipleParameters, allowOauth2, isCopilot);
655
691
  errors.push(...serverErrors);
656
692
  // Remote reference not supported
657
693
  const refPaths = parser.$refs.paths();
@@ -664,7 +700,7 @@ class Utils {
664
700
  });
665
701
  }
666
702
  // No supported API
667
- const apiMap = Utils.listSupportedAPIs(spec, allowMissingId, allowAPIKeyAuth, allowMultipleParameters, allowOauth2);
703
+ const apiMap = Utils.listSupportedAPIs(spec, allowMissingId, allowAPIKeyAuth, allowMultipleParameters, allowOauth2, isCopilot);
668
704
  if (Object.keys(apiMap).length === 0) {
669
705
  errors.push({
670
706
  type: ErrorType.NoSupportedApi,
@@ -735,6 +771,7 @@ class SpecParser {
735
771
  allowAPIKeyAuth: false,
736
772
  allowMultipleParameters: false,
737
773
  allowOauth2: false,
774
+ isCopilot: false,
738
775
  };
739
776
  this.pathOrSpec = pathOrDoc;
740
777
  this.parser = new SwaggerParser();
@@ -771,7 +808,7 @@ class SpecParser {
771
808
  ],
772
809
  };
773
810
  }
774
- return Utils.validateSpec(this.spec, this.parser, !!this.isSwaggerFile, this.options.allowMissingId, this.options.allowAPIKeyAuth, this.options.allowMultipleParameters, this.options.allowOauth2);
811
+ return Utils.validateSpec(this.spec, this.parser, !!this.isSwaggerFile, this.options.allowMissingId, this.options.allowAPIKeyAuth, this.options.allowMultipleParameters, this.options.allowOauth2, this.options.isCopilot);
775
812
  }
776
813
  catch (err) {
777
814
  throw new SpecParserError(err.toString(), ErrorType.ValidateFailed);
@@ -827,6 +864,17 @@ class SpecParser {
827
864
  async getFilteredSpecs(filter, signal) {
828
865
  throw new Error("Method not implemented.");
829
866
  }
867
+ /**
868
+ * Generates and update artifacts from the OpenAPI specification file. Generate Adaptive Cards, update Teams app manifest, and generate a new OpenAPI specification file.
869
+ * @param manifestPath A file path of the Teams app manifest file to update.
870
+ * @param filter An array of strings that represent the filters to apply when generating the artifacts. If filter is empty, it would process nothing.
871
+ * @param outputSpecPath File path of the new OpenAPI specification file to generate. If not specified or empty, no spec file will be generated.
872
+ * @param pluginFilePath File path of the api plugin file to generate.
873
+ */
874
+ // eslint-disable-next-line @typescript-eslint/require-await
875
+ async generateForCopilot(manifestPath, filter, outputSpecPath, pluginFilePath, signal) {
876
+ throw new Error("Method not implemented.");
877
+ }
830
878
  /**
831
879
  * Generates and update artifacts from the OpenAPI specification file. Generate Adaptive Cards, update Teams app manifest, and generate a new OpenAPI specification file.
832
880
  * @param manifestPath A file path of the Teams app manifest file to update.
@@ -853,7 +901,7 @@ class SpecParser {
853
901
  if (this.apiMap !== undefined) {
854
902
  return this.apiMap;
855
903
  }
856
- const result = Utils.listSupportedAPIs(spec, this.options.allowMissingId, this.options.allowAPIKeyAuth, this.options.allowMultipleParameters, this.options.allowOauth2);
904
+ const result = Utils.listSupportedAPIs(spec, this.options.allowMissingId, this.options.allowAPIKeyAuth, this.options.allowMultipleParameters, this.options.allowOauth2, this.options.isCopilot);
857
905
  this.apiMap = result;
858
906
  return result;
859
907
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm2017.js","sources":["../src/interfaces.ts","../src/specParserError.ts","../src/constants.ts","../src/utils.ts","../src/specParser.browser.ts","../src/adaptiveCardGenerator.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\"use strict\";\n\nimport { OpenAPIV3 } from \"openapi-types\";\n\n/**\n * An interface that represents the result of validating an OpenAPI specification file.\n */\nexport interface ValidateResult {\n /**\n * The validation status of the OpenAPI specification file.\n */\n status: ValidationStatus;\n\n /**\n * An array of warning results generated during validation.\n */\n warnings: WarningResult[];\n\n /**\n * An array of error results generated during validation.\n */\n errors: ErrorResult[];\n}\n\n/**\n * An interface that represents a warning result generated during validation.\n */\nexport interface WarningResult {\n /**\n * The type of warning.\n */\n type: WarningType;\n\n /**\n * The content of the warning.\n */\n content: string;\n\n /**\n * data of the warning.\n */\n data?: any;\n}\n\n/**\n * An interface that represents an error result generated during validation.\n */\nexport interface ErrorResult {\n /**\n * The type of error.\n */\n type: ErrorType;\n\n /**\n * The content of the error.\n */\n content: string;\n\n /**\n * data of the error.\n */\n data?: any;\n}\n\nexport interface GenerateResult {\n allSuccess: boolean;\n warnings: WarningResult[];\n}\n\n/**\n * An enum that represents the types of errors that can occur during validation.\n */\nexport enum ErrorType {\n SpecNotValid = \"spec-not-valid\",\n RemoteRefNotSupported = \"remote-ref-not-supported\",\n NoServerInformation = \"no-server-information\",\n UrlProtocolNotSupported = \"url-protocol-not-supported\",\n RelativeServerUrlNotSupported = \"relative-server-url-not-supported\",\n NoSupportedApi = \"no-supported-api\",\n NoExtraAPICanBeAdded = \"no-extra-api-can-be-added\",\n ResolveServerUrlFailed = \"resolve-server-url-failed\",\n SwaggerNotSupported = \"swagger-not-supported\",\n MultipleAPIKeyNotSupported = \"multiple-api-key-not-supported\",\n\n ListFailed = \"list-failed\",\n listSupportedAPIInfoFailed = \"list-supported-api-info-failed\",\n FilterSpecFailed = \"filter-spec-failed\",\n UpdateManifestFailed = \"update-manifest-failed\",\n GenerateAdaptiveCardFailed = \"generate-adaptive-card-failed\",\n GenerateFailed = \"generate-failed\",\n ValidateFailed = \"validate-failed\",\n GetSpecFailed = \"get-spec-failed\",\n\n Cancelled = \"cancelled\",\n Unknown = \"unknown\",\n}\n\n/**\n * An enum that represents the types of warnings that can occur during validation.\n */\nexport enum WarningType {\n OperationIdMissing = \"operationid-missing\",\n GenerateCardFailed = \"generate-card-failed\",\n OperationOnlyContainsOptionalParam = \"operation-only-contains-optional-param\",\n ConvertSwaggerToOpenAPI = \"convert-swagger-to-openapi\",\n Unknown = \"unknown\",\n}\n\n/**\n * An enum that represents the validation status of an OpenAPI specification file.\n */\nexport enum ValidationStatus {\n Valid,\n Warning, // If there are any warnings, the file is still valid\n Error, // If there are any errors, the file is not valid\n}\n\nexport interface TextBlockElement {\n type: string;\n text: string;\n wrap: boolean;\n}\n\nexport interface ImageElement {\n type: string;\n url: string;\n $when: string;\n}\n\nexport interface ArrayElement {\n type: string;\n $data: string;\n items: Array<TextBlockElement | ImageElement | ArrayElement>;\n}\n\nexport interface AdaptiveCard {\n type: string;\n $schema: string;\n version: string;\n body: Array<TextBlockElement | ImageElement | ArrayElement>;\n}\n\nexport interface PreviewCardTemplate {\n title: string;\n subtitle?: string;\n image?: {\n url: string;\n alt?: string;\n $when?: string;\n };\n}\n\nexport interface WrappedAdaptiveCard {\n version: string;\n $schema?: string;\n jsonPath?: string;\n responseLayout: string;\n responseCardTemplate: AdaptiveCard;\n previewCardTemplate: PreviewCardTemplate;\n}\n\nexport interface ChoicesItem {\n title: string;\n value: string;\n}\n\nexport interface Parameter {\n name: string;\n title: string;\n description: string;\n inputType?: \"text\" | \"textarea\" | \"number\" | \"date\" | \"time\" | \"toggle\" | \"choiceset\";\n value?: string;\n choices?: ChoicesItem[];\n}\n\nexport interface CheckParamResult {\n requiredNum: number;\n optionalNum: number;\n isValid: boolean;\n}\n\nexport interface ParseOptions {\n allowMissingId?: boolean;\n allowSwagger?: boolean;\n allowAPIKeyAuth?: boolean;\n allowMultipleParameters?: boolean;\n allowOauth2?: boolean;\n}\n\nexport interface APIInfo {\n method: string;\n path: string;\n title: string;\n id: string;\n parameters: Parameter[];\n description: string;\n warning?: WarningResult;\n}\n\nexport interface ListAPIResult {\n api: string;\n server: string;\n operationId: string;\n auth?: OpenAPIV3.SecuritySchemeObject;\n}\n\nexport interface AuthSchema {\n authSchema: OpenAPIV3.SecuritySchemeObject;\n name: string;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\"use strict\";\n\nimport { ErrorType } from \"./interfaces\";\n\nexport class SpecParserError extends Error {\n public readonly errorType: ErrorType;\n\n constructor(message: string, errorType: ErrorType) {\n super(message);\n this.errorType = errorType;\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\"use strict\";\n\nexport class ConstantString {\n static readonly CancelledMessage = \"Operation is cancelled.\";\n static readonly NoServerInformation =\n \"No server information is found in the OpenAPI description document.\";\n static readonly RemoteRefNotSupported = \"Remote reference is not supported: %s.\";\n static readonly MissingOperationId = \"Missing operationIds: %s.\";\n static readonly NoSupportedApi =\n \"No supported API is found in the OpenAPI description document: only GET and POST methods are supported, additionally, there can be at most one required parameter, and no auth is allowed.\";\n\n static readonly AdditionalPropertiesNotSupported =\n \"'additionalProperties' is not supported, and will be ignored.\";\n static readonly SchemaNotSupported = \"'oneOf', 'anyOf', and 'not' schema are not supported: %s.\";\n static readonly UnknownSchema = \"Unknown schema: %s.\";\n\n static readonly UrlProtocolNotSupported =\n \"Server url is not correct: protocol %s is not supported, you should use https protocol instead.\";\n static readonly RelativeServerUrlNotSupported =\n \"Server url is not correct: relative server url is not supported.\";\n static readonly ResolveServerUrlFailed =\n \"Unable to resolve the server URL: please make sure that the environment variable %s is defined.\";\n static readonly OperationOnlyContainsOptionalParam =\n \"Operation %s contains multiple optional parameters. The first optional parameter is used for this command.\";\n static readonly ConvertSwaggerToOpenAPI =\n \"The Swagger 2.0 file has been converted to OpenAPI 3.0.\";\n\n static readonly SwaggerNotSupported =\n \"Swagger 2.0 is not supported. Please convert to OpenAPI 3.0 manually before proceeding.\";\n\n static readonly MultipleAPIKeyNotSupported =\n \"Multiple API keys are not supported. Please make sure that all selected APIs use the same API key.\";\n\n static readonly WrappedCardVersion = \"devPreview\";\n static readonly WrappedCardSchema =\n \"https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.ResponseRenderingTemplate.schema.json\";\n static readonly WrappedCardResponseLayout = \"list\";\n\n static readonly GetMethod = \"get\";\n static readonly PostMethod = \"post\";\n static readonly AdaptiveCardVersion = \"1.5\";\n static readonly AdaptiveCardSchema = \"http://adaptivecards.io/schemas/adaptive-card.json\";\n static readonly AdaptiveCardType = \"AdaptiveCard\";\n static readonly TextBlockType = \"TextBlock\";\n static readonly ContainerType = \"Container\";\n static readonly RegistrationIdPostfix = \"REGISTRATION_ID\";\n static readonly ResponseCodeFor20X = [\n \"200\",\n \"201\",\n \"202\",\n \"203\",\n \"204\",\n \"205\",\n \"206\",\n \"207\",\n \"208\",\n \"226\",\n \"default\",\n ];\n static readonly AllOperationMethods = [\n \"get\",\n \"post\",\n \"put\",\n \"delete\",\n \"patch\",\n \"head\",\n \"options\",\n \"trace\",\n ];\n\n // TODO: update after investigating the usage of these constants.\n static readonly WellknownResultNames = [\n \"result\",\n \"data\",\n \"items\",\n \"root\",\n \"matches\",\n \"queries\",\n \"list\",\n \"output\",\n ];\n static readonly WellknownTitleName = [\"title\", \"name\", \"summary\", \"caption\", \"subject\", \"label\"];\n static readonly WellknownSubtitleName = [\n \"subtitle\",\n \"id\",\n \"uid\",\n \"description\",\n \"desc\",\n \"detail\",\n ];\n static readonly WellknownImageName = [\n \"image\",\n \"icon\",\n \"avatar\",\n \"picture\",\n \"photo\",\n \"logo\",\n \"pic\",\n \"thumbnail\",\n \"img\",\n ];\n\n static readonly ShortDescriptionMaxLens = 80;\n static readonly FullDescriptionMaxLens = 4000;\n static readonly CommandDescriptionMaxLens = 128;\n static readonly ParameterDescriptionMaxLens = 128;\n static readonly CommandTitleMaxLens = 32;\n static readonly ParameterTitleMaxLens = 32;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\"use strict\";\n\nimport { OpenAPIV3 } from \"openapi-types\";\nimport SwaggerParser from \"@apidevtools/swagger-parser\";\nimport { ConstantString } from \"./constants\";\nimport {\n AuthSchema,\n CheckParamResult,\n ErrorResult,\n ErrorType,\n Parameter,\n ValidateResult,\n ValidationStatus,\n WarningResult,\n WarningType,\n} from \"./interfaces\";\nimport { IMessagingExtensionCommand } from \"@microsoft/teams-manifest\";\n\nexport class Utils {\n static checkParameters(paramObject: OpenAPIV3.ParameterObject[]): CheckParamResult {\n const paramResult = {\n requiredNum: 0,\n optionalNum: 0,\n isValid: true,\n };\n\n if (!paramObject) {\n return paramResult;\n }\n\n for (let i = 0; i < paramObject.length; i++) {\n const param = paramObject[i];\n const schema = param.schema as OpenAPIV3.SchemaObject;\n const isRequiredWithoutDefault = param.required && schema.default === undefined;\n\n if (param.in === \"header\" || param.in === \"cookie\") {\n if (isRequiredWithoutDefault) {\n paramResult.isValid = false;\n }\n continue;\n }\n\n if (\n schema.type !== \"boolean\" &&\n schema.type !== \"string\" &&\n schema.type !== \"number\" &&\n schema.type !== \"integer\"\n ) {\n if (isRequiredWithoutDefault) {\n paramResult.isValid = false;\n }\n continue;\n }\n\n if (param.in === \"query\" || param.in === \"path\") {\n if (isRequiredWithoutDefault) {\n paramResult.requiredNum = paramResult.requiredNum + 1;\n } else {\n paramResult.optionalNum = paramResult.optionalNum + 1;\n }\n }\n }\n\n return paramResult;\n }\n\n static checkPostBody(schema: OpenAPIV3.SchemaObject, isRequired = false): CheckParamResult {\n const paramResult = {\n requiredNum: 0,\n optionalNum: 0,\n isValid: true,\n };\n\n if (Object.keys(schema).length === 0) {\n return paramResult;\n }\n\n const isRequiredWithoutDefault = isRequired && schema.default === undefined;\n\n if (\n schema.type === \"string\" ||\n schema.type === \"integer\" ||\n schema.type === \"boolean\" ||\n schema.type === \"number\"\n ) {\n if (isRequiredWithoutDefault) {\n paramResult.requiredNum = paramResult.requiredNum + 1;\n } else {\n paramResult.optionalNum = paramResult.optionalNum + 1;\n }\n } else if (schema.type === \"object\") {\n const { properties } = schema;\n for (const property in properties) {\n let isRequired = false;\n if (schema.required && schema.required?.indexOf(property) >= 0) {\n isRequired = true;\n }\n const result = Utils.checkPostBody(\n properties[property] as OpenAPIV3.SchemaObject,\n isRequired\n );\n paramResult.requiredNum += result.requiredNum;\n paramResult.optionalNum += result.optionalNum;\n paramResult.isValid = paramResult.isValid && result.isValid;\n }\n } else {\n if (isRequiredWithoutDefault) {\n paramResult.isValid = false;\n }\n }\n return paramResult;\n }\n\n /**\n * Checks if the given API is supported.\n * @param {string} method - The HTTP method of the API.\n * @param {string} path - The path of the API.\n * @param {OpenAPIV3.Document} spec - The OpenAPI specification document.\n * @returns {boolean} - Returns true if the API is supported, false otherwise.\n * @description The following APIs are supported:\n * 1. only support Get/Post operation without auth property\n * 2. parameter inside query or path only support string, number, boolean and integer\n * 3. parameter inside post body only support string, number, boolean, integer and object\n * 4. request body + required parameters <= 1\n * 5. response body should be “application/json” and not empty, and response code should be 20X\n * 6. only support request body with “application/json” content type\n */\n static isSupportedApi(\n method: string,\n path: string,\n spec: OpenAPIV3.Document,\n allowMissingId: boolean,\n allowAPIKeyAuth: boolean,\n allowMultipleParameters: boolean,\n allowOauth2: boolean\n ): boolean {\n const pathObj = spec.paths[path];\n method = method.toLocaleLowerCase();\n if (pathObj) {\n if (\n (method === ConstantString.PostMethod || method === ConstantString.GetMethod) &&\n pathObj[method]\n ) {\n const securities = pathObj[method]!.security;\n const authArray = Utils.getAuthArray(securities, spec);\n if (!Utils.isSupportedAuth(authArray, allowAPIKeyAuth, allowOauth2)) {\n return false;\n }\n\n const operationObject = pathObj[method] as OpenAPIV3.OperationObject;\n if (!allowMissingId && !operationObject.operationId) {\n return false;\n }\n const paramObject = operationObject.parameters as OpenAPIV3.ParameterObject[];\n\n const requestBody = operationObject.requestBody as OpenAPIV3.RequestBodyObject;\n const requestJsonBody = requestBody?.content[\"application/json\"];\n\n const mediaTypesCount = Object.keys(requestBody?.content || {}).length;\n if (mediaTypesCount > 1) {\n return false;\n }\n\n const responseJson = Utils.getResponseJson(operationObject);\n if (Object.keys(responseJson).length === 0) {\n return false;\n }\n\n let requestBodyParamResult = {\n requiredNum: 0,\n optionalNum: 0,\n isValid: true,\n };\n\n if (requestJsonBody) {\n const requestBodySchema = requestJsonBody.schema as OpenAPIV3.SchemaObject;\n requestBodyParamResult = Utils.checkPostBody(requestBodySchema, requestBody.required);\n }\n\n if (!requestBodyParamResult.isValid) {\n return false;\n }\n\n const paramResult = Utils.checkParameters(paramObject);\n\n if (!paramResult.isValid) {\n return false;\n }\n\n if (requestBodyParamResult.requiredNum + paramResult.requiredNum > 1) {\n if (\n allowMultipleParameters &&\n requestBodyParamResult.requiredNum + paramResult.requiredNum <= 5\n ) {\n return true;\n }\n return false;\n } else if (\n requestBodyParamResult.requiredNum +\n requestBodyParamResult.optionalNum +\n paramResult.requiredNum +\n paramResult.optionalNum ===\n 0\n ) {\n return false;\n } else {\n return true;\n }\n }\n }\n\n return false;\n }\n\n static isSupportedAuth(\n authSchemaArray: AuthSchema[][],\n allowAPIKeyAuth: boolean,\n allowOauth2: boolean\n ): boolean {\n if (authSchemaArray.length === 0) {\n return true;\n }\n\n if (allowAPIKeyAuth || allowOauth2) {\n // Currently we don't support multiple auth in one operation\n if (authSchemaArray.length > 0 && authSchemaArray.every((auths) => auths.length > 1)) {\n return false;\n }\n\n for (const auths of authSchemaArray) {\n if (auths.length === 1) {\n if (!allowOauth2 && allowAPIKeyAuth && Utils.isAPIKeyAuth(auths[0].authSchema)) {\n return true;\n } else if (\n !allowAPIKeyAuth &&\n allowOauth2 &&\n Utils.isBearerTokenAuth(auths[0].authSchema)\n ) {\n return true;\n } else if (\n allowAPIKeyAuth &&\n allowOauth2 &&\n (Utils.isAPIKeyAuth(auths[0].authSchema) ||\n Utils.isBearerTokenAuth(auths[0].authSchema))\n ) {\n return true;\n }\n }\n }\n }\n\n return false;\n }\n\n static isAPIKeyAuth(authSchema: OpenAPIV3.SecuritySchemeObject): boolean {\n return authSchema.type === \"apiKey\";\n }\n\n static isBearerTokenAuth(authSchema: OpenAPIV3.SecuritySchemeObject): boolean {\n return (\n authSchema.type === \"oauth2\" ||\n authSchema.type === \"openIdConnect\" ||\n (authSchema.type === \"http\" && authSchema.scheme === \"bearer\")\n );\n }\n\n static getAuthArray(\n securities: OpenAPIV3.SecurityRequirementObject[] | undefined,\n spec: OpenAPIV3.Document\n ): AuthSchema[][] {\n const result: AuthSchema[][] = [];\n const securitySchemas = spec.components?.securitySchemes;\n if (securities && securitySchemas) {\n for (let i = 0; i < securities.length; i++) {\n const security = securities[i];\n\n const authArray: AuthSchema[] = [];\n for (const name in security) {\n const auth = securitySchemas[name] as OpenAPIV3.SecuritySchemeObject;\n authArray.push({\n authSchema: auth,\n name: name,\n });\n }\n\n if (authArray.length > 0) {\n result.push(authArray);\n }\n }\n }\n\n result.sort((a, b) => a[0].name.localeCompare(b[0].name));\n\n return result;\n }\n\n static updateFirstLetter(str: string): string {\n return str.charAt(0).toUpperCase() + str.slice(1);\n }\n\n static getResponseJson(\n operationObject: OpenAPIV3.OperationObject | undefined\n ): OpenAPIV3.MediaTypeObject {\n let json: OpenAPIV3.MediaTypeObject = {};\n\n for (const code of ConstantString.ResponseCodeFor20X) {\n const responseObject = operationObject?.responses?.[code] as OpenAPIV3.ResponseObject;\n\n const mediaTypesCount = Object.keys(responseObject?.content || {}).length;\n if (mediaTypesCount > 1) {\n return {};\n }\n\n if (responseObject?.content?.[\"application/json\"]) {\n json = responseObject.content[\"application/json\"];\n break;\n }\n }\n\n return json;\n }\n\n static convertPathToCamelCase(path: string): string {\n const pathSegments = path.split(/[./{]/);\n const camelCaseSegments = pathSegments.map((segment) => {\n segment = segment.replace(/}/g, \"\");\n return segment.charAt(0).toUpperCase() + segment.slice(1);\n });\n const camelCasePath = camelCaseSegments.join(\"\");\n return camelCasePath;\n }\n\n static getUrlProtocol(urlString: string): string | undefined {\n try {\n const url = new URL(urlString);\n return url.protocol;\n } catch (err) {\n return undefined;\n }\n }\n\n static resolveServerUrl(url: string): string {\n const placeHolderReg = /\\${{\\s*([a-zA-Z_][a-zA-Z0-9_]*)\\s*}}/g;\n let matches = placeHolderReg.exec(url);\n let newUrl = url;\n while (matches != null) {\n const envVar = matches[1];\n const envVal = process.env[envVar];\n if (!envVal) {\n throw new Error(Utils.format(ConstantString.ResolveServerUrlFailed, envVar));\n } else {\n newUrl = newUrl.replace(matches[0], envVal);\n }\n matches = placeHolderReg.exec(url);\n }\n return newUrl;\n }\n\n static checkServerUrl(servers: OpenAPIV3.ServerObject[]): ErrorResult[] {\n const errors: ErrorResult[] = [];\n\n let serverUrl;\n try {\n serverUrl = Utils.resolveServerUrl(servers[0].url);\n } catch (err) {\n errors.push({\n type: ErrorType.ResolveServerUrlFailed,\n content: (err as Error).message,\n data: servers,\n });\n return errors;\n }\n\n const protocol = Utils.getUrlProtocol(serverUrl);\n if (!protocol) {\n // Relative server url is not supported\n errors.push({\n type: ErrorType.RelativeServerUrlNotSupported,\n content: ConstantString.RelativeServerUrlNotSupported,\n data: servers,\n });\n } else if (protocol !== \"https:\") {\n // Http server url is not supported\n const protocolString = protocol.slice(0, -1);\n errors.push({\n type: ErrorType.UrlProtocolNotSupported,\n content: Utils.format(ConstantString.UrlProtocolNotSupported, protocol.slice(0, -1)),\n data: protocolString,\n });\n }\n\n return errors;\n }\n\n static validateServer(\n spec: OpenAPIV3.Document,\n allowMissingId: boolean,\n allowAPIKeyAuth: boolean,\n allowMultipleParameters: boolean,\n allowOauth2: boolean\n ): ErrorResult[] {\n const errors: ErrorResult[] = [];\n\n let hasTopLevelServers = false;\n let hasPathLevelServers = false;\n let hasOperationLevelServers = false;\n\n if (spec.servers && spec.servers.length >= 1) {\n hasTopLevelServers = true;\n\n // for multiple server, we only use the first url\n const serverErrors = Utils.checkServerUrl(spec.servers);\n errors.push(...serverErrors);\n }\n\n const paths = spec.paths;\n for (const path in paths) {\n const methods = paths[path];\n\n if (methods?.servers && methods.servers.length >= 1) {\n hasPathLevelServers = true;\n const serverErrors = Utils.checkServerUrl(methods.servers);\n errors.push(...serverErrors);\n }\n\n for (const method in methods) {\n const operationObject = (methods as any)[method] as OpenAPIV3.OperationObject;\n if (\n Utils.isSupportedApi(\n method,\n path,\n spec,\n allowMissingId,\n allowAPIKeyAuth,\n allowMultipleParameters,\n allowOauth2\n )\n ) {\n if (operationObject?.servers && operationObject.servers.length >= 1) {\n hasOperationLevelServers = true;\n const serverErrors = Utils.checkServerUrl(operationObject.servers);\n errors.push(...serverErrors);\n }\n }\n }\n }\n if (!hasTopLevelServers && !hasPathLevelServers && !hasOperationLevelServers) {\n errors.push({\n type: ErrorType.NoServerInformation,\n content: ConstantString.NoServerInformation,\n });\n }\n return errors;\n }\n\n static isWellKnownName(name: string, wellknownNameList: string[]): boolean {\n for (let i = 0; i < wellknownNameList.length; i++) {\n name = name.replace(/_/g, \"\").replace(/-/g, \"\");\n if (name.toLowerCase().includes(wellknownNameList[i])) {\n return true;\n }\n }\n return false;\n }\n\n static generateParametersFromSchema(\n schema: OpenAPIV3.SchemaObject,\n name: string,\n allowMultipleParameters: boolean,\n isRequired = false\n ): [Parameter[], Parameter[]] {\n const requiredParams: Parameter[] = [];\n const optionalParams: Parameter[] = [];\n\n if (\n schema.type === \"string\" ||\n schema.type === \"integer\" ||\n schema.type === \"boolean\" ||\n schema.type === \"number\"\n ) {\n const parameter = {\n name: name,\n title: Utils.updateFirstLetter(name).slice(0, ConstantString.ParameterTitleMaxLens),\n description: (schema.description ?? \"\").slice(\n 0,\n ConstantString.ParameterDescriptionMaxLens\n ),\n };\n\n if (allowMultipleParameters) {\n Utils.updateParameterWithInputType(schema, parameter);\n }\n\n if (isRequired && schema.default === undefined) {\n requiredParams.push(parameter);\n } else {\n optionalParams.push(parameter);\n }\n } else if (schema.type === \"object\") {\n const { properties } = schema;\n for (const property in properties) {\n let isRequired = false;\n if (schema.required && schema.required?.indexOf(property) >= 0) {\n isRequired = true;\n }\n const [requiredP, optionalP] = Utils.generateParametersFromSchema(\n properties[property] as OpenAPIV3.SchemaObject,\n property,\n allowMultipleParameters,\n isRequired\n );\n\n requiredParams.push(...requiredP);\n optionalParams.push(...optionalP);\n }\n }\n\n return [requiredParams, optionalParams];\n }\n\n static updateParameterWithInputType(schema: OpenAPIV3.SchemaObject, param: Parameter): void {\n if (schema.enum) {\n param.inputType = \"choiceset\";\n param.choices = [];\n for (let i = 0; i < schema.enum.length; i++) {\n param.choices.push({\n title: schema.enum[i],\n value: schema.enum[i],\n });\n }\n } else if (schema.type === \"string\") {\n param.inputType = \"text\";\n } else if (schema.type === \"integer\" || schema.type === \"number\") {\n param.inputType = \"number\";\n } else if (schema.type === \"boolean\") {\n param.inputType = \"toggle\";\n }\n\n if (schema.default) {\n param.value = schema.default;\n }\n }\n\n static parseApiInfo(\n operationItem: OpenAPIV3.OperationObject,\n allowMultipleParameters: boolean\n ): [IMessagingExtensionCommand, WarningResult | undefined] {\n const requiredParams: Parameter[] = [];\n const optionalParams: Parameter[] = [];\n const paramObject = operationItem.parameters as OpenAPIV3.ParameterObject[];\n\n if (paramObject) {\n paramObject.forEach((param: OpenAPIV3.ParameterObject) => {\n const parameter: Parameter = {\n name: param.name,\n title: Utils.updateFirstLetter(param.name).slice(0, ConstantString.ParameterTitleMaxLens),\n description: (param.description ?? \"\").slice(\n 0,\n ConstantString.ParameterDescriptionMaxLens\n ),\n };\n\n const schema = param.schema as OpenAPIV3.SchemaObject;\n if (allowMultipleParameters && schema) {\n Utils.updateParameterWithInputType(schema, parameter);\n }\n\n if (param.in !== \"header\" && param.in !== \"cookie\") {\n if (param.required && schema?.default === undefined) {\n requiredParams.push(parameter);\n } else {\n optionalParams.push(parameter);\n }\n }\n });\n }\n\n if (operationItem.requestBody) {\n const requestBody = operationItem.requestBody as OpenAPIV3.RequestBodyObject;\n const requestJson = requestBody.content[\"application/json\"];\n if (Object.keys(requestJson).length !== 0) {\n const schema = requestJson.schema as OpenAPIV3.SchemaObject;\n const [requiredP, optionalP] = Utils.generateParametersFromSchema(\n schema,\n \"requestBody\",\n allowMultipleParameters,\n requestBody.required\n );\n requiredParams.push(...requiredP);\n optionalParams.push(...optionalP);\n }\n }\n\n const operationId = operationItem.operationId!;\n\n const parameters = [];\n\n if (requiredParams.length !== 0) {\n parameters.push(...requiredParams);\n } else {\n parameters.push(optionalParams[0]);\n }\n\n const command: IMessagingExtensionCommand = {\n context: [\"compose\"],\n type: \"query\",\n title: (operationItem.summary ?? \"\").slice(0, ConstantString.CommandTitleMaxLens),\n id: operationId,\n parameters: parameters,\n description: (operationItem.description ?? \"\").slice(\n 0,\n ConstantString.CommandDescriptionMaxLens\n ),\n };\n let warning: WarningResult | undefined = undefined;\n\n if (requiredParams.length === 0 && optionalParams.length > 1) {\n warning = {\n type: WarningType.OperationOnlyContainsOptionalParam,\n content: Utils.format(ConstantString.OperationOnlyContainsOptionalParam, operationId),\n data: operationId,\n };\n }\n return [command, warning];\n }\n\n static listSupportedAPIs(\n spec: OpenAPIV3.Document,\n allowMissingId: boolean,\n allowAPIKeyAuth: boolean,\n allowMultipleParameters: boolean,\n allowOauth2: boolean\n ): {\n [key: string]: OpenAPIV3.OperationObject;\n } {\n const paths = spec.paths;\n const result: { [key: string]: OpenAPIV3.OperationObject } = {};\n for (const path in paths) {\n const methods = paths[path];\n for (const method in methods) {\n // For developer preview, only support GET operation with only 1 parameter without auth\n if (\n Utils.isSupportedApi(\n method,\n path,\n spec,\n allowMissingId,\n allowAPIKeyAuth,\n allowMultipleParameters,\n allowOauth2\n )\n ) {\n const operationObject = (methods as any)[method] as OpenAPIV3.OperationObject;\n result[`${method.toUpperCase()} ${path}`] = operationObject;\n }\n }\n }\n return result;\n }\n\n static validateSpec(\n spec: OpenAPIV3.Document,\n parser: SwaggerParser,\n isSwaggerFile: boolean,\n allowMissingId: boolean,\n allowAPIKeyAuth: boolean,\n allowMultipleParameters: boolean,\n allowOauth2: boolean\n ): ValidateResult {\n const errors: ErrorResult[] = [];\n const warnings: WarningResult[] = [];\n\n if (isSwaggerFile) {\n warnings.push({\n type: WarningType.ConvertSwaggerToOpenAPI,\n content: ConstantString.ConvertSwaggerToOpenAPI,\n });\n }\n\n // Server validation\n const serverErrors = Utils.validateServer(\n spec,\n allowMissingId,\n allowAPIKeyAuth,\n allowMultipleParameters,\n allowOauth2\n );\n errors.push(...serverErrors);\n\n // Remote reference not supported\n const refPaths = parser.$refs.paths();\n\n // refPaths [0] is the current spec file path\n if (refPaths.length > 1) {\n errors.push({\n type: ErrorType.RemoteRefNotSupported,\n content: Utils.format(ConstantString.RemoteRefNotSupported, refPaths.join(\", \")),\n data: refPaths,\n });\n }\n\n // No supported API\n const apiMap = Utils.listSupportedAPIs(\n spec,\n allowMissingId,\n allowAPIKeyAuth,\n allowMultipleParameters,\n allowOauth2\n );\n if (Object.keys(apiMap).length === 0) {\n errors.push({\n type: ErrorType.NoSupportedApi,\n content: ConstantString.NoSupportedApi,\n });\n }\n\n // OperationId missing\n const apisMissingOperationId: string[] = [];\n for (const key in apiMap) {\n const pathObjectItem = apiMap[key];\n if (!pathObjectItem.operationId) {\n apisMissingOperationId.push(key);\n }\n }\n\n if (apisMissingOperationId.length > 0) {\n warnings.push({\n type: WarningType.OperationIdMissing,\n content: Utils.format(ConstantString.MissingOperationId, apisMissingOperationId.join(\", \")),\n data: apisMissingOperationId,\n });\n }\n\n let status = ValidationStatus.Valid;\n if (warnings.length > 0 && errors.length === 0) {\n status = ValidationStatus.Warning;\n } else if (errors.length > 0) {\n status = ValidationStatus.Error;\n }\n\n return {\n status,\n warnings,\n errors,\n };\n }\n\n static format(str: string, ...args: string[]): string {\n let index = 0;\n return str.replace(/%s/g, () => {\n const arg = args[index++];\n return arg !== undefined ? arg : \"\";\n });\n }\n\n static getSafeRegistrationIdEnvName(authName: string): string {\n if (!authName) {\n return \"\";\n }\n\n let safeRegistrationIdEnvName = authName.toUpperCase().replace(/[^A-Z0-9_]/g, \"_\");\n\n if (!safeRegistrationIdEnvName.match(/^[A-Z]/)) {\n safeRegistrationIdEnvName = \"PREFIX_\" + safeRegistrationIdEnvName;\n }\n\n return safeRegistrationIdEnvName;\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\"use strict\";\n\nimport SwaggerParser from \"@apidevtools/swagger-parser\";\nimport { OpenAPIV3 } from \"openapi-types\";\nimport {\n APIInfo,\n ErrorType,\n GenerateResult,\n ParseOptions,\n ValidateResult,\n ValidationStatus,\n Parameter,\n ListAPIResult,\n} from \"./interfaces\";\nimport { SpecParserError } from \"./specParserError\";\nimport { Utils } from \"./utils\";\nimport { ConstantString } from \"./constants\";\n\n/**\n * A class that parses an OpenAPI specification file and provides methods to validate, list, and generate artifacts.\n */\nexport class SpecParser {\n public readonly pathOrSpec: string | OpenAPIV3.Document;\n public readonly parser: SwaggerParser;\n public readonly options: Required<ParseOptions>;\n\n private apiMap: { [key: string]: OpenAPIV3.PathItemObject } | undefined;\n private spec: OpenAPIV3.Document | undefined;\n private unResolveSpec: OpenAPIV3.Document | undefined;\n private isSwaggerFile: boolean | undefined;\n\n private defaultOptions: ParseOptions = {\n allowMissingId: false,\n allowSwagger: false,\n allowAPIKeyAuth: false,\n allowMultipleParameters: false,\n allowOauth2: false,\n };\n\n /**\n * Creates a new instance of the SpecParser class.\n * @param pathOrDoc The path to the OpenAPI specification file or the OpenAPI specification object.\n * @param options The options for parsing the OpenAPI specification file.\n */\n constructor(pathOrDoc: string | OpenAPIV3.Document, options?: ParseOptions) {\n this.pathOrSpec = pathOrDoc;\n this.parser = new SwaggerParser();\n this.options = {\n ...this.defaultOptions,\n ...(options ?? {}),\n } as Required<ParseOptions>;\n }\n\n /**\n * Validates the OpenAPI specification file and returns a validation result.\n *\n * @returns A validation result object that contains information about any errors or warnings in the specification file.\n */\n async validate(): Promise<ValidateResult> {\n try {\n try {\n await this.loadSpec();\n await this.parser.validate(this.spec!, {\n validate: {\n schema: false,\n },\n });\n } catch (e) {\n return {\n status: ValidationStatus.Error,\n warnings: [],\n errors: [{ type: ErrorType.SpecNotValid, content: (e as Error).toString() }],\n };\n }\n\n if (!this.options.allowSwagger && this.isSwaggerFile) {\n return {\n status: ValidationStatus.Error,\n warnings: [],\n errors: [\n { type: ErrorType.SwaggerNotSupported, content: ConstantString.SwaggerNotSupported },\n ],\n };\n }\n\n return Utils.validateSpec(\n this.spec!,\n this.parser,\n !!this.isSwaggerFile,\n this.options.allowMissingId,\n this.options.allowAPIKeyAuth,\n this.options.allowMultipleParameters,\n this.options.allowOauth2\n );\n } catch (err) {\n throw new SpecParserError((err as Error).toString(), ErrorType.ValidateFailed);\n }\n }\n\n async listSupportedAPIInfo(): Promise<APIInfo[]> {\n try {\n await this.loadSpec();\n const apiMap = this.getAllSupportedAPIs(this.spec!);\n const apiInfos: APIInfo[] = [];\n for (const key in apiMap) {\n const pathObjectItem = apiMap[key];\n const [method, path] = key.split(\" \");\n const operationId = pathObjectItem.operationId;\n\n // In Browser environment, this api is by default not support api without operationId\n if (!operationId) {\n continue;\n }\n\n const [command, warning] = Utils.parseApiInfo(\n pathObjectItem,\n this.options.allowMultipleParameters\n );\n\n const apiInfo: APIInfo = {\n method: method,\n path: path,\n title: command.title,\n id: operationId,\n parameters: command.parameters! as Parameter[],\n description: command.description!,\n };\n\n if (warning) {\n apiInfo.warning = warning;\n }\n\n apiInfos.push(apiInfo);\n }\n\n return apiInfos;\n } catch (err) {\n throw new SpecParserError((err as Error).toString(), ErrorType.listSupportedAPIInfoFailed);\n }\n }\n\n /**\n * Lists all the OpenAPI operations in the specification file.\n * @returns A string array that represents the HTTP method and path of each operation, such as ['GET /pets/{petId}', 'GET /user/{userId}']\n * according to copilot plugin spec, only list get and post method without auth\n */\n // eslint-disable-next-line @typescript-eslint/require-await\n async list(): Promise<ListAPIResult[]> {\n throw new Error(\"Method not implemented.\");\n }\n\n /**\n * Generate specs according to the filters.\n * @param filter An array of strings that represent the filters to apply when generating the artifacts. If filter is empty, it would process nothing.\n */\n // eslint-disable-next-line @typescript-eslint/require-await\n async getFilteredSpecs(\n filter: string[],\n signal?: AbortSignal\n ): Promise<[OpenAPIV3.Document, OpenAPIV3.Document]> {\n throw new Error(\"Method not implemented.\");\n }\n\n /**\n * Generates and update artifacts from the OpenAPI specification file. Generate Adaptive Cards, update Teams app manifest, and generate a new OpenAPI specification file.\n * @param manifestPath A file path of the Teams app manifest file to update.\n * @param filter An array of strings that represent the filters to apply when generating the artifacts. If filter is empty, it would process nothing.\n * @param outputSpecPath File path of the new OpenAPI specification file to generate. If not specified or empty, no spec file will be generated.\n * @param adaptiveCardFolder Folder path where the Adaptive Card files will be generated. If not specified or empty, Adaptive Card files will not be generated.\n * @param isMe Boolean that indicates whether the project is an Messaging Extension. For Messaging Extension, composeExtensions will be added in Teams app manifest.\n */\n // eslint-disable-next-line @typescript-eslint/require-await\n async generate(\n manifestPath: string,\n filter: string[],\n outputSpecPath: string,\n adaptiveCardFolder: string,\n signal?: AbortSignal,\n isMe?: boolean\n ): Promise<GenerateResult> {\n throw new Error(\"Method not implemented.\");\n }\n\n private async loadSpec(): Promise<void> {\n if (!this.spec) {\n this.unResolveSpec = (await this.parser.parse(this.pathOrSpec)) as OpenAPIV3.Document;\n if (!this.unResolveSpec.openapi && (this.unResolveSpec as any).swagger === \"2.0\") {\n this.isSwaggerFile = true;\n }\n\n const clonedUnResolveSpec = JSON.parse(JSON.stringify(this.unResolveSpec));\n this.spec = (await this.parser.dereference(clonedUnResolveSpec)) as OpenAPIV3.Document;\n }\n }\n\n private getAllSupportedAPIs(spec: OpenAPIV3.Document): {\n [key: string]: OpenAPIV3.OperationObject;\n } {\n if (this.apiMap !== undefined) {\n return this.apiMap;\n }\n const result = Utils.listSupportedAPIs(\n spec,\n this.options.allowMissingId,\n this.options.allowAPIKeyAuth,\n this.options.allowMultipleParameters,\n this.options.allowOauth2\n );\n this.apiMap = result;\n return result;\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\"use strict\";\n\nimport { OpenAPIV3 } from \"openapi-types\";\nimport { Utils } from \"./utils\";\nimport {\n AdaptiveCard,\n ArrayElement,\n ErrorType,\n ImageElement,\n TextBlockElement,\n} from \"./interfaces\";\nimport { ConstantString } from \"./constants\";\nimport { SpecParserError } from \"./specParserError\";\n\nexport class AdaptiveCardGenerator {\n static generateAdaptiveCard(operationItem: OpenAPIV3.OperationObject): [AdaptiveCard, string] {\n try {\n const json = Utils.getResponseJson(operationItem);\n\n let cardBody: Array<TextBlockElement | ImageElement | ArrayElement> = [];\n\n let schema = json.schema as OpenAPIV3.SchemaObject;\n let jsonPath = \"$\";\n if (schema && Object.keys(schema).length > 0) {\n jsonPath = AdaptiveCardGenerator.getResponseJsonPathFromSchema(schema);\n if (jsonPath !== \"$\") {\n schema = schema.properties![jsonPath] as OpenAPIV3.SchemaObject;\n }\n\n cardBody = AdaptiveCardGenerator.generateCardFromResponse(schema, \"\");\n }\n\n // if no schema, try to use example value\n if (cardBody.length === 0 && (json.examples || json.example)) {\n cardBody = [\n {\n type: ConstantString.TextBlockType,\n text: \"${jsonStringify($root)}\",\n wrap: true,\n },\n ];\n }\n\n // if no example value, use default success response\n if (cardBody.length === 0) {\n cardBody = [\n {\n type: ConstantString.TextBlockType,\n text: \"success\",\n wrap: true,\n },\n ];\n }\n\n const fullCard: AdaptiveCard = {\n type: ConstantString.AdaptiveCardType,\n $schema: ConstantString.AdaptiveCardSchema,\n version: ConstantString.AdaptiveCardVersion,\n body: cardBody,\n };\n\n return [fullCard, jsonPath];\n } catch (err) {\n throw new SpecParserError((err as Error).toString(), ErrorType.GenerateAdaptiveCardFailed);\n }\n }\n\n static generateCardFromResponse(\n schema: OpenAPIV3.SchemaObject,\n name: string,\n parentArrayName = \"\"\n ): Array<TextBlockElement | ImageElement | ArrayElement> {\n if (schema.type === \"array\") {\n // schema.items can be arbitrary object: schema { type: array, items: {} }\n if (Object.keys(schema.items).length === 0) {\n return [\n {\n type: ConstantString.TextBlockType,\n text: name ? `${name}: \\${jsonStringify(${name})}` : \"result: ${jsonStringify($root)}\",\n wrap: true,\n },\n ];\n }\n\n const obj = AdaptiveCardGenerator.generateCardFromResponse(\n schema.items as OpenAPIV3.SchemaObject,\n \"\",\n name\n );\n const template = {\n type: ConstantString.ContainerType,\n $data: name ? `\\${${name}}` : \"${$root}\",\n items: Array<TextBlockElement | ImageElement | ArrayElement>(),\n };\n\n template.items.push(...obj);\n return [template];\n }\n // some schema may not contain type but contain properties\n if (schema.type === \"object\" || (!schema.type && schema.properties)) {\n const { properties } = schema;\n const result: Array<TextBlockElement | ImageElement | ArrayElement> = [];\n for (const property in properties) {\n const obj = AdaptiveCardGenerator.generateCardFromResponse(\n properties[property] as OpenAPIV3.SchemaObject,\n name ? `${name}.${property}` : property,\n parentArrayName\n );\n result.push(...obj);\n }\n\n if (schema.additionalProperties) {\n // TODO: better ways to handler warnings.\n console.warn(ConstantString.AdditionalPropertiesNotSupported);\n }\n\n return result;\n }\n if (\n schema.type === \"string\" ||\n schema.type === \"integer\" ||\n schema.type === \"boolean\" ||\n schema.type === \"number\"\n ) {\n if (!AdaptiveCardGenerator.isImageUrlProperty(schema, name, parentArrayName)) {\n // string in root: \"ddd\"\n let text = \"result: ${$root}\";\n if (name) {\n // object { id: \"1\" }\n text = `${name}: \\${if(${name}, ${name}, 'N/A')}`;\n if (parentArrayName) {\n // object types inside array: { tags: [\"id\": 1, \"name\": \"name\"] }\n text = `${parentArrayName}.${text}`;\n }\n } else if (parentArrayName) {\n // string array: photoUrls: [\"1\", \"2\"]\n text = `${parentArrayName}: ` + \"${$data}\";\n }\n\n return [\n {\n type: ConstantString.TextBlockType,\n text,\n wrap: true,\n },\n ];\n } else {\n if (name) {\n return [\n {\n type: \"Image\",\n url: `\\${${name}}`,\n $when: `\\${${name} != null}`,\n },\n ];\n } else {\n return [\n {\n type: \"Image\",\n url: \"${$data}\",\n $when: \"${$data != null}\",\n },\n ];\n }\n }\n }\n\n if (schema.oneOf || schema.anyOf || schema.not || schema.allOf) {\n throw new Error(Utils.format(ConstantString.SchemaNotSupported, JSON.stringify(schema)));\n }\n\n throw new Error(Utils.format(ConstantString.UnknownSchema, JSON.stringify(schema)));\n }\n\n // Find the first array property in the response schema object with the well-known name\n static getResponseJsonPathFromSchema(schema: OpenAPIV3.SchemaObject): string {\n if (schema.type === \"object\" || (!schema.type && schema.properties)) {\n const { properties } = schema;\n for (const property in properties) {\n const schema = properties[property] as OpenAPIV3.SchemaObject;\n if (\n schema.type === \"array\" &&\n Utils.isWellKnownName(property, ConstantString.WellknownResultNames)\n ) {\n return property;\n }\n }\n }\n\n return \"$\";\n }\n\n static isImageUrlProperty(\n schema: OpenAPIV3.NonArraySchemaObject,\n name: string,\n parentArrayName: string\n ): boolean {\n const propertyName = name ? name : parentArrayName;\n return (\n !!propertyName &&\n schema.type === \"string\" &&\n Utils.isWellKnownName(propertyName, ConstantString.WellknownImageName) &&\n (propertyName.toLocaleLowerCase().indexOf(\"url\") >= 0 || schema.format === \"uri\")\n );\n }\n}\n"],"names":[],"mappings":";;AAAA;AAuEA;;;IAGY;AAAZ,WAAY,SAAS;IACnB,4CAA+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IAAI,IAAI,MAAM,CAAC,UAAU,CAAC,EAAE;YACnE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;YAC9B,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE;gBACjC,MAAM,MAAM,GAAG,UAAU,CAAC,QAAQ,CAA2B,CAAC;gBAC9D,IACE,MAAM,CAAC,IAAI,KAAK,OAAO;oBACvB,KAAK,CAAC,eAAe,CAAC,QAAQ,EAAE,cAAc,CAAC,oBAAoB,CAAC,EACpE;oBACA,OAAO,QAAQ,CAAC;iBACjB;aACF;SACF;QAED,OAAO,GAAG,CAAC;KACZ;IAED,OAAO,kBAAkB,CACvB,MAAsC,EACtC,IAAY,EACZ,eAAuB;QAEvB,MAAM,YAAY,GAAG,IAAI,GAAG,IAAI,GAAG,eAAe,CAAC;QACnD,QACE,CAAC,CAAC,YAAY;YACd,MAAM,CAAC,IAAI,KAAK,QAAQ;YACxB,KAAK,CAAC,eAAe,CAAC,YAAY,EAAE,cAAc,CAAC,kBAAkB,CAAC;aACrE,YAAY,CAAC,iBAAiB,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,MAAM,KAAK,KAAK,CAAC,EACjF;KACH;;;;;"}
1
+ {"version":3,"file":"index.esm2017.js","sources":["../src/interfaces.ts","../src/specParserError.ts","../src/constants.ts","../src/utils.ts","../src/specParser.browser.ts","../src/adaptiveCardGenerator.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\"use strict\";\n\nimport { OpenAPIV3 } from \"openapi-types\";\n\n/**\n * An interface that represents the result of validating an OpenAPI specification file.\n */\nexport interface ValidateResult {\n /**\n * The validation status of the OpenAPI specification file.\n */\n status: ValidationStatus;\n\n /**\n * An array of warning results generated during validation.\n */\n warnings: WarningResult[];\n\n /**\n * An array of error results generated during validation.\n */\n errors: ErrorResult[];\n}\n\n/**\n * An interface that represents a warning result generated during validation.\n */\nexport interface WarningResult {\n /**\n * The type of warning.\n */\n type: WarningType;\n\n /**\n * The content of the warning.\n */\n content: string;\n\n /**\n * data of the warning.\n */\n data?: any;\n}\n\n/**\n * An interface that represents an error result generated during validation.\n */\nexport interface ErrorResult {\n /**\n * The type of error.\n */\n type: ErrorType;\n\n /**\n * The content of the error.\n */\n content: string;\n\n /**\n * data of the error.\n */\n data?: any;\n}\n\nexport interface GenerateResult {\n allSuccess: boolean;\n warnings: WarningResult[];\n}\n\n/**\n * An enum that represents the types of errors that can occur during validation.\n */\nexport enum ErrorType {\n SpecNotValid = \"spec-not-valid\",\n RemoteRefNotSupported = \"remote-ref-not-supported\",\n NoServerInformation = \"no-server-information\",\n UrlProtocolNotSupported = \"url-protocol-not-supported\",\n RelativeServerUrlNotSupported = \"relative-server-url-not-supported\",\n NoSupportedApi = \"no-supported-api\",\n NoExtraAPICanBeAdded = \"no-extra-api-can-be-added\",\n ResolveServerUrlFailed = \"resolve-server-url-failed\",\n SwaggerNotSupported = \"swagger-not-supported\",\n MultipleAPIKeyNotSupported = \"multiple-api-key-not-supported\",\n\n ListFailed = \"list-failed\",\n listSupportedAPIInfoFailed = \"list-supported-api-info-failed\",\n FilterSpecFailed = \"filter-spec-failed\",\n UpdateManifestFailed = \"update-manifest-failed\",\n GenerateAdaptiveCardFailed = \"generate-adaptive-card-failed\",\n GenerateFailed = \"generate-failed\",\n ValidateFailed = \"validate-failed\",\n GetSpecFailed = \"get-spec-failed\",\n\n Cancelled = \"cancelled\",\n Unknown = \"unknown\",\n}\n\n/**\n * An enum that represents the types of warnings that can occur during validation.\n */\nexport enum WarningType {\n OperationIdMissing = \"operationid-missing\",\n GenerateCardFailed = \"generate-card-failed\",\n OperationOnlyContainsOptionalParam = \"operation-only-contains-optional-param\",\n ConvertSwaggerToOpenAPI = \"convert-swagger-to-openapi\",\n Unknown = \"unknown\",\n}\n\n/**\n * An enum that represents the validation status of an OpenAPI specification file.\n */\nexport enum ValidationStatus {\n Valid,\n Warning, // If there are any warnings, the file is still valid\n Error, // If there are any errors, the file is not valid\n}\n\nexport interface TextBlockElement {\n type: string;\n text: string;\n wrap: boolean;\n}\n\nexport interface ImageElement {\n type: string;\n url: string;\n $when: string;\n}\n\nexport interface ArrayElement {\n type: string;\n $data: string;\n items: Array<TextBlockElement | ImageElement | ArrayElement>;\n}\n\nexport interface AdaptiveCard {\n type: string;\n $schema: string;\n version: string;\n body: Array<TextBlockElement | ImageElement | ArrayElement>;\n}\n\nexport interface PreviewCardTemplate {\n title: string;\n subtitle?: string;\n image?: {\n url: string;\n alt?: string;\n $when?: string;\n };\n}\n\nexport interface WrappedAdaptiveCard {\n version: string;\n $schema?: string;\n jsonPath?: string;\n responseLayout: string;\n responseCardTemplate: AdaptiveCard;\n previewCardTemplate: PreviewCardTemplate;\n}\n\nexport interface ChoicesItem {\n title: string;\n value: string;\n}\n\nexport interface Parameter {\n name: string;\n title: string;\n description: string;\n inputType?: \"text\" | \"textarea\" | \"number\" | \"date\" | \"time\" | \"toggle\" | \"choiceset\";\n value?: string;\n choices?: ChoicesItem[];\n}\n\nexport interface CheckParamResult {\n requiredNum: number;\n optionalNum: number;\n isValid: boolean;\n}\n\nexport interface ParseOptions {\n allowMissingId?: boolean;\n allowSwagger?: boolean;\n allowAPIKeyAuth?: boolean;\n allowMultipleParameters?: boolean;\n allowOauth2?: boolean;\n isCopilot?: boolean;\n}\n\nexport interface APIInfo {\n method: string;\n path: string;\n title: string;\n id: string;\n parameters: Parameter[];\n description: string;\n warning?: WarningResult;\n}\n\nexport interface ListAPIResult {\n api: string;\n server: string;\n operationId: string;\n auth?: OpenAPIV3.SecuritySchemeObject;\n}\n\nexport interface AuthSchema {\n authSchema: OpenAPIV3.SecuritySchemeObject;\n name: string;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\"use strict\";\n\nimport { ErrorType } from \"./interfaces\";\n\nexport class SpecParserError extends Error {\n public readonly errorType: ErrorType;\n\n constructor(message: string, errorType: ErrorType) {\n super(message);\n this.errorType = errorType;\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\"use strict\";\n\nexport class ConstantString {\n static readonly CancelledMessage = \"Operation is cancelled.\";\n static readonly NoServerInformation =\n \"No server information is found in the OpenAPI description document.\";\n static readonly RemoteRefNotSupported = \"Remote reference is not supported: %s.\";\n static readonly MissingOperationId = \"Missing operationIds: %s.\";\n static readonly NoSupportedApi =\n \"No supported API is found in the OpenAPI description document: only GET and POST methods are supported, additionally, there can be at most one required parameter, and no auth is allowed.\";\n\n static readonly AdditionalPropertiesNotSupported =\n \"'additionalProperties' is not supported, and will be ignored.\";\n static readonly SchemaNotSupported = \"'oneOf', 'anyOf', and 'not' schema are not supported: %s.\";\n static readonly UnknownSchema = \"Unknown schema: %s.\";\n\n static readonly UrlProtocolNotSupported =\n \"Server url is not correct: protocol %s is not supported, you should use https protocol instead.\";\n static readonly RelativeServerUrlNotSupported =\n \"Server url is not correct: relative server url is not supported.\";\n static readonly ResolveServerUrlFailed =\n \"Unable to resolve the server URL: please make sure that the environment variable %s is defined.\";\n static readonly OperationOnlyContainsOptionalParam =\n \"Operation %s contains multiple optional parameters. The first optional parameter is used for this command.\";\n static readonly ConvertSwaggerToOpenAPI =\n \"The Swagger 2.0 file has been converted to OpenAPI 3.0.\";\n\n static readonly SwaggerNotSupported =\n \"Swagger 2.0 is not supported. Please convert to OpenAPI 3.0 manually before proceeding.\";\n\n static readonly MultipleAPIKeyNotSupported =\n \"Multiple API keys are not supported. Please make sure that all selected APIs use the same API key.\";\n\n static readonly UnsupportedSchema = \"Unsupported schema in %s %s: %s\";\n\n static readonly WrappedCardVersion = \"devPreview\";\n static readonly WrappedCardSchema =\n \"https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.ResponseRenderingTemplate.schema.json\";\n static readonly WrappedCardResponseLayout = \"list\";\n\n static readonly GetMethod = \"get\";\n static readonly PostMethod = \"post\";\n static readonly AdaptiveCardVersion = \"1.5\";\n static readonly AdaptiveCardSchema = \"http://adaptivecards.io/schemas/adaptive-card.json\";\n static readonly AdaptiveCardType = \"AdaptiveCard\";\n static readonly TextBlockType = \"TextBlock\";\n static readonly ContainerType = \"Container\";\n static readonly RegistrationIdPostfix = \"REGISTRATION_ID\";\n static readonly ResponseCodeFor20X = [\n \"200\",\n \"201\",\n \"202\",\n \"203\",\n \"204\",\n \"205\",\n \"206\",\n \"207\",\n \"208\",\n \"226\",\n \"default\",\n ];\n static readonly AllOperationMethods = [\n \"get\",\n \"post\",\n \"put\",\n \"delete\",\n \"patch\",\n \"head\",\n \"options\",\n \"trace\",\n ];\n\n // TODO: update after investigating the usage of these constants.\n static readonly WellknownResultNames = [\n \"result\",\n \"data\",\n \"items\",\n \"root\",\n \"matches\",\n \"queries\",\n \"list\",\n \"output\",\n ];\n static readonly WellknownTitleName = [\"title\", \"name\", \"summary\", \"caption\", \"subject\", \"label\"];\n static readonly WellknownSubtitleName = [\n \"subtitle\",\n \"id\",\n \"uid\",\n \"description\",\n \"desc\",\n \"detail\",\n ];\n static readonly WellknownImageName = [\n \"image\",\n \"icon\",\n \"avatar\",\n \"picture\",\n \"photo\",\n \"logo\",\n \"pic\",\n \"thumbnail\",\n \"img\",\n ];\n\n static readonly ShortDescriptionMaxLens = 80;\n static readonly FullDescriptionMaxLens = 4000;\n static readonly CommandDescriptionMaxLens = 128;\n static readonly ParameterDescriptionMaxLens = 128;\n static readonly CommandTitleMaxLens = 32;\n static readonly ParameterTitleMaxLens = 32;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\"use strict\";\n\nimport { OpenAPIV3 } from \"openapi-types\";\nimport SwaggerParser from \"@apidevtools/swagger-parser\";\nimport { ConstantString } from \"./constants\";\nimport {\n AuthSchema,\n CheckParamResult,\n ErrorResult,\n ErrorType,\n Parameter,\n ValidateResult,\n ValidationStatus,\n WarningResult,\n WarningType,\n} from \"./interfaces\";\nimport { IMessagingExtensionCommand } from \"@microsoft/teams-manifest\";\n\nexport class Utils {\n static hasNestedObjectInSchema(schema: OpenAPIV3.SchemaObject): boolean {\n if (schema.type === \"object\") {\n for (const property in schema.properties) {\n const nestedSchema = schema.properties[property] as OpenAPIV3.SchemaObject;\n if (nestedSchema.type === \"object\") {\n return true;\n }\n }\n }\n return false;\n }\n\n static checkParameters(\n paramObject: OpenAPIV3.ParameterObject[],\n isCopilot: boolean\n ): CheckParamResult {\n const paramResult = {\n requiredNum: 0,\n optionalNum: 0,\n isValid: true,\n };\n\n if (!paramObject) {\n return paramResult;\n }\n\n for (let i = 0; i < paramObject.length; i++) {\n const param = paramObject[i];\n const schema = param.schema as OpenAPIV3.SchemaObject;\n\n if (isCopilot && this.hasNestedObjectInSchema(schema)) {\n paramResult.isValid = false;\n continue;\n }\n\n const isRequiredWithoutDefault = param.required && schema.default === undefined;\n\n if (isCopilot) {\n if (isRequiredWithoutDefault) {\n paramResult.requiredNum = paramResult.requiredNum + 1;\n } else {\n paramResult.optionalNum = paramResult.optionalNum + 1;\n }\n continue;\n }\n\n if (param.in === \"header\" || param.in === \"cookie\") {\n if (isRequiredWithoutDefault) {\n paramResult.isValid = false;\n }\n continue;\n }\n\n if (\n schema.type !== \"boolean\" &&\n schema.type !== \"string\" &&\n schema.type !== \"number\" &&\n schema.type !== \"integer\"\n ) {\n if (isRequiredWithoutDefault) {\n paramResult.isValid = false;\n }\n continue;\n }\n\n if (param.in === \"query\" || param.in === \"path\") {\n if (isRequiredWithoutDefault) {\n paramResult.requiredNum = paramResult.requiredNum + 1;\n } else {\n paramResult.optionalNum = paramResult.optionalNum + 1;\n }\n }\n }\n\n return paramResult;\n }\n\n static checkPostBody(\n schema: OpenAPIV3.SchemaObject,\n isRequired = false,\n isCopilot = false\n ): CheckParamResult {\n const paramResult = {\n requiredNum: 0,\n optionalNum: 0,\n isValid: true,\n };\n\n if (Object.keys(schema).length === 0) {\n return paramResult;\n }\n\n const isRequiredWithoutDefault = isRequired && schema.default === undefined;\n\n if (isCopilot && this.hasNestedObjectInSchema(schema)) {\n paramResult.isValid = false;\n return paramResult;\n }\n\n if (\n schema.type === \"string\" ||\n schema.type === \"integer\" ||\n schema.type === \"boolean\" ||\n schema.type === \"number\"\n ) {\n if (isRequiredWithoutDefault) {\n paramResult.requiredNum = paramResult.requiredNum + 1;\n } else {\n paramResult.optionalNum = paramResult.optionalNum + 1;\n }\n } else if (schema.type === \"object\") {\n const { properties } = schema;\n for (const property in properties) {\n let isRequired = false;\n if (schema.required && schema.required?.indexOf(property) >= 0) {\n isRequired = true;\n }\n const result = Utils.checkPostBody(\n properties[property] as OpenAPIV3.SchemaObject,\n isRequired,\n isCopilot\n );\n paramResult.requiredNum += result.requiredNum;\n paramResult.optionalNum += result.optionalNum;\n paramResult.isValid = paramResult.isValid && result.isValid;\n }\n } else {\n if (isRequiredWithoutDefault && !isCopilot) {\n paramResult.isValid = false;\n }\n }\n return paramResult;\n }\n\n /**\n * Checks if the given API is supported.\n * @param {string} method - The HTTP method of the API.\n * @param {string} path - The path of the API.\n * @param {OpenAPIV3.Document} spec - The OpenAPI specification document.\n * @returns {boolean} - Returns true if the API is supported, false otherwise.\n * @description The following APIs are supported:\n * 1. only support Get/Post operation without auth property\n * 2. parameter inside query or path only support string, number, boolean and integer\n * 3. parameter inside post body only support string, number, boolean, integer and object\n * 4. request body + required parameters <= 1\n * 5. response body should be “application/json” and not empty, and response code should be 20X\n * 6. only support request body with “application/json” content type\n */\n static isSupportedApi(\n method: string,\n path: string,\n spec: OpenAPIV3.Document,\n allowMissingId: boolean,\n allowAPIKeyAuth: boolean,\n allowMultipleParameters: boolean,\n allowOauth2: boolean,\n isCopilot: boolean\n ): boolean {\n const pathObj = spec.paths[path];\n method = method.toLocaleLowerCase();\n if (pathObj) {\n if (\n (method === ConstantString.PostMethod || method === ConstantString.GetMethod) &&\n pathObj[method]\n ) {\n const securities = pathObj[method]!.security;\n const authArray = Utils.getAuthArray(securities, spec);\n if (!Utils.isSupportedAuth(authArray, allowAPIKeyAuth, allowOauth2)) {\n return false;\n }\n\n const operationObject = pathObj[method] as OpenAPIV3.OperationObject;\n if (!allowMissingId && !operationObject.operationId) {\n return false;\n }\n const paramObject = operationObject.parameters as OpenAPIV3.ParameterObject[];\n\n const requestBody = operationObject.requestBody as OpenAPIV3.RequestBodyObject;\n const requestJsonBody = requestBody?.content[\"application/json\"];\n\n const mediaTypesCount = Object.keys(requestBody?.content || {}).length;\n if (mediaTypesCount > 1) {\n return false;\n }\n\n const responseJson = Utils.getResponseJson(operationObject);\n if (Object.keys(responseJson).length === 0) {\n return false;\n }\n\n let requestBodyParamResult = {\n requiredNum: 0,\n optionalNum: 0,\n isValid: true,\n };\n\n if (requestJsonBody) {\n const requestBodySchema = requestJsonBody.schema as OpenAPIV3.SchemaObject;\n\n if (isCopilot && requestBodySchema.type !== \"object\") {\n return false;\n }\n\n requestBodyParamResult = Utils.checkPostBody(\n requestBodySchema,\n requestBody.required,\n isCopilot\n );\n }\n\n if (!requestBodyParamResult.isValid) {\n return false;\n }\n\n const paramResult = Utils.checkParameters(paramObject, isCopilot);\n\n if (!paramResult.isValid) {\n return false;\n }\n\n // Copilot support arbitrary parameters\n if (isCopilot) {\n return true;\n }\n\n if (requestBodyParamResult.requiredNum + paramResult.requiredNum > 1) {\n if (\n allowMultipleParameters &&\n requestBodyParamResult.requiredNum + paramResult.requiredNum <= 5\n ) {\n return true;\n }\n return false;\n } else if (\n requestBodyParamResult.requiredNum +\n requestBodyParamResult.optionalNum +\n paramResult.requiredNum +\n paramResult.optionalNum ===\n 0\n ) {\n return false;\n } else {\n return true;\n }\n }\n }\n\n return false;\n }\n\n static isSupportedAuth(\n authSchemaArray: AuthSchema[][],\n allowAPIKeyAuth: boolean,\n allowOauth2: boolean\n ): boolean {\n if (authSchemaArray.length === 0) {\n return true;\n }\n\n if (allowAPIKeyAuth || allowOauth2) {\n // Currently we don't support multiple auth in one operation\n if (authSchemaArray.length > 0 && authSchemaArray.every((auths) => auths.length > 1)) {\n return false;\n }\n\n for (const auths of authSchemaArray) {\n if (auths.length === 1) {\n if (!allowOauth2 && allowAPIKeyAuth && Utils.isAPIKeyAuth(auths[0].authSchema)) {\n return true;\n } else if (\n !allowAPIKeyAuth &&\n allowOauth2 &&\n Utils.isBearerTokenAuth(auths[0].authSchema)\n ) {\n return true;\n } else if (\n allowAPIKeyAuth &&\n allowOauth2 &&\n (Utils.isAPIKeyAuth(auths[0].authSchema) ||\n Utils.isBearerTokenAuth(auths[0].authSchema))\n ) {\n return true;\n }\n }\n }\n }\n\n return false;\n }\n\n static isAPIKeyAuth(authSchema: OpenAPIV3.SecuritySchemeObject): boolean {\n return authSchema.type === \"apiKey\";\n }\n\n static isBearerTokenAuth(authSchema: OpenAPIV3.SecuritySchemeObject): boolean {\n return (\n authSchema.type === \"oauth2\" ||\n authSchema.type === \"openIdConnect\" ||\n (authSchema.type === \"http\" && authSchema.scheme === \"bearer\")\n );\n }\n\n static getAuthArray(\n securities: OpenAPIV3.SecurityRequirementObject[] | undefined,\n spec: OpenAPIV3.Document\n ): AuthSchema[][] {\n const result: AuthSchema[][] = [];\n const securitySchemas = spec.components?.securitySchemes;\n if (securities && securitySchemas) {\n for (let i = 0; i < securities.length; i++) {\n const security = securities[i];\n\n const authArray: AuthSchema[] = [];\n for (const name in security) {\n const auth = securitySchemas[name] as OpenAPIV3.SecuritySchemeObject;\n authArray.push({\n authSchema: auth,\n name: name,\n });\n }\n\n if (authArray.length > 0) {\n result.push(authArray);\n }\n }\n }\n\n result.sort((a, b) => a[0].name.localeCompare(b[0].name));\n\n return result;\n }\n\n static updateFirstLetter(str: string): string {\n return str.charAt(0).toUpperCase() + str.slice(1);\n }\n\n static getResponseJson(\n operationObject: OpenAPIV3.OperationObject | undefined\n ): OpenAPIV3.MediaTypeObject {\n let json: OpenAPIV3.MediaTypeObject = {};\n\n for (const code of ConstantString.ResponseCodeFor20X) {\n const responseObject = operationObject?.responses?.[code] as OpenAPIV3.ResponseObject;\n\n const mediaTypesCount = Object.keys(responseObject?.content || {}).length;\n if (mediaTypesCount > 1) {\n return {};\n }\n\n if (responseObject?.content?.[\"application/json\"]) {\n json = responseObject.content[\"application/json\"];\n break;\n }\n }\n\n return json;\n }\n\n static convertPathToCamelCase(path: string): string {\n const pathSegments = path.split(/[./{]/);\n const camelCaseSegments = pathSegments.map((segment) => {\n segment = segment.replace(/}/g, \"\");\n return segment.charAt(0).toUpperCase() + segment.slice(1);\n });\n const camelCasePath = camelCaseSegments.join(\"\");\n return camelCasePath;\n }\n\n static getUrlProtocol(urlString: string): string | undefined {\n try {\n const url = new URL(urlString);\n return url.protocol;\n } catch (err) {\n return undefined;\n }\n }\n\n static resolveServerUrl(url: string): string {\n const placeHolderReg = /\\${{\\s*([a-zA-Z_][a-zA-Z0-9_]*)\\s*}}/g;\n let matches = placeHolderReg.exec(url);\n let newUrl = url;\n while (matches != null) {\n const envVar = matches[1];\n const envVal = process.env[envVar];\n if (!envVal) {\n throw new Error(Utils.format(ConstantString.ResolveServerUrlFailed, envVar));\n } else {\n newUrl = newUrl.replace(matches[0], envVal);\n }\n matches = placeHolderReg.exec(url);\n }\n return newUrl;\n }\n\n static checkServerUrl(servers: OpenAPIV3.ServerObject[]): ErrorResult[] {\n const errors: ErrorResult[] = [];\n\n let serverUrl;\n try {\n serverUrl = Utils.resolveServerUrl(servers[0].url);\n } catch (err) {\n errors.push({\n type: ErrorType.ResolveServerUrlFailed,\n content: (err as Error).message,\n data: servers,\n });\n return errors;\n }\n\n const protocol = Utils.getUrlProtocol(serverUrl);\n if (!protocol) {\n // Relative server url is not supported\n errors.push({\n type: ErrorType.RelativeServerUrlNotSupported,\n content: ConstantString.RelativeServerUrlNotSupported,\n data: servers,\n });\n } else if (protocol !== \"https:\") {\n // Http server url is not supported\n const protocolString = protocol.slice(0, -1);\n errors.push({\n type: ErrorType.UrlProtocolNotSupported,\n content: Utils.format(ConstantString.UrlProtocolNotSupported, protocol.slice(0, -1)),\n data: protocolString,\n });\n }\n\n return errors;\n }\n\n static validateServer(\n spec: OpenAPIV3.Document,\n allowMissingId: boolean,\n allowAPIKeyAuth: boolean,\n allowMultipleParameters: boolean,\n allowOauth2: boolean,\n isCopilot: boolean\n ): ErrorResult[] {\n const errors: ErrorResult[] = [];\n\n let hasTopLevelServers = false;\n let hasPathLevelServers = false;\n let hasOperationLevelServers = false;\n\n if (spec.servers && spec.servers.length >= 1) {\n hasTopLevelServers = true;\n\n // for multiple server, we only use the first url\n const serverErrors = Utils.checkServerUrl(spec.servers);\n errors.push(...serverErrors);\n }\n\n const paths = spec.paths;\n for (const path in paths) {\n const methods = paths[path];\n\n if (methods?.servers && methods.servers.length >= 1) {\n hasPathLevelServers = true;\n const serverErrors = Utils.checkServerUrl(methods.servers);\n errors.push(...serverErrors);\n }\n\n for (const method in methods) {\n const operationObject = (methods as any)[method] as OpenAPIV3.OperationObject;\n if (\n Utils.isSupportedApi(\n method,\n path,\n spec,\n allowMissingId,\n allowAPIKeyAuth,\n allowMultipleParameters,\n allowOauth2,\n isCopilot\n )\n ) {\n if (operationObject?.servers && operationObject.servers.length >= 1) {\n hasOperationLevelServers = true;\n const serverErrors = Utils.checkServerUrl(operationObject.servers);\n errors.push(...serverErrors);\n }\n }\n }\n }\n if (!hasTopLevelServers && !hasPathLevelServers && !hasOperationLevelServers) {\n errors.push({\n type: ErrorType.NoServerInformation,\n content: ConstantString.NoServerInformation,\n });\n }\n return errors;\n }\n\n static isWellKnownName(name: string, wellknownNameList: string[]): boolean {\n for (let i = 0; i < wellknownNameList.length; i++) {\n name = name.replace(/_/g, \"\").replace(/-/g, \"\");\n if (name.toLowerCase().includes(wellknownNameList[i])) {\n return true;\n }\n }\n return false;\n }\n\n static generateParametersFromSchema(\n schema: OpenAPIV3.SchemaObject,\n name: string,\n allowMultipleParameters: boolean,\n isRequired = false\n ): [Parameter[], Parameter[]] {\n const requiredParams: Parameter[] = [];\n const optionalParams: Parameter[] = [];\n\n if (\n schema.type === \"string\" ||\n schema.type === \"integer\" ||\n schema.type === \"boolean\" ||\n schema.type === \"number\"\n ) {\n const parameter = {\n name: name,\n title: Utils.updateFirstLetter(name).slice(0, ConstantString.ParameterTitleMaxLens),\n description: (schema.description ?? \"\").slice(\n 0,\n ConstantString.ParameterDescriptionMaxLens\n ),\n };\n\n if (allowMultipleParameters) {\n Utils.updateParameterWithInputType(schema, parameter);\n }\n\n if (isRequired && schema.default === undefined) {\n requiredParams.push(parameter);\n } else {\n optionalParams.push(parameter);\n }\n } else if (schema.type === \"object\") {\n const { properties } = schema;\n for (const property in properties) {\n let isRequired = false;\n if (schema.required && schema.required?.indexOf(property) >= 0) {\n isRequired = true;\n }\n const [requiredP, optionalP] = Utils.generateParametersFromSchema(\n properties[property] as OpenAPIV3.SchemaObject,\n property,\n allowMultipleParameters,\n isRequired\n );\n\n requiredParams.push(...requiredP);\n optionalParams.push(...optionalP);\n }\n }\n\n return [requiredParams, optionalParams];\n }\n\n static updateParameterWithInputType(schema: OpenAPIV3.SchemaObject, param: Parameter): void {\n if (schema.enum) {\n param.inputType = \"choiceset\";\n param.choices = [];\n for (let i = 0; i < schema.enum.length; i++) {\n param.choices.push({\n title: schema.enum[i],\n value: schema.enum[i],\n });\n }\n } else if (schema.type === \"string\") {\n param.inputType = \"text\";\n } else if (schema.type === \"integer\" || schema.type === \"number\") {\n param.inputType = \"number\";\n } else if (schema.type === \"boolean\") {\n param.inputType = \"toggle\";\n }\n\n if (schema.default) {\n param.value = schema.default;\n }\n }\n\n static parseApiInfo(\n operationItem: OpenAPIV3.OperationObject,\n allowMultipleParameters: boolean\n ): [IMessagingExtensionCommand, WarningResult | undefined] {\n const requiredParams: Parameter[] = [];\n const optionalParams: Parameter[] = [];\n const paramObject = operationItem.parameters as OpenAPIV3.ParameterObject[];\n\n if (paramObject) {\n paramObject.forEach((param: OpenAPIV3.ParameterObject) => {\n const parameter: Parameter = {\n name: param.name,\n title: Utils.updateFirstLetter(param.name).slice(0, ConstantString.ParameterTitleMaxLens),\n description: (param.description ?? \"\").slice(\n 0,\n ConstantString.ParameterDescriptionMaxLens\n ),\n };\n\n const schema = param.schema as OpenAPIV3.SchemaObject;\n if (allowMultipleParameters && schema) {\n Utils.updateParameterWithInputType(schema, parameter);\n }\n\n if (param.in !== \"header\" && param.in !== \"cookie\") {\n if (param.required && schema?.default === undefined) {\n requiredParams.push(parameter);\n } else {\n optionalParams.push(parameter);\n }\n }\n });\n }\n\n if (operationItem.requestBody) {\n const requestBody = operationItem.requestBody as OpenAPIV3.RequestBodyObject;\n const requestJson = requestBody.content[\"application/json\"];\n if (Object.keys(requestJson).length !== 0) {\n const schema = requestJson.schema as OpenAPIV3.SchemaObject;\n const [requiredP, optionalP] = Utils.generateParametersFromSchema(\n schema,\n \"requestBody\",\n allowMultipleParameters,\n requestBody.required\n );\n requiredParams.push(...requiredP);\n optionalParams.push(...optionalP);\n }\n }\n\n const operationId = operationItem.operationId!;\n\n const parameters = [];\n\n if (requiredParams.length !== 0) {\n parameters.push(...requiredParams);\n } else {\n parameters.push(optionalParams[0]);\n }\n\n const command: IMessagingExtensionCommand = {\n context: [\"compose\"],\n type: \"query\",\n title: (operationItem.summary ?? \"\").slice(0, ConstantString.CommandTitleMaxLens),\n id: operationId,\n parameters: parameters,\n description: (operationItem.description ?? \"\").slice(\n 0,\n ConstantString.CommandDescriptionMaxLens\n ),\n };\n let warning: WarningResult | undefined = undefined;\n\n if (requiredParams.length === 0 && optionalParams.length > 1) {\n warning = {\n type: WarningType.OperationOnlyContainsOptionalParam,\n content: Utils.format(ConstantString.OperationOnlyContainsOptionalParam, operationId),\n data: operationId,\n };\n }\n return [command, warning];\n }\n\n static listSupportedAPIs(\n spec: OpenAPIV3.Document,\n allowMissingId: boolean,\n allowAPIKeyAuth: boolean,\n allowMultipleParameters: boolean,\n allowOauth2: boolean,\n isCopilot: boolean\n ): {\n [key: string]: OpenAPIV3.OperationObject;\n } {\n const paths = spec.paths;\n const result: { [key: string]: OpenAPIV3.OperationObject } = {};\n for (const path in paths) {\n const methods = paths[path];\n for (const method in methods) {\n // For developer preview, only support GET operation with only 1 parameter without auth\n if (\n Utils.isSupportedApi(\n method,\n path,\n spec,\n allowMissingId,\n allowAPIKeyAuth,\n allowMultipleParameters,\n allowOauth2,\n isCopilot\n )\n ) {\n const operationObject = (methods as any)[method] as OpenAPIV3.OperationObject;\n result[`${method.toUpperCase()} ${path}`] = operationObject;\n }\n }\n }\n return result;\n }\n\n static validateSpec(\n spec: OpenAPIV3.Document,\n parser: SwaggerParser,\n isSwaggerFile: boolean,\n allowMissingId: boolean,\n allowAPIKeyAuth: boolean,\n allowMultipleParameters: boolean,\n allowOauth2: boolean,\n isCopilot: boolean\n ): ValidateResult {\n const errors: ErrorResult[] = [];\n const warnings: WarningResult[] = [];\n\n if (isSwaggerFile) {\n warnings.push({\n type: WarningType.ConvertSwaggerToOpenAPI,\n content: ConstantString.ConvertSwaggerToOpenAPI,\n });\n }\n\n // Server validation\n const serverErrors = Utils.validateServer(\n spec,\n allowMissingId,\n allowAPIKeyAuth,\n allowMultipleParameters,\n allowOauth2,\n isCopilot\n );\n errors.push(...serverErrors);\n\n // Remote reference not supported\n const refPaths = parser.$refs.paths();\n\n // refPaths [0] is the current spec file path\n if (refPaths.length > 1) {\n errors.push({\n type: ErrorType.RemoteRefNotSupported,\n content: Utils.format(ConstantString.RemoteRefNotSupported, refPaths.join(\", \")),\n data: refPaths,\n });\n }\n\n // No supported API\n const apiMap = Utils.listSupportedAPIs(\n spec,\n allowMissingId,\n allowAPIKeyAuth,\n allowMultipleParameters,\n allowOauth2,\n isCopilot\n );\n if (Object.keys(apiMap).length === 0) {\n errors.push({\n type: ErrorType.NoSupportedApi,\n content: ConstantString.NoSupportedApi,\n });\n }\n\n // OperationId missing\n const apisMissingOperationId: string[] = [];\n for (const key in apiMap) {\n const pathObjectItem = apiMap[key];\n if (!pathObjectItem.operationId) {\n apisMissingOperationId.push(key);\n }\n }\n\n if (apisMissingOperationId.length > 0) {\n warnings.push({\n type: WarningType.OperationIdMissing,\n content: Utils.format(ConstantString.MissingOperationId, apisMissingOperationId.join(\", \")),\n data: apisMissingOperationId,\n });\n }\n\n let status = ValidationStatus.Valid;\n if (warnings.length > 0 && errors.length === 0) {\n status = ValidationStatus.Warning;\n } else if (errors.length > 0) {\n status = ValidationStatus.Error;\n }\n\n return {\n status,\n warnings,\n errors,\n };\n }\n\n static format(str: string, ...args: string[]): string {\n let index = 0;\n return str.replace(/%s/g, () => {\n const arg = args[index++];\n return arg !== undefined ? arg : \"\";\n });\n }\n\n static getSafeRegistrationIdEnvName(authName: string): string {\n if (!authName) {\n return \"\";\n }\n\n let safeRegistrationIdEnvName = authName.toUpperCase().replace(/[^A-Z0-9_]/g, \"_\");\n\n if (!safeRegistrationIdEnvName.match(/^[A-Z]/)) {\n safeRegistrationIdEnvName = \"PREFIX_\" + safeRegistrationIdEnvName;\n }\n\n return safeRegistrationIdEnvName;\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\"use strict\";\n\nimport SwaggerParser from \"@apidevtools/swagger-parser\";\nimport { OpenAPIV3 } from \"openapi-types\";\nimport {\n APIInfo,\n ErrorType,\n GenerateResult,\n ParseOptions,\n ValidateResult,\n ValidationStatus,\n Parameter,\n ListAPIResult,\n} from \"./interfaces\";\nimport { SpecParserError } from \"./specParserError\";\nimport { Utils } from \"./utils\";\nimport { ConstantString } from \"./constants\";\n\n/**\n * A class that parses an OpenAPI specification file and provides methods to validate, list, and generate artifacts.\n */\nexport class SpecParser {\n public readonly pathOrSpec: string | OpenAPIV3.Document;\n public readonly parser: SwaggerParser;\n public readonly options: Required<ParseOptions>;\n\n private apiMap: { [key: string]: OpenAPIV3.PathItemObject } | undefined;\n private spec: OpenAPIV3.Document | undefined;\n private unResolveSpec: OpenAPIV3.Document | undefined;\n private isSwaggerFile: boolean | undefined;\n\n private defaultOptions: ParseOptions = {\n allowMissingId: false,\n allowSwagger: false,\n allowAPIKeyAuth: false,\n allowMultipleParameters: false,\n allowOauth2: false,\n isCopilot: false,\n };\n\n /**\n * Creates a new instance of the SpecParser class.\n * @param pathOrDoc The path to the OpenAPI specification file or the OpenAPI specification object.\n * @param options The options for parsing the OpenAPI specification file.\n */\n constructor(pathOrDoc: string | OpenAPIV3.Document, options?: ParseOptions) {\n this.pathOrSpec = pathOrDoc;\n this.parser = new SwaggerParser();\n this.options = {\n ...this.defaultOptions,\n ...(options ?? {}),\n } as Required<ParseOptions>;\n }\n\n /**\n * Validates the OpenAPI specification file and returns a validation result.\n *\n * @returns A validation result object that contains information about any errors or warnings in the specification file.\n */\n async validate(): Promise<ValidateResult> {\n try {\n try {\n await this.loadSpec();\n await this.parser.validate(this.spec!, {\n validate: {\n schema: false,\n },\n });\n } catch (e) {\n return {\n status: ValidationStatus.Error,\n warnings: [],\n errors: [{ type: ErrorType.SpecNotValid, content: (e as Error).toString() }],\n };\n }\n\n if (!this.options.allowSwagger && this.isSwaggerFile) {\n return {\n status: ValidationStatus.Error,\n warnings: [],\n errors: [\n { type: ErrorType.SwaggerNotSupported, content: ConstantString.SwaggerNotSupported },\n ],\n };\n }\n\n return Utils.validateSpec(\n this.spec!,\n this.parser,\n !!this.isSwaggerFile,\n this.options.allowMissingId,\n this.options.allowAPIKeyAuth,\n this.options.allowMultipleParameters,\n this.options.allowOauth2,\n this.options.isCopilot\n );\n } catch (err) {\n throw new SpecParserError((err as Error).toString(), ErrorType.ValidateFailed);\n }\n }\n\n async listSupportedAPIInfo(): Promise<APIInfo[]> {\n try {\n await this.loadSpec();\n const apiMap = this.getAllSupportedAPIs(this.spec!);\n const apiInfos: APIInfo[] = [];\n for (const key in apiMap) {\n const pathObjectItem = apiMap[key];\n const [method, path] = key.split(\" \");\n const operationId = pathObjectItem.operationId;\n\n // In Browser environment, this api is by default not support api without operationId\n if (!operationId) {\n continue;\n }\n\n const [command, warning] = Utils.parseApiInfo(\n pathObjectItem,\n this.options.allowMultipleParameters\n );\n\n const apiInfo: APIInfo = {\n method: method,\n path: path,\n title: command.title,\n id: operationId,\n parameters: command.parameters! as Parameter[],\n description: command.description!,\n };\n\n if (warning) {\n apiInfo.warning = warning;\n }\n\n apiInfos.push(apiInfo);\n }\n\n return apiInfos;\n } catch (err) {\n throw new SpecParserError((err as Error).toString(), ErrorType.listSupportedAPIInfoFailed);\n }\n }\n\n /**\n * Lists all the OpenAPI operations in the specification file.\n * @returns A string array that represents the HTTP method and path of each operation, such as ['GET /pets/{petId}', 'GET /user/{userId}']\n * according to copilot plugin spec, only list get and post method without auth\n */\n // eslint-disable-next-line @typescript-eslint/require-await\n async list(): Promise<ListAPIResult[]> {\n throw new Error(\"Method not implemented.\");\n }\n\n /**\n * Generate specs according to the filters.\n * @param filter An array of strings that represent the filters to apply when generating the artifacts. If filter is empty, it would process nothing.\n */\n // eslint-disable-next-line @typescript-eslint/require-await\n async getFilteredSpecs(\n filter: string[],\n signal?: AbortSignal\n ): Promise<[OpenAPIV3.Document, OpenAPIV3.Document]> {\n throw new Error(\"Method not implemented.\");\n }\n\n /**\n * Generates and update artifacts from the OpenAPI specification file. Generate Adaptive Cards, update Teams app manifest, and generate a new OpenAPI specification file.\n * @param manifestPath A file path of the Teams app manifest file to update.\n * @param filter An array of strings that represent the filters to apply when generating the artifacts. If filter is empty, it would process nothing.\n * @param outputSpecPath File path of the new OpenAPI specification file to generate. If not specified or empty, no spec file will be generated.\n * @param pluginFilePath File path of the api plugin file to generate.\n */\n // eslint-disable-next-line @typescript-eslint/require-await\n async generateForCopilot(\n manifestPath: string,\n filter: string[],\n outputSpecPath: string,\n pluginFilePath: string,\n signal?: AbortSignal\n ): Promise<GenerateResult> {\n throw new Error(\"Method not implemented.\");\n }\n /**\n * Generates and update artifacts from the OpenAPI specification file. Generate Adaptive Cards, update Teams app manifest, and generate a new OpenAPI specification file.\n * @param manifestPath A file path of the Teams app manifest file to update.\n * @param filter An array of strings that represent the filters to apply when generating the artifacts. If filter is empty, it would process nothing.\n * @param outputSpecPath File path of the new OpenAPI specification file to generate. If not specified or empty, no spec file will be generated.\n * @param adaptiveCardFolder Folder path where the Adaptive Card files will be generated. If not specified or empty, Adaptive Card files will not be generated.\n * @param isMe Boolean that indicates whether the project is an Messaging Extension. For Messaging Extension, composeExtensions will be added in Teams app manifest.\n */\n // eslint-disable-next-line @typescript-eslint/require-await\n async generate(\n manifestPath: string,\n filter: string[],\n outputSpecPath: string,\n adaptiveCardFolder: string,\n signal?: AbortSignal,\n isMe?: boolean\n ): Promise<GenerateResult> {\n throw new Error(\"Method not implemented.\");\n }\n\n private async loadSpec(): Promise<void> {\n if (!this.spec) {\n this.unResolveSpec = (await this.parser.parse(this.pathOrSpec)) as OpenAPIV3.Document;\n if (!this.unResolveSpec.openapi && (this.unResolveSpec as any).swagger === \"2.0\") {\n this.isSwaggerFile = true;\n }\n\n const clonedUnResolveSpec = JSON.parse(JSON.stringify(this.unResolveSpec));\n this.spec = (await this.parser.dereference(clonedUnResolveSpec)) as OpenAPIV3.Document;\n }\n }\n\n private getAllSupportedAPIs(spec: OpenAPIV3.Document): {\n [key: string]: OpenAPIV3.OperationObject;\n } {\n if (this.apiMap !== undefined) {\n return this.apiMap;\n }\n const result = Utils.listSupportedAPIs(\n spec,\n this.options.allowMissingId,\n this.options.allowAPIKeyAuth,\n this.options.allowMultipleParameters,\n this.options.allowOauth2,\n this.options.isCopilot\n );\n this.apiMap = result;\n return result;\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\"use strict\";\n\nimport { OpenAPIV3 } from \"openapi-types\";\nimport { Utils } from \"./utils\";\nimport {\n AdaptiveCard,\n ArrayElement,\n ErrorType,\n ImageElement,\n TextBlockElement,\n} from \"./interfaces\";\nimport { ConstantString } from \"./constants\";\nimport { SpecParserError } from \"./specParserError\";\n\nexport class AdaptiveCardGenerator {\n static generateAdaptiveCard(operationItem: OpenAPIV3.OperationObject): [AdaptiveCard, string] {\n try {\n const json = Utils.getResponseJson(operationItem);\n\n let cardBody: Array<TextBlockElement | ImageElement | ArrayElement> = [];\n\n let schema = json.schema as OpenAPIV3.SchemaObject;\n let jsonPath = \"$\";\n if (schema && Object.keys(schema).length > 0) {\n jsonPath = AdaptiveCardGenerator.getResponseJsonPathFromSchema(schema);\n if (jsonPath !== \"$\") {\n schema = schema.properties![jsonPath] as OpenAPIV3.SchemaObject;\n }\n\n cardBody = AdaptiveCardGenerator.generateCardFromResponse(schema, \"\");\n }\n\n // if no schema, try to use example value\n if (cardBody.length === 0 && (json.examples || json.example)) {\n cardBody = [\n {\n type: ConstantString.TextBlockType,\n text: \"${jsonStringify($root)}\",\n wrap: true,\n },\n ];\n }\n\n // if no example value, use default success response\n if (cardBody.length === 0) {\n cardBody = [\n {\n type: ConstantString.TextBlockType,\n text: \"success\",\n wrap: true,\n },\n ];\n }\n\n const fullCard: AdaptiveCard = {\n type: ConstantString.AdaptiveCardType,\n $schema: ConstantString.AdaptiveCardSchema,\n version: ConstantString.AdaptiveCardVersion,\n body: cardBody,\n };\n\n return [fullCard, jsonPath];\n } catch (err) {\n throw new SpecParserError((err as Error).toString(), ErrorType.GenerateAdaptiveCardFailed);\n }\n }\n\n static generateCardFromResponse(\n schema: OpenAPIV3.SchemaObject,\n name: string,\n parentArrayName = \"\"\n ): Array<TextBlockElement | ImageElement | ArrayElement> {\n if (schema.type === \"array\") {\n // schema.items can be arbitrary object: schema { type: array, items: {} }\n if (Object.keys(schema.items).length === 0) {\n return [\n {\n type: ConstantString.TextBlockType,\n text: name ? `${name}: \\${jsonStringify(${name})}` : \"result: ${jsonStringify($root)}\",\n wrap: true,\n },\n ];\n }\n\n const obj = AdaptiveCardGenerator.generateCardFromResponse(\n schema.items as OpenAPIV3.SchemaObject,\n \"\",\n name\n );\n const template = {\n type: ConstantString.ContainerType,\n $data: name ? `\\${${name}}` : \"${$root}\",\n items: Array<TextBlockElement | ImageElement | ArrayElement>(),\n };\n\n template.items.push(...obj);\n return [template];\n }\n // some schema may not contain type but contain properties\n if (schema.type === \"object\" || (!schema.type && schema.properties)) {\n const { properties } = schema;\n const result: Array<TextBlockElement | ImageElement | ArrayElement> = [];\n for (const property in properties) {\n const obj = AdaptiveCardGenerator.generateCardFromResponse(\n properties[property] as OpenAPIV3.SchemaObject,\n name ? `${name}.${property}` : property,\n parentArrayName\n );\n result.push(...obj);\n }\n\n if (schema.additionalProperties) {\n // TODO: better ways to handler warnings.\n console.warn(ConstantString.AdditionalPropertiesNotSupported);\n }\n\n return result;\n }\n if (\n schema.type === \"string\" ||\n schema.type === \"integer\" ||\n schema.type === \"boolean\" ||\n schema.type === \"number\"\n ) {\n if (!AdaptiveCardGenerator.isImageUrlProperty(schema, name, parentArrayName)) {\n // string in root: \"ddd\"\n let text = \"result: ${$root}\";\n if (name) {\n // object { id: \"1\" }\n text = `${name}: \\${if(${name}, ${name}, 'N/A')}`;\n if (parentArrayName) {\n // object types inside array: { tags: [\"id\": 1, \"name\": \"name\"] }\n text = `${parentArrayName}.${text}`;\n }\n } else if (parentArrayName) {\n // string array: photoUrls: [\"1\", \"2\"]\n text = `${parentArrayName}: ` + \"${$data}\";\n }\n\n return [\n {\n type: ConstantString.TextBlockType,\n text,\n wrap: true,\n },\n ];\n } else {\n if (name) {\n return [\n {\n type: \"Image\",\n url: `\\${${name}}`,\n $when: `\\${${name} != null}`,\n },\n ];\n } else {\n return [\n {\n type: \"Image\",\n url: \"${$data}\",\n $when: \"${$data != null}\",\n },\n ];\n }\n }\n }\n\n if (schema.oneOf || schema.anyOf || schema.not || schema.allOf) {\n throw new Error(Utils.format(ConstantString.SchemaNotSupported, JSON.stringify(schema)));\n }\n\n throw new Error(Utils.format(ConstantString.UnknownSchema, JSON.stringify(schema)));\n }\n\n // Find the first array property in the response schema object with the well-known name\n static getResponseJsonPathFromSchema(schema: OpenAPIV3.SchemaObject): string {\n if (schema.type === \"object\" || (!schema.type && schema.properties)) {\n const { properties } = schema;\n for (const property in properties) {\n const schema = properties[property] as OpenAPIV3.SchemaObject;\n if (\n schema.type === \"array\" &&\n Utils.isWellKnownName(property, ConstantString.WellknownResultNames)\n ) {\n return property;\n }\n }\n }\n\n return \"$\";\n }\n\n static isImageUrlProperty(\n schema: OpenAPIV3.NonArraySchemaObject,\n name: string,\n parentArrayName: string\n ): boolean {\n const propertyName = name ? name : parentArrayName;\n return (\n !!propertyName &&\n schema.type === \"string\" &&\n Utils.isWellKnownName(propertyName, ConstantString.WellknownImageName) &&\n (propertyName.toLocaleLowerCase().indexOf(\"url\") >= 0 || schema.format === \"uri\")\n );\n }\n}\n"],"names":[],"mappings":";;AAAA;AAuEA;;;IAGY;AAAZ,WAAY,SAAS;IACnB,4CAA+B,CAAA;IAC/B,+DAAkD,CAAA;IAClD,0DAA6C,CAAA;IAC7C,mEAAsD,CAAA;IACtD,gFAAmE,CAAA;IACnE,gDAAmC,CAAA;IACnC,+DAAkD,CAAA;IAClD,iEAAoD,CAAA;IACpD,0DAA6C,CAAA;IAC7C,0EAA6D,CAAA;IAE7D,uCAA0B,CAAA;IAC1B,0EAA6D,CAAA;IAC7D,oDAAuC,CAAA;IACvC,4DAA+C,CAAA;IAC/C,yEAA4D,CAAA;IAC5D,+CAAkC,CAAA;IAClC,+CAAkC,CAAA;IAClC,8CAAiC,CAAA;IAEjC,oCAAuB,CAAA;IACvB,gCAAmB,CAAA;AACrB,CAAC,EAvBW,SAAS,KAAT,SAAS,QAuBpB;AAED;;;IAGY;AAAZ,WAAY,WAAW;IACrB,yDAA0C,CAAA;IAC1C,0DAA2C,CAAA;IAC3C,4FAA6E,CAAA;IAC7E,qEAAsD,CAAA;IACtD,kCAAmB,CAAA;AACrB,CAAC,EANW,WAAW,KAAX,WAAW,QAMtB;AAED;;;IAGY;AAAZ,WAAY,gBAAgB;IAC1B,yDAAK,CAAA;IACL,6DAAO,CAAA;IACP,yDAAK,CAAA;AACP,CAAC,EAJW,gBAAgB,KAAhB,gBAAgB;;ACjH5B;MAMa,eAAgB,SAAQ,KAAK;IAGxC,YAAY,OAAe,EAAE,SAAoB;QAC/C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,SAAS,GAAG,SAAS,CAA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