@microsoft/m365-spec-parser 0.2.1-beta.2024052708.0 → 0.2.1
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 +0 -45
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm2017.mjs +2 -54
- package/dist/index.esm2017.mjs.map +1 -1
- package/dist/index.esm5.js +0 -45
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +2 -54
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/src/interfaces.d.ts +0 -1
- package/package.json +3 -3
package/dist/index.esm2017.js
CHANGED
|
@@ -17,7 +17,6 @@ var ErrorType;
|
|
|
17
17
|
ErrorType["SwaggerNotSupported"] = "swagger-not-supported";
|
|
18
18
|
ErrorType["MultipleAuthNotSupported"] = "multiple-auth-not-supported";
|
|
19
19
|
ErrorType["SpecVersionNotSupported"] = "spec-version-not-supported";
|
|
20
|
-
ErrorType["CircularReferenceNotSupported"] = "circular-reference-not-supported";
|
|
21
20
|
ErrorType["ListFailed"] = "list-failed";
|
|
22
21
|
ErrorType["listSupportedAPIInfoFailed"] = "list-supported-api-info-failed";
|
|
23
22
|
ErrorType["FilterSpecFailed"] = "filter-spec-failed";
|
|
@@ -533,19 +532,6 @@ class Utils {
|
|
|
533
532
|
|
|
534
533
|
// Copyright (c) Microsoft Corporation.
|
|
535
534
|
class Validator {
|
|
536
|
-
constructor() {
|
|
537
|
-
this.hasCircularReference = false;
|
|
538
|
-
}
|
|
539
|
-
checkCircularReference() {
|
|
540
|
-
try {
|
|
541
|
-
JSON.stringify(this.spec);
|
|
542
|
-
}
|
|
543
|
-
catch (e) {
|
|
544
|
-
if (e.message.includes("Converting circular structure to JSON")) {
|
|
545
|
-
this.hasCircularReference = true;
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
535
|
listAPIs() {
|
|
550
536
|
var _a;
|
|
551
537
|
if (this.apiMap) {
|
|
@@ -641,22 +627,6 @@ class Validator {
|
|
|
641
627
|
}
|
|
642
628
|
return result;
|
|
643
629
|
}
|
|
644
|
-
validateCircularReference(method, path) {
|
|
645
|
-
const result = { isValid: true, reason: [] };
|
|
646
|
-
if (this.hasCircularReference) {
|
|
647
|
-
const operationObject = this.spec.paths[path][method];
|
|
648
|
-
try {
|
|
649
|
-
JSON.stringify(operationObject);
|
|
650
|
-
}
|
|
651
|
-
catch (e) {
|
|
652
|
-
if (e.message.includes("Converting circular structure to JSON")) {
|
|
653
|
-
result.isValid = false;
|
|
654
|
-
result.reason.push(ErrorType.CircularReferenceNotSupported);
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
return result;
|
|
659
|
-
}
|
|
660
630
|
validateResponse(method, path) {
|
|
661
631
|
const result = { isValid: true, reason: [] };
|
|
662
632
|
const operationObject = this.spec.paths[path][method];
|
|
@@ -845,7 +815,6 @@ class CopilotValidator extends Validator {
|
|
|
845
815
|
this.projectType = ProjectType.Copilot;
|
|
846
816
|
this.options = options;
|
|
847
817
|
this.spec = spec;
|
|
848
|
-
this.checkCircularReference();
|
|
849
818
|
}
|
|
850
819
|
validateSpec() {
|
|
851
820
|
const result = { errors: [], warnings: [] };
|
|
@@ -871,10 +840,6 @@ class CopilotValidator extends Validator {
|
|
|
871
840
|
if (!methodAndPathResult.isValid) {
|
|
872
841
|
return methodAndPathResult;
|
|
873
842
|
}
|
|
874
|
-
const circularReferenceResult = this.validateCircularReference(method, path);
|
|
875
|
-
if (!circularReferenceResult.isValid) {
|
|
876
|
-
return circularReferenceResult;
|
|
877
|
-
}
|
|
878
843
|
const operationObject = this.spec.paths[path][method];
|
|
879
844
|
// validate auth
|
|
880
845
|
const authCheckResult = this.validateAuth(method, path);
|
|
@@ -918,7 +883,6 @@ class SMEValidator extends Validator {
|
|
|
918
883
|
this.projectType = ProjectType.SME;
|
|
919
884
|
this.options = options;
|
|
920
885
|
this.spec = spec;
|
|
921
|
-
this.checkCircularReference();
|
|
922
886
|
}
|
|
923
887
|
validateSpec() {
|
|
924
888
|
const result = { errors: [], warnings: [] };
|
|
@@ -946,10 +910,6 @@ class SMEValidator extends Validator {
|
|
|
946
910
|
if (!methodAndPathResult.isValid) {
|
|
947
911
|
return methodAndPathResult;
|
|
948
912
|
}
|
|
949
|
-
const circularReferenceResult = this.validateCircularReference(method, path);
|
|
950
|
-
if (!circularReferenceResult.isValid) {
|
|
951
|
-
return circularReferenceResult;
|
|
952
|
-
}
|
|
953
913
|
const operationObject = this.spec.paths[path][method];
|
|
954
914
|
// validate auth
|
|
955
915
|
const authCheckResult = this.validateAuth(method, path);
|
|
@@ -1020,7 +980,6 @@ class TeamsAIValidator extends Validator {
|
|
|
1020
980
|
this.projectType = ProjectType.TeamsAi;
|
|
1021
981
|
this.options = options;
|
|
1022
982
|
this.spec = spec;
|
|
1023
|
-
this.checkCircularReference();
|
|
1024
983
|
}
|
|
1025
984
|
validateSpec() {
|
|
1026
985
|
const result = { errors: [], warnings: [] };
|
|
@@ -1040,10 +999,6 @@ class TeamsAIValidator extends Validator {
|
|
|
1040
999
|
if (!methodAndPathResult.isValid) {
|
|
1041
1000
|
return methodAndPathResult;
|
|
1042
1001
|
}
|
|
1043
|
-
const circularReferenceResult = this.validateCircularReference(method, path);
|
|
1044
|
-
if (!circularReferenceResult.isValid) {
|
|
1045
|
-
return circularReferenceResult;
|
|
1046
|
-
}
|
|
1047
1002
|
const operationObject = this.spec.paths[path][method];
|
|
1048
1003
|
// validate operationId
|
|
1049
1004
|
if (!this.options.allowMissingId && !operationObject.operationId) {
|