@microsoft/m365-spec-parser 0.2.4-alpha.425b32d09.0 → 0.2.4-alpha.ad0d7aa1a.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 +22 -0
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm2017.mjs +30 -0
- package/dist/index.esm2017.mjs.map +1 -1
- package/dist/index.esm5.js +22 -0
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +30 -0
- 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/utils.d.ts +1 -0
- package/package.json +3 -3
package/dist/index.esm5.js
CHANGED
|
@@ -83,6 +83,7 @@ var WarningType;
|
|
|
83
83
|
WarningType["ConvertSwaggerToOpenAPI"] = "convert-swagger-to-openapi";
|
|
84
84
|
WarningType["FuncDescriptionTooLong"] = "function-description-too-long";
|
|
85
85
|
WarningType["OperationIdContainsSpecialCharacters"] = "operationid-contains-special-characters";
|
|
86
|
+
WarningType["UnsupportedAuthType"] = "unsupported-auth-type";
|
|
86
87
|
WarningType["GenerateJsonDataFailed"] = "generate-json-data-failed";
|
|
87
88
|
WarningType["Unknown"] = "unknown";
|
|
88
89
|
})(WarningType || (WarningType = {}));
|
|
@@ -130,6 +131,7 @@ ConstantString.SwaggerNotSupported = "Swagger 2.0 is not supported. Please conve
|
|
|
130
131
|
ConstantString.SpecVersionNotSupported = "Unsupported OpenAPI version %s. Please use version 3.0.x.";
|
|
131
132
|
ConstantString.MultipleAuthNotSupported = "Multiple authentication methods are unsupported. Ensure all selected APIs use identical authentication.";
|
|
132
133
|
ConstantString.OperationIdContainsSpecialCharacters = "Operation id '%s' in OpenAPI description document contained special characters and was renamed to '%s'.";
|
|
134
|
+
ConstantString.AuthTypeIsNotSupported = "Unsupported authorization type in API '%s'. No authorization will be used.";
|
|
133
135
|
ConstantString.UnsupportedSchema = "Unsupported schema in %s %s: %s";
|
|
134
136
|
ConstantString.FuncDescriptionTooLong = "The description of the function '%s' is too long. The current length is %s characters, while the maximum allowed length is %s characters.";
|
|
135
137
|
ConstantString.GenerateJsonDataFailed = "Failed to generate JSON data for api: %s due to %s.";
|
|
@@ -235,6 +237,23 @@ class Utils {
|
|
|
235
237
|
authScheme.flows &&
|
|
236
238
|
authScheme.flows.authorizationCode);
|
|
237
239
|
}
|
|
240
|
+
static isNotSupportedAuth(authSchemeArray) {
|
|
241
|
+
if (authSchemeArray.length === 0) {
|
|
242
|
+
return false;
|
|
243
|
+
}
|
|
244
|
+
if (authSchemeArray.length > 0 && authSchemeArray.every((auths) => auths.length > 1)) {
|
|
245
|
+
return true;
|
|
246
|
+
}
|
|
247
|
+
for (const auths of authSchemeArray) {
|
|
248
|
+
if (auths.length === 1) {
|
|
249
|
+
if (Utils.isOAuthWithAuthCodeFlow(auths[0].authScheme) ||
|
|
250
|
+
Utils.isBearerTokenAuth(auths[0].authScheme)) {
|
|
251
|
+
return false;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
return true;
|
|
256
|
+
}
|
|
238
257
|
static getAuthArray(securities, spec) {
|
|
239
258
|
var _a;
|
|
240
259
|
const result = [];
|
|
@@ -729,6 +748,9 @@ class Validator {
|
|
|
729
748
|
reason: [ErrorType.MultipleAuthNotSupported],
|
|
730
749
|
};
|
|
731
750
|
}
|
|
751
|
+
if (this.projectType === ProjectType.Copilot) {
|
|
752
|
+
return { isValid: true, reason: [] };
|
|
753
|
+
}
|
|
732
754
|
for (const auths of authSchemeArray) {
|
|
733
755
|
if (auths.length === 1) {
|
|
734
756
|
if ((this.options.allowAPIKeyAuth && Utils.isAPIKeyAuth(auths[0].authScheme)) ||
|