@microsoft/m365-spec-parser 0.2.7-alpha.cdc23356f.0 → 0.2.7-alpha.d1712c79a.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm2017.js +2 -0
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm2017.mjs +8 -2
- package/dist/index.esm2017.mjs.map +1 -1
- package/dist/index.esm5.js +2 -0
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +9 -1
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/src/constants.d.ts +1 -0
- package/dist/src/interfaces.d.ts +1 -0
- package/dist/src/manifestUpdater.d.ts +1 -0
- package/package.json +3 -3
package/dist/index.esm2017.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import converter from 'swagger2openapi';
|
|
|
3
3
|
import jsyaml from 'js-yaml';
|
|
4
4
|
import fs from 'fs-extra';
|
|
5
5
|
import path from 'path';
|
|
6
|
-
import {
|
|
6
|
+
import { AppManifestUtils } from '@microsoft/app-manifest';
|
|
7
7
|
import { createHash } from 'crypto';
|
|
8
8
|
|
|
9
9
|
// Copyright (c) Microsoft Corporation.
|
|
@@ -58,6 +58,7 @@ var WarningType;
|
|
|
58
58
|
WarningType["GenerateCardFailed"] = "generate-card-failed";
|
|
59
59
|
WarningType["OperationOnlyContainsOptionalParam"] = "operation-only-contains-optional-param";
|
|
60
60
|
WarningType["ConvertSwaggerToOpenAPI"] = "convert-swagger-to-openapi";
|
|
61
|
+
WarningType["OpenAPI31ConvertTo30"] = "openapi31-convert-to-30";
|
|
61
62
|
WarningType["OperationIdContainsSpecialCharacters"] = "operationid-contains-special-characters";
|
|
62
63
|
WarningType["UnsupportedAuthType"] = "unsupported-auth-type";
|
|
63
64
|
WarningType["GenerateJsonDataFailed"] = "generate-json-data-failed";
|
|
@@ -100,6 +101,7 @@ ConstantString.RelativeServerUrlNotSupported = "Server url is not correct: relat
|
|
|
100
101
|
ConstantString.ResolveServerUrlFailed = "Unable to resolve the server URL: please make sure that the environment variable %s is defined.";
|
|
101
102
|
ConstantString.OperationOnlyContainsOptionalParam = "Operation %s contains multiple optional parameters. The first optional parameter is used for this command.";
|
|
102
103
|
ConstantString.ConvertSwaggerToOpenAPI = "The Swagger 2.0 file has been converted to OpenAPI 3.0.";
|
|
104
|
+
ConstantString.OpenAPI31ConvertTo30 = "OpenAPI 3.1 document has been converted to OpenAPI 3.0.";
|
|
103
105
|
ConstantString.SwaggerNotSupported = "Swagger 2.0 is not supported. Please convert to OpenAPI 3.0 manually before proceeding.";
|
|
104
106
|
ConstantString.SpecVersionNotSupported = "Unsupported OpenAPI version %s. Please use version 3.0.x.";
|
|
105
107
|
ConstantString.MultipleAuthNotSupported = "Multiple authentication methods are unsupported. Ensure all selected APIs use identical authentication.";
|
|
@@ -1726,10 +1728,14 @@ function inferProperties(card) {
|
|
|
1726
1728
|
|
|
1727
1729
|
// Copyright (c) Microsoft Corporation.
|
|
1728
1730
|
class ManifestUpdater {
|
|
1731
|
+
static async useCopilotExtensionsInSchema(manifest) {
|
|
1732
|
+
const schema = await AppManifestUtils.fetchSchema(manifest.$schema);
|
|
1733
|
+
return !!schema.properties.copilotExtensions;
|
|
1734
|
+
}
|
|
1729
1735
|
static async updateManifestWithAiPlugin(manifestPath, outputSpecPath, apiPluginFilePath, spec, options, authMap, existingPluginManifestInfo) {
|
|
1730
1736
|
const manifest = await fs.readJSON(manifestPath);
|
|
1731
1737
|
const apiPluginRelativePath = ManifestUpdater.getRelativePath(manifestPath, apiPluginFilePath);
|
|
1732
|
-
const useCopilotExtensionsInSchema = await
|
|
1738
|
+
const useCopilotExtensionsInSchema = await this.useCopilotExtensionsInSchema(manifest);
|
|
1733
1739
|
if (manifest.copilotExtensions || useCopilotExtensionsInSchema) {
|
|
1734
1740
|
manifest.copilotExtensions = manifest.copilotExtensions || {};
|
|
1735
1741
|
if (!options.isGptPlugin) {
|