@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.esm2017.js
CHANGED
|
@@ -53,6 +53,7 @@ var WarningType;
|
|
|
53
53
|
WarningType["ConvertSwaggerToOpenAPI"] = "convert-swagger-to-openapi";
|
|
54
54
|
WarningType["FuncDescriptionTooLong"] = "function-description-too-long";
|
|
55
55
|
WarningType["OperationIdContainsSpecialCharacters"] = "operationid-contains-special-characters";
|
|
56
|
+
WarningType["UnsupportedAuthType"] = "unsupported-auth-type";
|
|
56
57
|
WarningType["GenerateJsonDataFailed"] = "generate-json-data-failed";
|
|
57
58
|
WarningType["Unknown"] = "unknown";
|
|
58
59
|
})(WarningType || (WarningType = {}));
|
|
@@ -100,6 +101,7 @@ ConstantString.SwaggerNotSupported = "Swagger 2.0 is not supported. Please conve
|
|
|
100
101
|
ConstantString.SpecVersionNotSupported = "Unsupported OpenAPI version %s. Please use version 3.0.x.";
|
|
101
102
|
ConstantString.MultipleAuthNotSupported = "Multiple authentication methods are unsupported. Ensure all selected APIs use identical authentication.";
|
|
102
103
|
ConstantString.OperationIdContainsSpecialCharacters = "Operation id '%s' in OpenAPI description document contained special characters and was renamed to '%s'.";
|
|
104
|
+
ConstantString.AuthTypeIsNotSupported = "Unsupported authorization type in API '%s'. No authorization will be used.";
|
|
103
105
|
ConstantString.UnsupportedSchema = "Unsupported schema in %s %s: %s";
|
|
104
106
|
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.";
|
|
105
107
|
ConstantString.GenerateJsonDataFailed = "Failed to generate JSON data for api: %s due to %s.";
|
|
@@ -205,6 +207,23 @@ class Utils {
|
|
|
205
207
|
authScheme.flows &&
|
|
206
208
|
authScheme.flows.authorizationCode);
|
|
207
209
|
}
|
|
210
|
+
static isNotSupportedAuth(authSchemeArray) {
|
|
211
|
+
if (authSchemeArray.length === 0) {
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
214
|
+
if (authSchemeArray.length > 0 && authSchemeArray.every((auths) => auths.length > 1)) {
|
|
215
|
+
return true;
|
|
216
|
+
}
|
|
217
|
+
for (const auths of authSchemeArray) {
|
|
218
|
+
if (auths.length === 1) {
|
|
219
|
+
if (Utils.isOAuthWithAuthCodeFlow(auths[0].authScheme) ||
|
|
220
|
+
Utils.isBearerTokenAuth(auths[0].authScheme)) {
|
|
221
|
+
return false;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
return true;
|
|
226
|
+
}
|
|
208
227
|
static getAuthArray(securities, spec) {
|
|
209
228
|
var _a;
|
|
210
229
|
const result = [];
|
|
@@ -699,6 +718,9 @@ class Validator {
|
|
|
699
718
|
reason: [ErrorType.MultipleAuthNotSupported],
|
|
700
719
|
};
|
|
701
720
|
}
|
|
721
|
+
if (this.projectType === ProjectType.Copilot) {
|
|
722
|
+
return { isValid: true, reason: [] };
|
|
723
|
+
}
|
|
702
724
|
for (const auths of authSchemeArray) {
|
|
703
725
|
if (auths.length === 1) {
|
|
704
726
|
if ((this.options.allowAPIKeyAuth && Utils.isAPIKeyAuth(auths[0].authScheme)) ||
|