@microsoft/m365-spec-parser 0.2.2-rc-hotfix.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm2017.js +1 -1
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm2017.mjs +26 -11
- package/dist/index.esm2017.mjs.map +1 -1
- package/dist/index.esm5.js +1 -1
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +26 -11
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/src/constants.d.ts +1 -1
- package/package.json +3 -3
package/dist/index.esm2017.js
CHANGED
|
@@ -183,7 +183,7 @@ ConstantString.ParameterTitleMaxLens = 32;
|
|
|
183
183
|
ConstantString.SMERequiredParamsMaxNum = 5;
|
|
184
184
|
ConstantString.FunctionDescriptionMaxLens = 100;
|
|
185
185
|
ConstantString.DefaultPluginId = "plugin_1";
|
|
186
|
-
ConstantString.PluginManifestSchema = "https://
|
|
186
|
+
ConstantString.PluginManifestSchema = "https://developer.microsoft.com/json-schemas/copilot/plugin/v2.1/schema.json";
|
|
187
187
|
|
|
188
188
|
// Copyright (c) Microsoft Corporation.
|
|
189
189
|
class Utils {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm2017.js","sources":["../src/interfaces.ts","../src/specParserError.ts","../src/constants.ts","../src/utils.ts","../src/validators/validator.ts","../src/validators/copilotValidator.ts","../src/validators/smeValidator.ts","../src/validators/teamsAIValidator.ts","../src/validators/validatorFactory.ts","../src/specParser.browser.ts","../src/adaptiveCardGenerator.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\"use strict\";\n\nimport { IParameter } from \"@microsoft/teams-manifest\";\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 specHash?: string;\n}\n\nexport interface SpecValidationResult {\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 AddedAPINotInOriginalSpec = \"added-api-not-in-original-spec\",\n ResolveServerUrlFailed = \"resolve-server-url-failed\",\n SwaggerNotSupported = \"swagger-not-supported\",\n MultipleAuthNotSupported = \"multiple-auth-not-supported\",\n SpecVersionNotSupported = \"spec-version-not-supported\",\n CircularReferenceNotSupported = \"circular-reference-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 AuthTypeIsNotSupported = \"auth-type-is-not-supported\",\n MissingOperationId = \"missing-operation-id\",\n PostBodyContainMultipleMediaTypes = \"post-body-contain-multiple-media-types\",\n ResponseContainMultipleMediaTypes = \"response-contain-multiple-media-types\",\n ResponseJsonIsEmpty = \"response-json-is-empty\",\n PostBodySchemaIsNotJson = \"post-body-schema-is-not-json\",\n PostBodyContainsRequiredUnsupportedSchema = \"post-body-contains-required-unsupported-schema\",\n ParamsContainRequiredUnsupportedSchema = \"params-contain-required-unsupported-schema\",\n ParamsContainsNestedObject = \"params-contains-nested-object\",\n RequestBodyContainsNestedObject = \"request-body-contains-nested-object\",\n ExceededRequiredParamsLimit = \"exceeded-required-params-limit\",\n NoParameter = \"no-parameter\",\n NoAPIInfo = \"no-api-info\",\n MethodNotAllowed = \"method-not-allowed\",\n UrlPathNotExist = \"url-path-not-exist\",\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 FuncDescriptionTooLong = \"function-description-too-long\",\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 type AdaptiveCardBody = Array<TextBlockElement | ImageElement | ArrayElement>;\n\nexport interface ArrayElement {\n type: string;\n $data: string;\n items: AdaptiveCardBody;\n}\n\nexport interface AdaptiveCard {\n type: string;\n $schema: string;\n version: string;\n body: AdaptiveCardBody;\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 CheckParamResult {\n requiredNum: number;\n optionalNum: number;\n isValid: boolean;\n reason: ErrorType[];\n}\n\nexport interface ParseOptions {\n /**\n * If true, the parser will not throw an error if an ID is missing the spec file.\n */\n allowMissingId?: boolean;\n\n /**\n * If true, the parser will allow parsing of Swagger specifications.\n */\n allowSwagger?: boolean;\n\n /**\n * If true, the parser will allow API Key authentication in the spec file.\n */\n allowAPIKeyAuth?: boolean;\n\n /**\n * If true, the parser will allow Bearer Token authentication in the spec file.\n */\n allowBearerTokenAuth?: boolean;\n\n /**\n * If true, the parser will allow multiple parameters in the spec file. Teams AI project would ignore this parameters and always true\n */\n allowMultipleParameters?: boolean;\n\n /**\n * If true, the parser will allow OAuth2 authentication in the spec file. Currently only support OAuth2 with auth code flow.\n */\n allowOauth2?: boolean;\n\n /**\n * An array of HTTP methods that the parser will allow in the spec file.\n */\n allowMethods?: string[];\n\n /**\n * If true, the parser will allow conversation starters in plugin file. Only take effect in Copilot project\n */\n allowConversationStarters?: boolean;\n\n /**\n * If true, the parser will allow response semantics in plugin file. Only take effect in Copilot project\n */\n allowResponseSemantics?: boolean;\n\n /**\n * If true, the paser will allow confirmation in plugin file. Only take effect in Copilot project\n */\n allowConfirmation?: boolean;\n\n /**\n * The type of project that the parser is being used for.\n * Project can be SME/Copilot/TeamsAi\n */\n projectType?: ProjectType;\n\n /**\n * If true, we will generate files of plugin for GPT (Declarative Extensions in a Copilot Extension). Otherwise, we will generate files of plugin for Copilot.\n */\n isGptPlugin?: boolean;\n}\n\nexport enum ProjectType {\n Copilot,\n SME,\n TeamsAi,\n}\n\nexport interface APIInfo {\n method: string;\n path: string;\n title: string;\n id: string;\n parameters: IParameter[];\n description: string;\n warning?: WarningResult;\n}\n\nexport interface ListAPIInfo {\n api: string;\n server: string;\n operationId: string;\n isValid: boolean;\n reason: ErrorType[];\n auth?: AuthInfo;\n}\n\nexport interface APIMap {\n [key: string]: {\n operation: OpenAPIV3.OperationObject;\n isValid: boolean;\n reason: ErrorType[];\n };\n}\n\nexport interface APIValidationResult {\n isValid: boolean;\n reason: ErrorType[];\n}\n\nexport interface ListAPIResult {\n allAPICount: number;\n validAPICount: number;\n APIs: ListAPIInfo[];\n}\n\nexport type AuthType = OpenAPIV3.SecuritySchemeObject | { type: \"multipleAuth\" };\n\nexport interface AuthInfo {\n authScheme: AuthType;\n name: string;\n}\n\nexport interface InvalidAPIInfo {\n api: string;\n reason: ErrorType[];\n}\n\nexport interface InferredProperties {\n title?: string;\n subtitle?: string;\n imageUrl?: string;\n}\n\nexport interface ExistingPluginManifestInfo {\n manifestPath: string;\n specPath: 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 =\n \"'oneOf', 'allOf', '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 SpecVersionNotSupported =\n \"Unsupported OpenAPI version %s. Please use version 3.0.x.\";\n\n static readonly MultipleAuthNotSupported =\n \"Multiple authentication methods are unsupported. Ensure all selected APIs use identical authentication.\";\n\n static readonly UnsupportedSchema = \"Unsupported schema in %s %s: %s\";\n static readonly FuncDescriptionTooLong =\n \"The description of the function '%s' is too long. The current length is %s characters, while the maximum allowed length is %s characters.\";\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 ImageType = \"Image\";\n static readonly ContainerType = \"Container\";\n static readonly RegistrationIdPostfix: { [key: string]: string } = {\n apiKey: \"REGISTRATION_ID\",\n oauth2: \"CONFIGURATION_ID\",\n http: \"REGISTRATION_ID\",\n openIdConnect: \"REGISTRATION_ID\",\n };\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 ConversationStarterMaxLens = 50;\n static readonly CommandTitleMaxLens = 32;\n static readonly ParameterTitleMaxLens = 32;\n static readonly SMERequiredParamsMaxNum = 5;\n static readonly FunctionDescriptionMaxLens = 100;\n static readonly DefaultPluginId = \"plugin_1\";\n static readonly PluginManifestSchema =\n \"https://aka.ms/json-schemas/copilot/plugin/v2.1/schema.json\";\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\"use strict\";\n\nimport { OpenAPIV3 } from \"openapi-types\";\nimport { ConstantString } from \"./constants\";\nimport {\n AdaptiveCardBody,\n ArrayElement,\n AuthInfo,\n AuthType,\n ErrorResult,\n ErrorType,\n ParseOptions,\n} from \"./interfaces\";\nimport { IMessagingExtensionCommand, IParameter } from \"@microsoft/teams-manifest\";\nimport { SpecParserError } from \"./specParserError\";\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 containMultipleMediaTypes(\n bodyObject: OpenAPIV3.RequestBodyObject | OpenAPIV3.ResponseObject\n ): boolean {\n return Object.keys(bodyObject?.content || {}).length > 1;\n }\n\n static isBearerTokenAuth(authScheme: AuthType): boolean {\n return authScheme.type === \"http\" && authScheme.scheme === \"bearer\";\n }\n\n static isAPIKeyAuth(authScheme: AuthType): boolean {\n return authScheme.type === \"apiKey\";\n }\n\n static isOAuthWithAuthCodeFlow(authScheme: AuthType): boolean {\n return !!(\n authScheme.type === \"oauth2\" &&\n authScheme.flows &&\n authScheme.flows.authorizationCode\n );\n }\n\n static getAuthArray(\n securities: OpenAPIV3.SecurityRequirementObject[] | undefined,\n spec: OpenAPIV3.Document\n ): AuthInfo[][] {\n const result: AuthInfo[][] = [];\n const securitySchemas = spec.components?.securitySchemes;\n const securitiesArr = securities ?? spec.security;\n if (securitiesArr && securitySchemas) {\n for (let i = 0; i < securitiesArr.length; i++) {\n const security = securitiesArr[i];\n\n const authArray: AuthInfo[] = [];\n for (const name in security) {\n const auth = securitySchemas[name] as OpenAPIV3.SecuritySchemeObject;\n authArray.push({\n authScheme: 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 getAuthInfo(spec: OpenAPIV3.Document): AuthInfo | undefined {\n let authInfo: AuthInfo | undefined = undefined;\n\n for (const url in spec.paths) {\n for (const method in spec.paths[url]) {\n const operation = (spec.paths[url] as any)[method] as OpenAPIV3.OperationObject;\n\n const authArray = Utils.getAuthArray(operation.security, spec);\n\n if (authArray && authArray.length > 0) {\n const currentAuth = authArray[0][0];\n if (!authInfo) {\n authInfo = authArray[0][0];\n } else if (authInfo.name !== currentAuth.name) {\n throw new SpecParserError(\n ConstantString.MultipleAuthNotSupported,\n ErrorType.MultipleAuthNotSupported\n );\n }\n }\n }\n }\n\n return authInfo;\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 allowMultipleMediaType = false\n ): {\n json: OpenAPIV3.MediaTypeObject;\n multipleMediaType: boolean;\n } {\n let json: OpenAPIV3.MediaTypeObject = {};\n let multipleMediaType = false;\n\n for (const code of ConstantString.ResponseCodeFor20X) {\n const responseObject = operationObject?.responses?.[code] as OpenAPIV3.ResponseObject;\n\n if (responseObject?.content) {\n for (const contentType of Object.keys(responseObject.content)) {\n // json media type can also be \"application/json; charset=utf-8\"\n if (contentType.indexOf(\"application/json\") >= 0) {\n multipleMediaType = false;\n json = responseObject.content[contentType];\n if (Utils.containMultipleMediaTypes(responseObject)) {\n multipleMediaType = true;\n if (!allowMultipleMediaType) {\n json = {};\n }\n } else {\n return { json, multipleMediaType };\n }\n }\n }\n }\n }\n\n return { json, multipleMediaType };\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 resolveEnv(str: string): string {\n const placeHolderReg = /\\${{\\s*([a-zA-Z_][a-zA-Z0-9_]*)\\s*}}/g;\n let matches = placeHolderReg.exec(str);\n let newStr = str;\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 newStr = newStr.replace(matches[0], envVal);\n }\n matches = placeHolderReg.exec(str);\n }\n return newStr;\n }\n\n static checkServerUrl(servers: OpenAPIV3.ServerObject[]): ErrorResult[] {\n const errors: ErrorResult[] = [];\n\n let serverUrl;\n try {\n serverUrl = Utils.resolveEnv(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(spec: OpenAPIV3.Document, options: ParseOptions): 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\n errors.push(...serverErrors);\n }\n\n for (const method in methods) {\n const operationObject = (methods as any)[method] as OpenAPIV3.OperationObject;\n if (options.allowMethods?.includes(method) && operationObject) {\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\n if (!hasTopLevelServers && !hasPathLevelServers && !hasOperationLevelServers) {\n errors.push({\n type: ErrorType.NoServerInformation,\n content: ConstantString.NoServerInformation,\n });\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 ): [IParameter[], IParameter[]] {\n const requiredParams: IParameter[] = [];\n const optionalParams: IParameter[] = [];\n\n if (\n schema.type === \"string\" ||\n schema.type === \"integer\" ||\n schema.type === \"boolean\" ||\n schema.type === \"number\"\n ) {\n const parameter: IParameter = {\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 parameter.isRequired = true;\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: IParameter): 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 options: ParseOptions\n ): IMessagingExtensionCommand {\n const requiredParams: IParameter[] = [];\n const optionalParams: IParameter[] = [];\n const paramObject = operationItem.parameters as OpenAPIV3.ParameterObject[];\n\n if (paramObject) {\n paramObject.forEach((param: OpenAPIV3.ParameterObject) => {\n const parameter: IParameter = {\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 (options.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 parameter.isRequired = true;\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 !!options.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 = [...requiredParams, ...optionalParams];\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 return command;\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 static getServerObject(\n spec: OpenAPIV3.Document,\n method: string,\n path: string\n ): OpenAPIV3.ServerObject | undefined {\n const pathObj = spec.paths[path] as any;\n\n const operationObject = pathObj[method] as OpenAPIV3.OperationObject;\n\n const rootServer = spec.servers && spec.servers[0];\n const methodServer = spec.paths[path]!.servers && spec.paths[path]!.servers![0];\n const operationServer = operationObject.servers && operationObject.servers[0];\n\n const serverUrl = operationServer || methodServer || rootServer;\n\n return serverUrl;\n }\n\n static limitACBodyProperties(body: AdaptiveCardBody, maxCount: number): AdaptiveCardBody {\n const result: AdaptiveCardBody = [];\n let currentCount = 0;\n\n for (const element of body) {\n if (element.type === ConstantString.ContainerType) {\n const items = this.limitACBodyProperties(\n (element as ArrayElement).items,\n maxCount - currentCount\n );\n\n result.push({\n type: ConstantString.ContainerType,\n $data: (element as ArrayElement).$data,\n items: items,\n });\n\n currentCount += items.length;\n } else {\n result.push(element);\n currentCount++;\n }\n\n if (currentCount >= maxCount) {\n break;\n }\n }\n\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 {\n ParseOptions,\n APIValidationResult,\n ErrorType,\n CheckParamResult,\n ProjectType,\n APIMap,\n SpecValidationResult,\n WarningType,\n InvalidAPIInfo,\n} from \"../interfaces\";\nimport { Utils } from \"../utils\";\nimport { ConstantString } from \"../constants\";\n\nexport abstract class Validator {\n projectType!: ProjectType;\n spec!: OpenAPIV3.Document;\n options!: ParseOptions;\n\n private apiMap: APIMap | undefined;\n private hasCircularReference = false;\n\n abstract validateAPI(method: string, path: string): APIValidationResult;\n abstract validateSpec(): SpecValidationResult;\n\n protected checkCircularReference(): void {\n try {\n JSON.stringify(this.spec);\n } catch (e) {\n if ((e as Error).message.includes(\"Converting circular structure to JSON\")) {\n this.hasCircularReference = true;\n }\n }\n }\n\n listAPIs(): APIMap {\n if (this.apiMap) {\n return this.apiMap;\n }\n\n const paths = this.spec.paths;\n const result: APIMap = {};\n for (const path in paths) {\n const methods = paths[path];\n for (const method in methods) {\n const operationObject = (methods as any)[method] as OpenAPIV3.OperationObject;\n if (this.options.allowMethods?.includes(method) && operationObject) {\n const validateResult = this.validateAPI(method, path);\n result[`${method.toUpperCase()} ${path}`] = {\n operation: operationObject,\n isValid: validateResult.isValid,\n reason: validateResult.reason,\n };\n }\n }\n }\n\n this.apiMap = result;\n return result;\n }\n\n protected validateSpecVersion(): SpecValidationResult {\n const result: SpecValidationResult = { errors: [], warnings: [] };\n\n if (this.spec.openapi >= \"3.1.0\") {\n result.errors.push({\n type: ErrorType.SpecVersionNotSupported,\n content: Utils.format(ConstantString.SpecVersionNotSupported, this.spec.openapi),\n data: this.spec.openapi,\n });\n }\n\n return result;\n }\n\n protected validateSpecServer(): SpecValidationResult {\n const result: SpecValidationResult = { errors: [], warnings: [] };\n const serverErrors = Utils.validateServer(this.spec, this.options);\n result.errors.push(...serverErrors);\n return result;\n }\n\n protected validateSpecNoSupportAPI(): SpecValidationResult {\n const result: SpecValidationResult = { errors: [], warnings: [] };\n\n const apiMap = this.listAPIs();\n\n const validAPIs = Object.entries(apiMap).filter(([, value]) => value.isValid);\n if (validAPIs.length === 0) {\n const data = [];\n for (const key in apiMap) {\n const { reason } = apiMap[key];\n const apiInvalidReason: InvalidAPIInfo = { api: key, reason: reason };\n data.push(apiInvalidReason);\n }\n\n result.errors.push({\n type: ErrorType.NoSupportedApi,\n content: ConstantString.NoSupportedApi,\n data,\n });\n }\n\n return result;\n }\n\n protected validateSpecOperationId(): SpecValidationResult {\n const result: SpecValidationResult = { errors: [], warnings: [] };\n const apiMap = this.listAPIs();\n\n // OperationId missing\n const apisMissingOperationId: string[] = [];\n for (const key in apiMap) {\n const { operation } = apiMap[key];\n if (!operation.operationId) {\n apisMissingOperationId.push(key);\n }\n }\n\n if (apisMissingOperationId.length > 0) {\n result.warnings.push({\n type: WarningType.OperationIdMissing,\n content: Utils.format(ConstantString.MissingOperationId, apisMissingOperationId.join(\", \")),\n data: apisMissingOperationId,\n });\n }\n\n return result;\n }\n\n protected validateMethodAndPath(method: string, path: string): APIValidationResult {\n const result: APIValidationResult = { isValid: true, reason: [] };\n\n if (this.options.allowMethods && !this.options.allowMethods.includes(method)) {\n result.isValid = false;\n result.reason.push(ErrorType.MethodNotAllowed);\n return result;\n }\n\n const pathObj = this.spec.paths[path] as any;\n\n if (!pathObj || !pathObj[method]) {\n result.isValid = false;\n result.reason.push(ErrorType.UrlPathNotExist);\n return result;\n }\n\n return result;\n }\n\n protected validateCircularReference(method: string, path: string): APIValidationResult {\n const result: APIValidationResult = { isValid: true, reason: [] };\n if (this.hasCircularReference) {\n const operationObject = (this.spec.paths[path] as any)[method] as OpenAPIV3.OperationObject;\n try {\n JSON.stringify(operationObject);\n } catch (e) {\n if ((e as Error).message.includes(\"Converting circular structure to JSON\")) {\n result.isValid = false;\n result.reason.push(ErrorType.CircularReferenceNotSupported);\n }\n }\n }\n\n return result;\n }\n\n protected validateResponse(method: string, path: string): APIValidationResult {\n const result: APIValidationResult = { isValid: true, reason: [] };\n\n const operationObject = (this.spec.paths[path] as any)[method] as OpenAPIV3.OperationObject;\n\n const { json, multipleMediaType } = Utils.getResponseJson(operationObject);\n\n if (this.options.projectType === ProjectType.SME) {\n // only support response body only contains “application/json” content type\n if (multipleMediaType) {\n result.reason.push(ErrorType.ResponseContainMultipleMediaTypes);\n } else if (Object.keys(json).length === 0) {\n // response body should not be empty\n result.reason.push(ErrorType.ResponseJsonIsEmpty);\n }\n }\n\n return result;\n }\n\n protected validateServer(method: string, path: string): APIValidationResult {\n const result: APIValidationResult = { isValid: true, reason: [] };\n const serverObj = Utils.getServerObject(this.spec, method, path);\n if (!serverObj) {\n // should contain server URL\n result.reason.push(ErrorType.NoServerInformation);\n } else {\n // server url should be absolute url with https protocol\n const serverValidateResult = Utils.checkServerUrl([serverObj]);\n result.reason.push(...serverValidateResult.map((item) => item.type));\n }\n\n return result;\n }\n\n protected validateAuth(method: string, path: string): APIValidationResult {\n const pathObj = this.spec.paths[path] as any;\n const operationObject = pathObj[method] as OpenAPIV3.OperationObject;\n\n const securities = operationObject.security;\n const authSchemeArray = Utils.getAuthArray(securities, this.spec);\n\n if (authSchemeArray.length === 0) {\n return { isValid: true, reason: [] };\n }\n\n if (\n this.options.allowAPIKeyAuth ||\n this.options.allowOauth2 ||\n this.options.allowBearerTokenAuth\n ) {\n // Currently we don't support multiple auth in one operation\n if (authSchemeArray.length > 0 && authSchemeArray.every((auths) => auths.length > 1)) {\n return {\n isValid: false,\n reason: [ErrorType.MultipleAuthNotSupported],\n };\n }\n\n for (const auths of authSchemeArray) {\n if (auths.length === 1) {\n if (\n (this.options.allowAPIKeyAuth && Utils.isAPIKeyAuth(auths[0].authScheme)) ||\n (this.options.allowOauth2 && Utils.isOAuthWithAuthCodeFlow(auths[0].authScheme)) ||\n (this.options.allowBearerTokenAuth && Utils.isBearerTokenAuth(auths[0].authScheme))\n ) {\n return { isValid: true, reason: [] };\n }\n }\n }\n }\n\n return { isValid: false, reason: [ErrorType.AuthTypeIsNotSupported] };\n }\n\n protected checkPostBodySchema(\n schema: OpenAPIV3.SchemaObject,\n isRequired = false\n ): CheckParamResult {\n const paramResult: CheckParamResult = {\n requiredNum: 0,\n optionalNum: 0,\n isValid: true,\n reason: [],\n };\n\n if (Object.keys(schema).length === 0) {\n return paramResult;\n }\n\n const isRequiredWithoutDefault = isRequired && schema.default === undefined;\n const isCopilot = this.projectType === ProjectType.Copilot;\n\n if (isCopilot && this.hasNestedObjectInSchema(schema)) {\n paramResult.isValid = false;\n paramResult.reason = [ErrorType.RequestBodyContainsNestedObject];\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 = this.checkPostBodySchema(\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 paramResult.reason.push(...result.reason);\n }\n } else {\n if (isRequiredWithoutDefault && !isCopilot) {\n paramResult.isValid = false;\n paramResult.reason.push(ErrorType.PostBodyContainsRequiredUnsupportedSchema);\n }\n }\n return paramResult;\n }\n\n protected checkParamSchema(paramObject: OpenAPIV3.ParameterObject[]): CheckParamResult {\n const paramResult: CheckParamResult = {\n requiredNum: 0,\n optionalNum: 0,\n isValid: true,\n reason: [],\n };\n\n if (!paramObject) {\n return paramResult;\n }\n\n const isCopilot = this.projectType === ProjectType.Copilot;\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 paramResult.reason.push(ErrorType.ParamsContainsNestedObject);\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 paramResult.reason.push(ErrorType.ParamsContainRequiredUnsupportedSchema);\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 paramResult.reason.push(ErrorType.ParamsContainRequiredUnsupportedSchema);\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 private 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","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\"use strict\";\n\nimport { OpenAPIV3 } from \"openapi-types\";\nimport {\n ParseOptions,\n APIValidationResult,\n ErrorType,\n ProjectType,\n SpecValidationResult,\n} from \"../interfaces\";\nimport { Validator } from \"./validator\";\n\nexport class CopilotValidator extends Validator {\n constructor(spec: OpenAPIV3.Document, options: ParseOptions) {\n super();\n this.projectType = ProjectType.Copilot;\n this.options = options;\n this.spec = spec;\n this.checkCircularReference();\n }\n\n validateSpec(): SpecValidationResult {\n const result: SpecValidationResult = { errors: [], warnings: [] };\n\n // validate spec version\n let validationResult = this.validateSpecVersion();\n result.errors.push(...validationResult.errors);\n\n // validate spec server\n validationResult = this.validateSpecServer();\n result.errors.push(...validationResult.errors);\n\n // validate no supported API\n validationResult = this.validateSpecNoSupportAPI();\n result.errors.push(...validationResult.errors);\n\n // validate operationId missing\n validationResult = this.validateSpecOperationId();\n result.warnings.push(...validationResult.warnings);\n\n return result;\n }\n\n validateAPI(method: string, path: string): APIValidationResult {\n const result: APIValidationResult = { isValid: true, reason: [] };\n method = method.toLocaleLowerCase();\n\n // validate method and path\n const methodAndPathResult = this.validateMethodAndPath(method, path);\n if (!methodAndPathResult.isValid) {\n return methodAndPathResult;\n }\n\n const circularReferenceResult = this.validateCircularReference(method, path);\n if (!circularReferenceResult.isValid) {\n return circularReferenceResult;\n }\n\n const operationObject = (this.spec.paths[path] as any)[method] as OpenAPIV3.OperationObject;\n\n // validate auth\n const authCheckResult = this.validateAuth(method, path);\n result.reason.push(...authCheckResult.reason);\n\n // validate operationId\n if (!this.options.allowMissingId && !operationObject.operationId) {\n result.reason.push(ErrorType.MissingOperationId);\n }\n\n // validate server\n const validateServerResult = this.validateServer(method, path);\n result.reason.push(...validateServerResult.reason);\n\n // validate response\n const validateResponseResult = this.validateResponse(method, path);\n result.reason.push(...validateResponseResult.reason);\n\n // validate requestBody\n const requestBody = operationObject.requestBody as OpenAPIV3.RequestBodyObject;\n const requestJsonBody = requestBody?.content[\"application/json\"];\n\n if (requestJsonBody) {\n const requestBodySchema = requestJsonBody.schema as OpenAPIV3.SchemaObject;\n\n if (requestBodySchema.type !== \"object\") {\n result.reason.push(ErrorType.PostBodySchemaIsNotJson);\n }\n\n const requestBodyParamResult = this.checkPostBodySchema(\n requestBodySchema,\n requestBody.required\n );\n result.reason.push(...requestBodyParamResult.reason);\n }\n\n // validate parameters\n const paramObject = operationObject.parameters as OpenAPIV3.ParameterObject[];\n const paramResult = this.checkParamSchema(paramObject);\n result.reason.push(...paramResult.reason);\n\n if (result.reason.length > 0) {\n result.isValid = false;\n }\n\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 {\n ParseOptions,\n APIValidationResult,\n ErrorType,\n ProjectType,\n CheckParamResult,\n SpecValidationResult,\n} from \"../interfaces\";\nimport { Validator } from \"./validator\";\nimport { Utils } from \"../utils\";\n\nexport class SMEValidator extends Validator {\n private static readonly SMERequiredParamsMaxNum = 5;\n\n constructor(spec: OpenAPIV3.Document, options: ParseOptions) {\n super();\n this.projectType = ProjectType.SME;\n this.options = options;\n this.spec = spec;\n this.checkCircularReference();\n }\n\n validateSpec(): SpecValidationResult {\n const result: SpecValidationResult = { errors: [], warnings: [] };\n\n // validate spec version\n let validationResult = this.validateSpecVersion();\n result.errors.push(...validationResult.errors);\n\n // validate spec server\n validationResult = this.validateSpecServer();\n result.errors.push(...validationResult.errors);\n\n // validate no supported API\n validationResult = this.validateSpecNoSupportAPI();\n result.errors.push(...validationResult.errors);\n\n // validate operationId missing\n if (this.options.allowMissingId) {\n validationResult = this.validateSpecOperationId();\n result.warnings.push(...validationResult.warnings);\n }\n\n return result;\n }\n\n validateAPI(method: string, path: string): APIValidationResult {\n const result: APIValidationResult = { isValid: true, reason: [] };\n method = method.toLocaleLowerCase();\n\n // validate method and path\n const methodAndPathResult = this.validateMethodAndPath(method, path);\n if (!methodAndPathResult.isValid) {\n return methodAndPathResult;\n }\n\n const circularReferenceResult = this.validateCircularReference(method, path);\n if (!circularReferenceResult.isValid) {\n return circularReferenceResult;\n }\n\n const operationObject = (this.spec.paths[path] as any)[method] as OpenAPIV3.OperationObject;\n\n // validate auth\n const authCheckResult = this.validateAuth(method, path);\n result.reason.push(...authCheckResult.reason);\n\n // validate operationId\n if (!this.options.allowMissingId && !operationObject.operationId) {\n result.reason.push(ErrorType.MissingOperationId);\n }\n\n // validate server\n const validateServerResult = this.validateServer(method, path);\n result.reason.push(...validateServerResult.reason);\n\n // validate response\n const validateResponseResult = this.validateResponse(method, path);\n result.reason.push(...validateResponseResult.reason);\n\n let postBodyResult: CheckParamResult = {\n requiredNum: 0,\n optionalNum: 0,\n isValid: true,\n reason: [],\n };\n\n // validate requestBody\n const requestBody = operationObject.requestBody as OpenAPIV3.RequestBodyObject;\n const requestJsonBody = requestBody?.content[\"application/json\"];\n\n if (Utils.containMultipleMediaTypes(requestBody)) {\n result.reason.push(ErrorType.PostBodyContainMultipleMediaTypes);\n }\n\n if (requestJsonBody) {\n const requestBodySchema = requestJsonBody.schema as OpenAPIV3.SchemaObject;\n\n postBodyResult = this.checkPostBodySchema(requestBodySchema, requestBody.required);\n result.reason.push(...postBodyResult.reason);\n }\n\n // validate parameters\n const paramObject = operationObject.parameters as OpenAPIV3.ParameterObject[];\n const paramResult = this.checkParamSchema(paramObject);\n result.reason.push(...paramResult.reason);\n\n // validate total parameters count\n if (paramResult.isValid && postBodyResult.isValid) {\n const paramCountResult = this.validateParamCount(postBodyResult, paramResult);\n result.reason.push(...paramCountResult.reason);\n }\n\n if (result.reason.length > 0) {\n result.isValid = false;\n }\n\n return result;\n }\n\n private validateParamCount(\n postBodyResult: CheckParamResult,\n paramResult: CheckParamResult\n ): APIValidationResult {\n const result: APIValidationResult = { isValid: true, reason: [] };\n const totalRequiredParams = postBodyResult.requiredNum + paramResult.requiredNum;\n const totalParams = totalRequiredParams + postBodyResult.optionalNum + paramResult.optionalNum;\n\n if (totalRequiredParams > 1) {\n if (\n !this.options.allowMultipleParameters ||\n totalRequiredParams > SMEValidator.SMERequiredParamsMaxNum\n ) {\n result.reason.push(ErrorType.ExceededRequiredParamsLimit);\n }\n } else if (totalParams === 0) {\n result.reason.push(ErrorType.NoParameter);\n }\n\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 {\n ParseOptions,\n APIValidationResult,\n ErrorType,\n ProjectType,\n SpecValidationResult,\n} from \"../interfaces\";\nimport { Validator } from \"./validator\";\n\nexport class TeamsAIValidator extends Validator {\n constructor(spec: OpenAPIV3.Document, options: ParseOptions) {\n super();\n this.projectType = ProjectType.TeamsAi;\n this.options = options;\n this.spec = spec;\n this.checkCircularReference();\n }\n\n validateSpec(): SpecValidationResult {\n const result: SpecValidationResult = { errors: [], warnings: [] };\n\n // validate spec server\n let validationResult = this.validateSpecServer();\n result.errors.push(...validationResult.errors);\n\n // validate no supported API\n validationResult = this.validateSpecNoSupportAPI();\n result.errors.push(...validationResult.errors);\n\n return result;\n }\n\n validateAPI(method: string, path: string): APIValidationResult {\n const result: APIValidationResult = { isValid: true, reason: [] };\n method = method.toLocaleLowerCase();\n\n // validate method and path\n const methodAndPathResult = this.validateMethodAndPath(method, path);\n if (!methodAndPathResult.isValid) {\n return methodAndPathResult;\n }\n\n const circularReferenceResult = this.validateCircularReference(method, path);\n if (!circularReferenceResult.isValid) {\n return circularReferenceResult;\n }\n\n const operationObject = (this.spec.paths[path] as any)[method] as OpenAPIV3.OperationObject;\n\n // validate operationId\n if (!this.options.allowMissingId && !operationObject.operationId) {\n result.reason.push(ErrorType.MissingOperationId);\n }\n\n // validate server\n const validateServerResult = this.validateServer(method, path);\n result.reason.push(...validateServerResult.reason);\n\n if (result.reason.length > 0) {\n result.isValid = false;\n }\n\n return result;\n }\n}\n","import { OpenAPIV3 } from \"openapi-types\";\nimport { ParseOptions, ProjectType } from \"../interfaces\";\nimport { CopilotValidator } from \"./copilotValidator\";\nimport { SMEValidator } from \"./smeValidator\";\nimport { TeamsAIValidator } from \"./teamsAIValidator\";\nimport { Validator } from \"./validator\";\n\nexport class ValidatorFactory {\n static create(spec: OpenAPIV3.Document, options: ParseOptions): Validator {\n const type = options.projectType ?? ProjectType.SME;\n\n switch (type) {\n case ProjectType.SME:\n return new SMEValidator(spec, options);\n case ProjectType.Copilot:\n return new CopilotValidator(spec, options);\n case ProjectType.TeamsAi:\n return new TeamsAIValidator(spec, options);\n default:\n throw new Error(`Invalid project type: ${type}`);\n }\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 ListAPIResult,\n ProjectType,\n APIMap,\n ErrorResult,\n WarningResult,\n} from \"./interfaces\";\nimport { SpecParserError } from \"./specParserError\";\nimport { Utils } from \"./utils\";\nimport { ConstantString } from \"./constants\";\nimport { ValidatorFactory } from \"./validators/validatorFactory\";\nimport { Validator } from \"./validators/validator\";\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 spec: OpenAPIV3.Document | undefined;\n private validator: Validator | 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 allowBearerTokenAuth: false,\n allowOauth2: false,\n allowMethods: [\"get\", \"post\"],\n allowConversationStarters: false,\n allowResponseSemantics: false,\n allowConfirmation: false,\n projectType: ProjectType.SME,\n isGptPlugin: 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 const errors: ErrorResult[] = [];\n const warnings: WarningResult[] = [];\n\n if (!this.options.allowSwagger && this.isSwaggerFile) {\n return {\n status: ValidationStatus.Error,\n warnings: [],\n errors: [\n {\n type: ErrorType.SwaggerNotSupported,\n content: ConstantString.SwaggerNotSupported,\n },\n ],\n };\n }\n\n // Remote reference not supported\n const refPaths = this.parser.$refs.paths();\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 const validator = this.getValidator(this.spec!);\n const validationResult = validator.validateSpec();\n\n warnings.push(...validationResult.warnings);\n errors.push(...validationResult.errors);\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: status,\n warnings: warnings,\n errors: errors,\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.getAPIs(this.spec!);\n const apiInfos: APIInfo[] = [];\n for (const key in apiMap) {\n const { operation, isValid } = apiMap[key];\n\n if (!isValid) {\n continue;\n }\n\n const [method, path] = key.split(\" \");\n const operationId = operation.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 = Utils.parseApiInfo(operation, this.options);\n\n const apiInfo: APIInfo = {\n method: method,\n path: path,\n title: command.title,\n id: operationId,\n parameters: command.parameters!,\n description: command.description!,\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 ): 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 getAPIs(spec: OpenAPIV3.Document): APIMap {\n const validator = this.getValidator(spec);\n const apiMap = validator.listAPIs();\n return apiMap;\n }\n\n private getValidator(spec: OpenAPIV3.Document): Validator {\n if (this.validator) {\n return this.validator;\n }\n const validator = ValidatorFactory.create(spec, this.options);\n this.validator = validator;\n return validator;\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(\n operationItem: OpenAPIV3.OperationObject,\n allowMultipleMediaType = false\n ): [AdaptiveCard, string] {\n try {\n const { json } = Utils.getResponseJson(operationItem, allowMultipleMediaType);\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 && ${name} != ''}`,\n },\n ];\n } else {\n return [\n {\n type: \"Image\",\n url: \"${$data}\",\n $when: \"${$data != null && $data != ''}\",\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;AAsFA;;;IAGY;AAAZ,WAAY,SAAS;IACnB,4CAA+B,CAAA;IAC/B,+DAAk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ACrF;;IAGD,OAAO,6BAA6B,CAAC,MAA8B;QACjE,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ,KAAK,CAAC,MAAM,CAAC,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/validators/validator.ts","../src/validators/copilotValidator.ts","../src/validators/smeValidator.ts","../src/validators/teamsAIValidator.ts","../src/validators/validatorFactory.ts","../src/specParser.browser.ts","../src/adaptiveCardGenerator.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\"use strict\";\n\nimport { IParameter } from \"@microsoft/teams-manifest\";\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 specHash?: string;\n}\n\nexport interface SpecValidationResult {\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 AddedAPINotInOriginalSpec = \"added-api-not-in-original-spec\",\n ResolveServerUrlFailed = \"resolve-server-url-failed\",\n SwaggerNotSupported = \"swagger-not-supported\",\n MultipleAuthNotSupported = \"multiple-auth-not-supported\",\n SpecVersionNotSupported = \"spec-version-not-supported\",\n CircularReferenceNotSupported = \"circular-reference-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 AuthTypeIsNotSupported = \"auth-type-is-not-supported\",\n MissingOperationId = \"missing-operation-id\",\n PostBodyContainMultipleMediaTypes = \"post-body-contain-multiple-media-types\",\n ResponseContainMultipleMediaTypes = \"response-contain-multiple-media-types\",\n ResponseJsonIsEmpty = \"response-json-is-empty\",\n PostBodySchemaIsNotJson = \"post-body-schema-is-not-json\",\n PostBodyContainsRequiredUnsupportedSchema = \"post-body-contains-required-unsupported-schema\",\n ParamsContainRequiredUnsupportedSchema = \"params-contain-required-unsupported-schema\",\n ParamsContainsNestedObject = \"params-contains-nested-object\",\n RequestBodyContainsNestedObject = \"request-body-contains-nested-object\",\n ExceededRequiredParamsLimit = \"exceeded-required-params-limit\",\n NoParameter = \"no-parameter\",\n NoAPIInfo = \"no-api-info\",\n MethodNotAllowed = \"method-not-allowed\",\n UrlPathNotExist = \"url-path-not-exist\",\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 FuncDescriptionTooLong = \"function-description-too-long\",\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 type AdaptiveCardBody = Array<TextBlockElement | ImageElement | ArrayElement>;\n\nexport interface ArrayElement {\n type: string;\n $data: string;\n items: AdaptiveCardBody;\n}\n\nexport interface AdaptiveCard {\n type: string;\n $schema: string;\n version: string;\n body: AdaptiveCardBody;\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 CheckParamResult {\n requiredNum: number;\n optionalNum: number;\n isValid: boolean;\n reason: ErrorType[];\n}\n\nexport interface ParseOptions {\n /**\n * If true, the parser will not throw an error if an ID is missing the spec file.\n */\n allowMissingId?: boolean;\n\n /**\n * If true, the parser will allow parsing of Swagger specifications.\n */\n allowSwagger?: boolean;\n\n /**\n * If true, the parser will allow API Key authentication in the spec file.\n */\n allowAPIKeyAuth?: boolean;\n\n /**\n * If true, the parser will allow Bearer Token authentication in the spec file.\n */\n allowBearerTokenAuth?: boolean;\n\n /**\n * If true, the parser will allow multiple parameters in the spec file. Teams AI project would ignore this parameters and always true\n */\n allowMultipleParameters?: boolean;\n\n /**\n * If true, the parser will allow OAuth2 authentication in the spec file. Currently only support OAuth2 with auth code flow.\n */\n allowOauth2?: boolean;\n\n /**\n * An array of HTTP methods that the parser will allow in the spec file.\n */\n allowMethods?: string[];\n\n /**\n * If true, the parser will allow conversation starters in plugin file. Only take effect in Copilot project\n */\n allowConversationStarters?: boolean;\n\n /**\n * If true, the parser will allow response semantics in plugin file. Only take effect in Copilot project\n */\n allowResponseSemantics?: boolean;\n\n /**\n * If true, the paser will allow confirmation in plugin file. Only take effect in Copilot project\n */\n allowConfirmation?: boolean;\n\n /**\n * The type of project that the parser is being used for.\n * Project can be SME/Copilot/TeamsAi\n */\n projectType?: ProjectType;\n\n /**\n * If true, we will generate files of plugin for GPT (Declarative Extensions in a Copilot Extension). Otherwise, we will generate files of plugin for Copilot.\n */\n isGptPlugin?: boolean;\n}\n\nexport enum ProjectType {\n Copilot,\n SME,\n TeamsAi,\n}\n\nexport interface APIInfo {\n method: string;\n path: string;\n title: string;\n id: string;\n parameters: IParameter[];\n description: string;\n warning?: WarningResult;\n}\n\nexport interface ListAPIInfo {\n api: string;\n server: string;\n operationId: string;\n isValid: boolean;\n reason: ErrorType[];\n auth?: AuthInfo;\n}\n\nexport interface APIMap {\n [key: string]: {\n operation: OpenAPIV3.OperationObject;\n isValid: boolean;\n reason: ErrorType[];\n };\n}\n\nexport interface APIValidationResult {\n isValid: boolean;\n reason: ErrorType[];\n}\n\nexport interface ListAPIResult {\n allAPICount: number;\n validAPICount: number;\n APIs: ListAPIInfo[];\n}\n\nexport type AuthType = OpenAPIV3.SecuritySchemeObject | { type: \"multipleAuth\" };\n\nexport interface AuthInfo {\n authScheme: AuthType;\n name: string;\n}\n\nexport interface InvalidAPIInfo {\n api: string;\n reason: ErrorType[];\n}\n\nexport interface InferredProperties {\n title?: string;\n subtitle?: string;\n imageUrl?: string;\n}\n\nexport interface ExistingPluginManifestInfo {\n manifestPath: string;\n specPath: 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 =\n \"'oneOf', 'allOf', '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 SpecVersionNotSupported =\n \"Unsupported OpenAPI version %s. Please use version 3.0.x.\";\n\n static readonly MultipleAuthNotSupported =\n \"Multiple authentication methods are unsupported. Ensure all selected APIs use identical authentication.\";\n\n static readonly UnsupportedSchema = \"Unsupported schema in %s %s: %s\";\n static readonly FuncDescriptionTooLong =\n \"The description of the function '%s' is too long. The current length is %s characters, while the maximum allowed length is %s characters.\";\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 ImageType = \"Image\";\n static readonly ContainerType = \"Container\";\n static readonly RegistrationIdPostfix: { [key: string]: string } = {\n apiKey: \"REGISTRATION_ID\",\n oauth2: \"CONFIGURATION_ID\",\n http: \"REGISTRATION_ID\",\n openIdConnect: \"REGISTRATION_ID\",\n };\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 ConversationStarterMaxLens = 50;\n static readonly CommandTitleMaxLens = 32;\n static readonly ParameterTitleMaxLens = 32;\n static readonly SMERequiredParamsMaxNum = 5;\n static readonly FunctionDescriptionMaxLens = 100;\n static readonly DefaultPluginId = \"plugin_1\";\n static readonly PluginManifestSchema =\n \"https://developer.microsoft.com/json-schemas/copilot/plugin/v2.1/schema.json\";\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\"use strict\";\n\nimport { OpenAPIV3 } from \"openapi-types\";\nimport { ConstantString } from \"./constants\";\nimport {\n AdaptiveCardBody,\n ArrayElement,\n AuthInfo,\n AuthType,\n ErrorResult,\n ErrorType,\n ParseOptions,\n} from \"./interfaces\";\nimport { IMessagingExtensionCommand, IParameter } from \"@microsoft/teams-manifest\";\nimport { SpecParserError } from \"./specParserError\";\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 containMultipleMediaTypes(\n bodyObject: OpenAPIV3.RequestBodyObject | OpenAPIV3.ResponseObject\n ): boolean {\n return Object.keys(bodyObject?.content || {}).length > 1;\n }\n\n static isBearerTokenAuth(authScheme: AuthType): boolean {\n return authScheme.type === \"http\" && authScheme.scheme === \"bearer\";\n }\n\n static isAPIKeyAuth(authScheme: AuthType): boolean {\n return authScheme.type === \"apiKey\";\n }\n\n static isOAuthWithAuthCodeFlow(authScheme: AuthType): boolean {\n return !!(\n authScheme.type === \"oauth2\" &&\n authScheme.flows &&\n authScheme.flows.authorizationCode\n );\n }\n\n static getAuthArray(\n securities: OpenAPIV3.SecurityRequirementObject[] | undefined,\n spec: OpenAPIV3.Document\n ): AuthInfo[][] {\n const result: AuthInfo[][] = [];\n const securitySchemas = spec.components?.securitySchemes;\n const securitiesArr = securities ?? spec.security;\n if (securitiesArr && securitySchemas) {\n for (let i = 0; i < securitiesArr.length; i++) {\n const security = securitiesArr[i];\n\n const authArray: AuthInfo[] = [];\n for (const name in security) {\n const auth = securitySchemas[name] as OpenAPIV3.SecuritySchemeObject;\n authArray.push({\n authScheme: 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 getAuthInfo(spec: OpenAPIV3.Document): AuthInfo | undefined {\n let authInfo: AuthInfo | undefined = undefined;\n\n for (const url in spec.paths) {\n for (const method in spec.paths[url]) {\n const operation = (spec.paths[url] as any)[method] as OpenAPIV3.OperationObject;\n\n const authArray = Utils.getAuthArray(operation.security, spec);\n\n if (authArray && authArray.length > 0) {\n const currentAuth = authArray[0][0];\n if (!authInfo) {\n authInfo = authArray[0][0];\n } else if (authInfo.name !== currentAuth.name) {\n throw new SpecParserError(\n ConstantString.MultipleAuthNotSupported,\n ErrorType.MultipleAuthNotSupported\n );\n }\n }\n }\n }\n\n return authInfo;\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 allowMultipleMediaType = false\n ): {\n json: OpenAPIV3.MediaTypeObject;\n multipleMediaType: boolean;\n } {\n let json: OpenAPIV3.MediaTypeObject = {};\n let multipleMediaType = false;\n\n for (const code of ConstantString.ResponseCodeFor20X) {\n const responseObject = operationObject?.responses?.[code] as OpenAPIV3.ResponseObject;\n\n if (responseObject?.content) {\n for (const contentType of Object.keys(responseObject.content)) {\n // json media type can also be \"application/json; charset=utf-8\"\n if (contentType.indexOf(\"application/json\") >= 0) {\n multipleMediaType = false;\n json = responseObject.content[contentType];\n if (Utils.containMultipleMediaTypes(responseObject)) {\n multipleMediaType = true;\n if (!allowMultipleMediaType) {\n json = {};\n }\n } else {\n return { json, multipleMediaType };\n }\n }\n }\n }\n }\n\n return { json, multipleMediaType };\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 resolveEnv(str: string): string {\n const placeHolderReg = /\\${{\\s*([a-zA-Z_][a-zA-Z0-9_]*)\\s*}}/g;\n let matches = placeHolderReg.exec(str);\n let newStr = str;\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 newStr = newStr.replace(matches[0], envVal);\n }\n matches = placeHolderReg.exec(str);\n }\n return newStr;\n }\n\n static checkServerUrl(servers: OpenAPIV3.ServerObject[]): ErrorResult[] {\n const errors: ErrorResult[] = [];\n\n let serverUrl;\n try {\n serverUrl = Utils.resolveEnv(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(spec: OpenAPIV3.Document, options: ParseOptions): 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\n errors.push(...serverErrors);\n }\n\n for (const method in methods) {\n const operationObject = (methods as any)[method] as OpenAPIV3.OperationObject;\n if (options.allowMethods?.includes(method) && operationObject) {\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\n if (!hasTopLevelServers && !hasPathLevelServers && !hasOperationLevelServers) {\n errors.push({\n type: ErrorType.NoServerInformation,\n content: ConstantString.NoServerInformation,\n });\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 ): [IParameter[], IParameter[]] {\n const requiredParams: IParameter[] = [];\n const optionalParams: IParameter[] = [];\n\n if (\n schema.type === \"string\" ||\n schema.type === \"integer\" ||\n schema.type === \"boolean\" ||\n schema.type === \"number\"\n ) {\n const parameter: IParameter = {\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 parameter.isRequired = true;\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: IParameter): 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 options: ParseOptions\n ): IMessagingExtensionCommand {\n const requiredParams: IParameter[] = [];\n const optionalParams: IParameter[] = [];\n const paramObject = operationItem.parameters as OpenAPIV3.ParameterObject[];\n\n if (paramObject) {\n paramObject.forEach((param: OpenAPIV3.ParameterObject) => {\n const parameter: IParameter = {\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 (options.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 parameter.isRequired = true;\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 !!options.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 = [...requiredParams, ...optionalParams];\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 return command;\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 static getServerObject(\n spec: OpenAPIV3.Document,\n method: string,\n path: string\n ): OpenAPIV3.ServerObject | undefined {\n const pathObj = spec.paths[path] as any;\n\n const operationObject = pathObj[method] as OpenAPIV3.OperationObject;\n\n const rootServer = spec.servers && spec.servers[0];\n const methodServer = spec.paths[path]!.servers && spec.paths[path]!.servers![0];\n const operationServer = operationObject.servers && operationObject.servers[0];\n\n const serverUrl = operationServer || methodServer || rootServer;\n\n return serverUrl;\n }\n\n static limitACBodyProperties(body: AdaptiveCardBody, maxCount: number): AdaptiveCardBody {\n const result: AdaptiveCardBody = [];\n let currentCount = 0;\n\n for (const element of body) {\n if (element.type === ConstantString.ContainerType) {\n const items = this.limitACBodyProperties(\n (element as ArrayElement).items,\n maxCount - currentCount\n );\n\n result.push({\n type: ConstantString.ContainerType,\n $data: (element as ArrayElement).$data,\n items: items,\n });\n\n currentCount += items.length;\n } else {\n result.push(element);\n currentCount++;\n }\n\n if (currentCount >= maxCount) {\n break;\n }\n }\n\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 {\n ParseOptions,\n APIValidationResult,\n ErrorType,\n CheckParamResult,\n ProjectType,\n APIMap,\n SpecValidationResult,\n WarningType,\n InvalidAPIInfo,\n} from \"../interfaces\";\nimport { Utils } from \"../utils\";\nimport { ConstantString } from \"../constants\";\n\nexport abstract class Validator {\n projectType!: ProjectType;\n spec!: OpenAPIV3.Document;\n options!: ParseOptions;\n\n private apiMap: APIMap | undefined;\n private hasCircularReference = false;\n\n abstract validateAPI(method: string, path: string): APIValidationResult;\n abstract validateSpec(): SpecValidationResult;\n\n protected checkCircularReference(): void {\n try {\n JSON.stringify(this.spec);\n } catch (e) {\n if ((e as Error).message.includes(\"Converting circular structure to JSON\")) {\n this.hasCircularReference = true;\n }\n }\n }\n\n listAPIs(): APIMap {\n if (this.apiMap) {\n return this.apiMap;\n }\n\n const paths = this.spec.paths;\n const result: APIMap = {};\n for (const path in paths) {\n const methods = paths[path];\n for (const method in methods) {\n const operationObject = (methods as any)[method] as OpenAPIV3.OperationObject;\n if (this.options.allowMethods?.includes(method) && operationObject) {\n const validateResult = this.validateAPI(method, path);\n result[`${method.toUpperCase()} ${path}`] = {\n operation: operationObject,\n isValid: validateResult.isValid,\n reason: validateResult.reason,\n };\n }\n }\n }\n\n this.apiMap = result;\n return result;\n }\n\n protected validateSpecVersion(): SpecValidationResult {\n const result: SpecValidationResult = { errors: [], warnings: [] };\n\n if (this.spec.openapi >= \"3.1.0\") {\n result.errors.push({\n type: ErrorType.SpecVersionNotSupported,\n content: Utils.format(ConstantString.SpecVersionNotSupported, this.spec.openapi),\n data: this.spec.openapi,\n });\n }\n\n return result;\n }\n\n protected validateSpecServer(): SpecValidationResult {\n const result: SpecValidationResult = { errors: [], warnings: [] };\n const serverErrors = Utils.validateServer(this.spec, this.options);\n result.errors.push(...serverErrors);\n return result;\n }\n\n protected validateSpecNoSupportAPI(): SpecValidationResult {\n const result: SpecValidationResult = { errors: [], warnings: [] };\n\n const apiMap = this.listAPIs();\n\n const validAPIs = Object.entries(apiMap).filter(([, value]) => value.isValid);\n if (validAPIs.length === 0) {\n const data = [];\n for (const key in apiMap) {\n const { reason } = apiMap[key];\n const apiInvalidReason: InvalidAPIInfo = { api: key, reason: reason };\n data.push(apiInvalidReason);\n }\n\n result.errors.push({\n type: ErrorType.NoSupportedApi,\n content: ConstantString.NoSupportedApi,\n data,\n });\n }\n\n return result;\n }\n\n protected validateSpecOperationId(): SpecValidationResult {\n const result: SpecValidationResult = { errors: [], warnings: [] };\n const apiMap = this.listAPIs();\n\n // OperationId missing\n const apisMissingOperationId: string[] = [];\n for (const key in apiMap) {\n const { operation } = apiMap[key];\n if (!operation.operationId) {\n apisMissingOperationId.push(key);\n }\n }\n\n if (apisMissingOperationId.length > 0) {\n result.warnings.push({\n type: WarningType.OperationIdMissing,\n content: Utils.format(ConstantString.MissingOperationId, apisMissingOperationId.join(\", \")),\n data: apisMissingOperationId,\n });\n }\n\n return result;\n }\n\n protected validateMethodAndPath(method: string, path: string): APIValidationResult {\n const result: APIValidationResult = { isValid: true, reason: [] };\n\n if (this.options.allowMethods && !this.options.allowMethods.includes(method)) {\n result.isValid = false;\n result.reason.push(ErrorType.MethodNotAllowed);\n return result;\n }\n\n const pathObj = this.spec.paths[path] as any;\n\n if (!pathObj || !pathObj[method]) {\n result.isValid = false;\n result.reason.push(ErrorType.UrlPathNotExist);\n return result;\n }\n\n return result;\n }\n\n protected validateCircularReference(method: string, path: string): APIValidationResult {\n const result: APIValidationResult = { isValid: true, reason: [] };\n if (this.hasCircularReference) {\n const operationObject = (this.spec.paths[path] as any)[method] as OpenAPIV3.OperationObject;\n try {\n JSON.stringify(operationObject);\n } catch (e) {\n if ((e as Error).message.includes(\"Converting circular structure to JSON\")) {\n result.isValid = false;\n result.reason.push(ErrorType.CircularReferenceNotSupported);\n }\n }\n }\n\n return result;\n }\n\n protected validateResponse(method: string, path: string): APIValidationResult {\n const result: APIValidationResult = { isValid: true, reason: [] };\n\n const operationObject = (this.spec.paths[path] as any)[method] as OpenAPIV3.OperationObject;\n\n const { json, multipleMediaType } = Utils.getResponseJson(operationObject);\n\n if (this.options.projectType === ProjectType.SME) {\n // only support response body only contains “application/json” content type\n if (multipleMediaType) {\n result.reason.push(ErrorType.ResponseContainMultipleMediaTypes);\n } else if (Object.keys(json).length === 0) {\n // response body should not be empty\n result.reason.push(ErrorType.ResponseJsonIsEmpty);\n }\n }\n\n return result;\n }\n\n protected validateServer(method: string, path: string): APIValidationResult {\n const result: APIValidationResult = { isValid: true, reason: [] };\n const serverObj = Utils.getServerObject(this.spec, method, path);\n if (!serverObj) {\n // should contain server URL\n result.reason.push(ErrorType.NoServerInformation);\n } else {\n // server url should be absolute url with https protocol\n const serverValidateResult = Utils.checkServerUrl([serverObj]);\n result.reason.push(...serverValidateResult.map((item) => item.type));\n }\n\n return result;\n }\n\n protected validateAuth(method: string, path: string): APIValidationResult {\n const pathObj = this.spec.paths[path] as any;\n const operationObject = pathObj[method] as OpenAPIV3.OperationObject;\n\n const securities = operationObject.security;\n const authSchemeArray = Utils.getAuthArray(securities, this.spec);\n\n if (authSchemeArray.length === 0) {\n return { isValid: true, reason: [] };\n }\n\n if (\n this.options.allowAPIKeyAuth ||\n this.options.allowOauth2 ||\n this.options.allowBearerTokenAuth\n ) {\n // Currently we don't support multiple auth in one operation\n if (authSchemeArray.length > 0 && authSchemeArray.every((auths) => auths.length > 1)) {\n return {\n isValid: false,\n reason: [ErrorType.MultipleAuthNotSupported],\n };\n }\n\n for (const auths of authSchemeArray) {\n if (auths.length === 1) {\n if (\n (this.options.allowAPIKeyAuth && Utils.isAPIKeyAuth(auths[0].authScheme)) ||\n (this.options.allowOauth2 && Utils.isOAuthWithAuthCodeFlow(auths[0].authScheme)) ||\n (this.options.allowBearerTokenAuth && Utils.isBearerTokenAuth(auths[0].authScheme))\n ) {\n return { isValid: true, reason: [] };\n }\n }\n }\n }\n\n return { isValid: false, reason: [ErrorType.AuthTypeIsNotSupported] };\n }\n\n protected checkPostBodySchema(\n schema: OpenAPIV3.SchemaObject,\n isRequired = false\n ): CheckParamResult {\n const paramResult: CheckParamResult = {\n requiredNum: 0,\n optionalNum: 0,\n isValid: true,\n reason: [],\n };\n\n if (Object.keys(schema).length === 0) {\n return paramResult;\n }\n\n const isRequiredWithoutDefault = isRequired && schema.default === undefined;\n const isCopilot = this.projectType === ProjectType.Copilot;\n\n if (isCopilot && this.hasNestedObjectInSchema(schema)) {\n paramResult.isValid = false;\n paramResult.reason = [ErrorType.RequestBodyContainsNestedObject];\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 = this.checkPostBodySchema(\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 paramResult.reason.push(...result.reason);\n }\n } else {\n if (isRequiredWithoutDefault && !isCopilot) {\n paramResult.isValid = false;\n paramResult.reason.push(ErrorType.PostBodyContainsRequiredUnsupportedSchema);\n }\n }\n return paramResult;\n }\n\n protected checkParamSchema(paramObject: OpenAPIV3.ParameterObject[]): CheckParamResult {\n const paramResult: CheckParamResult = {\n requiredNum: 0,\n optionalNum: 0,\n isValid: true,\n reason: [],\n };\n\n if (!paramObject) {\n return paramResult;\n }\n\n const isCopilot = this.projectType === ProjectType.Copilot;\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 paramResult.reason.push(ErrorType.ParamsContainsNestedObject);\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 paramResult.reason.push(ErrorType.ParamsContainRequiredUnsupportedSchema);\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 paramResult.reason.push(ErrorType.ParamsContainRequiredUnsupportedSchema);\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 private 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","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\"use strict\";\n\nimport { OpenAPIV3 } from \"openapi-types\";\nimport {\n ParseOptions,\n APIValidationResult,\n ErrorType,\n ProjectType,\n SpecValidationResult,\n} from \"../interfaces\";\nimport { Validator } from \"./validator\";\n\nexport class CopilotValidator extends Validator {\n constructor(spec: OpenAPIV3.Document, options: ParseOptions) {\n super();\n this.projectType = ProjectType.Copilot;\n this.options = options;\n this.spec = spec;\n this.checkCircularReference();\n }\n\n validateSpec(): SpecValidationResult {\n const result: SpecValidationResult = { errors: [], warnings: [] };\n\n // validate spec version\n let validationResult = this.validateSpecVersion();\n result.errors.push(...validationResult.errors);\n\n // validate spec server\n validationResult = this.validateSpecServer();\n result.errors.push(...validationResult.errors);\n\n // validate no supported API\n validationResult = this.validateSpecNoSupportAPI();\n result.errors.push(...validationResult.errors);\n\n // validate operationId missing\n validationResult = this.validateSpecOperationId();\n result.warnings.push(...validationResult.warnings);\n\n return result;\n }\n\n validateAPI(method: string, path: string): APIValidationResult {\n const result: APIValidationResult = { isValid: true, reason: [] };\n method = method.toLocaleLowerCase();\n\n // validate method and path\n const methodAndPathResult = this.validateMethodAndPath(method, path);\n if (!methodAndPathResult.isValid) {\n return methodAndPathResult;\n }\n\n const circularReferenceResult = this.validateCircularReference(method, path);\n if (!circularReferenceResult.isValid) {\n return circularReferenceResult;\n }\n\n const operationObject = (this.spec.paths[path] as any)[method] as OpenAPIV3.OperationObject;\n\n // validate auth\n const authCheckResult = this.validateAuth(method, path);\n result.reason.push(...authCheckResult.reason);\n\n // validate operationId\n if (!this.options.allowMissingId && !operationObject.operationId) {\n result.reason.push(ErrorType.MissingOperationId);\n }\n\n // validate server\n const validateServerResult = this.validateServer(method, path);\n result.reason.push(...validateServerResult.reason);\n\n // validate response\n const validateResponseResult = this.validateResponse(method, path);\n result.reason.push(...validateResponseResult.reason);\n\n // validate requestBody\n const requestBody = operationObject.requestBody as OpenAPIV3.RequestBodyObject;\n const requestJsonBody = requestBody?.content[\"application/json\"];\n\n if (requestJsonBody) {\n const requestBodySchema = requestJsonBody.schema as OpenAPIV3.SchemaObject;\n\n if (requestBodySchema.type !== \"object\") {\n result.reason.push(ErrorType.PostBodySchemaIsNotJson);\n }\n\n const requestBodyParamResult = this.checkPostBodySchema(\n requestBodySchema,\n requestBody.required\n );\n result.reason.push(...requestBodyParamResult.reason);\n }\n\n // validate parameters\n const paramObject = operationObject.parameters as OpenAPIV3.ParameterObject[];\n const paramResult = this.checkParamSchema(paramObject);\n result.reason.push(...paramResult.reason);\n\n if (result.reason.length > 0) {\n result.isValid = false;\n }\n\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 {\n ParseOptions,\n APIValidationResult,\n ErrorType,\n ProjectType,\n CheckParamResult,\n SpecValidationResult,\n} from \"../interfaces\";\nimport { Validator } from \"./validator\";\nimport { Utils } from \"../utils\";\n\nexport class SMEValidator extends Validator {\n private static readonly SMERequiredParamsMaxNum = 5;\n\n constructor(spec: OpenAPIV3.Document, options: ParseOptions) {\n super();\n this.projectType = ProjectType.SME;\n this.options = options;\n this.spec = spec;\n this.checkCircularReference();\n }\n\n validateSpec(): SpecValidationResult {\n const result: SpecValidationResult = { errors: [], warnings: [] };\n\n // validate spec version\n let validationResult = this.validateSpecVersion();\n result.errors.push(...validationResult.errors);\n\n // validate spec server\n validationResult = this.validateSpecServer();\n result.errors.push(...validationResult.errors);\n\n // validate no supported API\n validationResult = this.validateSpecNoSupportAPI();\n result.errors.push(...validationResult.errors);\n\n // validate operationId missing\n if (this.options.allowMissingId) {\n validationResult = this.validateSpecOperationId();\n result.warnings.push(...validationResult.warnings);\n }\n\n return result;\n }\n\n validateAPI(method: string, path: string): APIValidationResult {\n const result: APIValidationResult = { isValid: true, reason: [] };\n method = method.toLocaleLowerCase();\n\n // validate method and path\n const methodAndPathResult = this.validateMethodAndPath(method, path);\n if (!methodAndPathResult.isValid) {\n return methodAndPathResult;\n }\n\n const circularReferenceResult = this.validateCircularReference(method, path);\n if (!circularReferenceResult.isValid) {\n return circularReferenceResult;\n }\n\n const operationObject = (this.spec.paths[path] as any)[method] as OpenAPIV3.OperationObject;\n\n // validate auth\n const authCheckResult = this.validateAuth(method, path);\n result.reason.push(...authCheckResult.reason);\n\n // validate operationId\n if (!this.options.allowMissingId && !operationObject.operationId) {\n result.reason.push(ErrorType.MissingOperationId);\n }\n\n // validate server\n const validateServerResult = this.validateServer(method, path);\n result.reason.push(...validateServerResult.reason);\n\n // validate response\n const validateResponseResult = this.validateResponse(method, path);\n result.reason.push(...validateResponseResult.reason);\n\n let postBodyResult: CheckParamResult = {\n requiredNum: 0,\n optionalNum: 0,\n isValid: true,\n reason: [],\n };\n\n // validate requestBody\n const requestBody = operationObject.requestBody as OpenAPIV3.RequestBodyObject;\n const requestJsonBody = requestBody?.content[\"application/json\"];\n\n if (Utils.containMultipleMediaTypes(requestBody)) {\n result.reason.push(ErrorType.PostBodyContainMultipleMediaTypes);\n }\n\n if (requestJsonBody) {\n const requestBodySchema = requestJsonBody.schema as OpenAPIV3.SchemaObject;\n\n postBodyResult = this.checkPostBodySchema(requestBodySchema, requestBody.required);\n result.reason.push(...postBodyResult.reason);\n }\n\n // validate parameters\n const paramObject = operationObject.parameters as OpenAPIV3.ParameterObject[];\n const paramResult = this.checkParamSchema(paramObject);\n result.reason.push(...paramResult.reason);\n\n // validate total parameters count\n if (paramResult.isValid && postBodyResult.isValid) {\n const paramCountResult = this.validateParamCount(postBodyResult, paramResult);\n result.reason.push(...paramCountResult.reason);\n }\n\n if (result.reason.length > 0) {\n result.isValid = false;\n }\n\n return result;\n }\n\n private validateParamCount(\n postBodyResult: CheckParamResult,\n paramResult: CheckParamResult\n ): APIValidationResult {\n const result: APIValidationResult = { isValid: true, reason: [] };\n const totalRequiredParams = postBodyResult.requiredNum + paramResult.requiredNum;\n const totalParams = totalRequiredParams + postBodyResult.optionalNum + paramResult.optionalNum;\n\n if (totalRequiredParams > 1) {\n if (\n !this.options.allowMultipleParameters ||\n totalRequiredParams > SMEValidator.SMERequiredParamsMaxNum\n ) {\n result.reason.push(ErrorType.ExceededRequiredParamsLimit);\n }\n } else if (totalParams === 0) {\n result.reason.push(ErrorType.NoParameter);\n }\n\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 {\n ParseOptions,\n APIValidationResult,\n ErrorType,\n ProjectType,\n SpecValidationResult,\n} from \"../interfaces\";\nimport { Validator } from \"./validator\";\n\nexport class TeamsAIValidator extends Validator {\n constructor(spec: OpenAPIV3.Document, options: ParseOptions) {\n super();\n this.projectType = ProjectType.TeamsAi;\n this.options = options;\n this.spec = spec;\n this.checkCircularReference();\n }\n\n validateSpec(): SpecValidationResult {\n const result: SpecValidationResult = { errors: [], warnings: [] };\n\n // validate spec server\n let validationResult = this.validateSpecServer();\n result.errors.push(...validationResult.errors);\n\n // validate no supported API\n validationResult = this.validateSpecNoSupportAPI();\n result.errors.push(...validationResult.errors);\n\n return result;\n }\n\n validateAPI(method: string, path: string): APIValidationResult {\n const result: APIValidationResult = { isValid: true, reason: [] };\n method = method.toLocaleLowerCase();\n\n // validate method and path\n const methodAndPathResult = this.validateMethodAndPath(method, path);\n if (!methodAndPathResult.isValid) {\n return methodAndPathResult;\n }\n\n const circularReferenceResult = this.validateCircularReference(method, path);\n if (!circularReferenceResult.isValid) {\n return circularReferenceResult;\n }\n\n const operationObject = (this.spec.paths[path] as any)[method] as OpenAPIV3.OperationObject;\n\n // validate operationId\n if (!this.options.allowMissingId && !operationObject.operationId) {\n result.reason.push(ErrorType.MissingOperationId);\n }\n\n // validate server\n const validateServerResult = this.validateServer(method, path);\n result.reason.push(...validateServerResult.reason);\n\n if (result.reason.length > 0) {\n result.isValid = false;\n }\n\n return result;\n }\n}\n","import { OpenAPIV3 } from \"openapi-types\";\nimport { ParseOptions, ProjectType } from \"../interfaces\";\nimport { CopilotValidator } from \"./copilotValidator\";\nimport { SMEValidator } from \"./smeValidator\";\nimport { TeamsAIValidator } from \"./teamsAIValidator\";\nimport { Validator } from \"./validator\";\n\nexport class ValidatorFactory {\n static create(spec: OpenAPIV3.Document, options: ParseOptions): Validator {\n const type = options.projectType ?? ProjectType.SME;\n\n switch (type) {\n case ProjectType.SME:\n return new SMEValidator(spec, options);\n case ProjectType.Copilot:\n return new CopilotValidator(spec, options);\n case ProjectType.TeamsAi:\n return new TeamsAIValidator(spec, options);\n default:\n throw new Error(`Invalid project type: ${type}`);\n }\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 ListAPIResult,\n ProjectType,\n APIMap,\n ErrorResult,\n WarningResult,\n} from \"./interfaces\";\nimport { SpecParserError } from \"./specParserError\";\nimport { Utils } from \"./utils\";\nimport { ConstantString } from \"./constants\";\nimport { ValidatorFactory } from \"./validators/validatorFactory\";\nimport { Validator } from \"./validators/validator\";\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 spec: OpenAPIV3.Document | undefined;\n private validator: Validator | 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 allowBearerTokenAuth: false,\n allowOauth2: false,\n allowMethods: [\"get\", \"post\"],\n allowConversationStarters: false,\n allowResponseSemantics: false,\n allowConfirmation: false,\n projectType: ProjectType.SME,\n isGptPlugin: 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 const errors: ErrorResult[] = [];\n const warnings: WarningResult[] = [];\n\n if (!this.options.allowSwagger && this.isSwaggerFile) {\n return {\n status: ValidationStatus.Error,\n warnings: [],\n errors: [\n {\n type: ErrorType.SwaggerNotSupported,\n content: ConstantString.SwaggerNotSupported,\n },\n ],\n };\n }\n\n // Remote reference not supported\n const refPaths = this.parser.$refs.paths();\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 const validator = this.getValidator(this.spec!);\n const validationResult = validator.validateSpec();\n\n warnings.push(...validationResult.warnings);\n errors.push(...validationResult.errors);\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: status,\n warnings: warnings,\n errors: errors,\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.getAPIs(this.spec!);\n const apiInfos: APIInfo[] = [];\n for (const key in apiMap) {\n const { operation, isValid } = apiMap[key];\n\n if (!isValid) {\n continue;\n }\n\n const [method, path] = key.split(\" \");\n const operationId = operation.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 = Utils.parseApiInfo(operation, this.options);\n\n const apiInfo: APIInfo = {\n method: method,\n path: path,\n title: command.title,\n id: operationId,\n parameters: command.parameters!,\n description: command.description!,\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 ): 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 getAPIs(spec: OpenAPIV3.Document): APIMap {\n const validator = this.getValidator(spec);\n const apiMap = validator.listAPIs();\n return apiMap;\n }\n\n private getValidator(spec: OpenAPIV3.Document): Validator {\n if (this.validator) {\n return this.validator;\n }\n const validator = ValidatorFactory.create(spec, this.options);\n this.validator = validator;\n return validator;\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(\n operationItem: OpenAPIV3.OperationObject,\n allowMultipleMediaType = false\n ): [AdaptiveCard, string] {\n try {\n const { json } = Utils.getResponseJson(operationItem, allowMultipleMediaType);\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 && ${name} != ''}`,\n },\n ];\n } else {\n return [\n {\n type: \"Image\",\n url: \"${$data}\",\n $when: \"${$data != null && $data != ''}\",\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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