@microsoft/typespec-msgraph 0.0.1-Preview.12 → 0.0.1-Preview.14
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/src/components/annotations.d.ts.map +1 -1
- package/dist/src/components/annotations.js +24 -3
- package/dist/src/components/annotations.js.map +1 -1
- package/dist/src/components/entity-container-element.d.ts.map +1 -1
- package/dist/src/components/entity-container-element.js +13 -6
- package/dist/src/components/entity-container-element.js.map +1 -1
- package/dist/src/components/operation-element.d.ts.map +1 -1
- package/dist/src/components/operation-element.js +15 -4
- package/dist/src/components/operation-element.js.map +1 -1
- package/dist/src/components/property-element.js +1 -1
- package/dist/src/components/property-element.js.map +1 -1
- package/dist/src/components/reference-target-element.d.ts +9 -0
- package/dist/src/components/reference-target-element.d.ts.map +1 -0
- package/dist/src/components/reference-target-element.js +3 -0
- package/dist/src/components/reference-target-element.js.map +1 -0
- package/dist/src/components/revisions-annotation.d.ts.map +1 -1
- package/dist/src/components/revisions-annotation.js +2 -1
- package/dist/src/components/revisions-annotation.js.map +1 -1
- package/dist/src/components/schema-element.d.ts.map +1 -1
- package/dist/src/components/schema-element.js +5 -3
- package/dist/src/components/schema-element.js.map +1 -1
- package/dist/src/components/select-supported-annotation.d.ts +5 -0
- package/dist/src/components/select-supported-annotation.d.ts.map +1 -0
- package/dist/src/components/select-supported-annotation.js +6 -0
- package/dist/src/components/select-supported-annotation.js.map +1 -0
- package/dist/src/components/term-element.d.ts +9 -0
- package/dist/src/components/term-element.d.ts.map +1 -0
- package/dist/src/components/term-element.js +8 -0
- package/dist/src/components/term-element.js.map +1 -0
- package/dist/src/decorators/address-url.d.ts +16 -0
- package/dist/src/decorators/address-url.d.ts.map +1 -0
- package/dist/src/decorators/address-url.js +19 -0
- package/dist/src/decorators/address-url.js.map +1 -0
- package/dist/src/decorators/ags-attribute.d.ts +2 -1
- package/dist/src/decorators/ags-attribute.d.ts.map +1 -1
- package/dist/src/decorators/ags-attribute.js +34 -1
- package/dist/src/decorators/ags-attribute.js.map +1 -1
- package/dist/src/decorators/global-operation.d.ts +9 -0
- package/dist/src/decorators/global-operation.d.ts.map +1 -0
- package/dist/src/decorators/global-operation.js +13 -0
- package/dist/src/decorators/global-operation.js.map +1 -0
- package/dist/src/decorators/graph-deprecated.d.ts +11 -0
- package/dist/src/decorators/graph-deprecated.d.ts.map +1 -0
- package/dist/src/decorators/graph-deprecated.js +19 -0
- package/dist/src/decorators/graph-deprecated.js.map +1 -0
- package/dist/src/decorators/index.d.ts +7 -0
- package/dist/src/decorators/index.d.ts.map +1 -1
- package/dist/src/decorators/index.js +7 -0
- package/dist/src/decorators/index.js.map +1 -1
- package/dist/src/decorators/is-owner.js +1 -1
- package/dist/src/decorators/ownerless.d.ts +8 -0
- package/dist/src/decorators/ownerless.d.ts.map +1 -0
- package/dist/src/decorators/ownerless.js +12 -0
- package/dist/src/decorators/ownerless.js.map +1 -0
- package/dist/src/decorators/public-namespace.d.ts.map +1 -1
- package/dist/src/decorators/public-namespace.js +4 -1
- package/dist/src/decorators/public-namespace.js.map +1 -1
- package/dist/src/decorators/reference-target.d.ts +16 -0
- package/dist/src/decorators/reference-target.d.ts.map +1 -0
- package/dist/src/decorators/reference-target.js +52 -0
- package/dist/src/decorators/reference-target.js.map +1 -0
- package/dist/src/decorators/select.d.ts +9 -0
- package/dist/src/decorators/select.d.ts.map +1 -0
- package/dist/src/decorators/select.js +13 -0
- package/dist/src/decorators/select.js.map +1 -0
- package/dist/src/decorators/term.d.ts +13 -0
- package/dist/src/decorators/term.d.ts.map +1 -0
- package/dist/src/decorators/term.js +14 -0
- package/dist/src/decorators/term.js.map +1 -0
- package/dist/src/entities/address-url.d.ts +4 -0
- package/dist/src/entities/address-url.d.ts.map +1 -0
- package/dist/src/entities/address-url.js +18 -0
- package/dist/src/entities/address-url.js.map +1 -0
- package/dist/src/entities/annotations.d.ts +6 -0
- package/dist/src/entities/annotations.d.ts.map +1 -1
- package/dist/src/entities/annotations.js +25 -1
- package/dist/src/entities/annotations.js.map +1 -1
- package/dist/src/entities/entity-container.d.ts +10 -0
- package/dist/src/entities/entity-container.d.ts.map +1 -1
- package/dist/src/entities/entity-container.js +3 -0
- package/dist/src/entities/entity-container.js.map +1 -1
- package/dist/src/entities/enum.js.map +1 -1
- package/dist/src/entities/model.d.ts +2 -0
- package/dist/src/entities/model.d.ts.map +1 -1
- package/dist/src/entities/model.js +66 -5
- package/dist/src/entities/model.js.map +1 -1
- package/dist/src/entities/ms-graph-route.d.ts +13 -0
- package/dist/src/entities/ms-graph-route.d.ts.map +1 -0
- package/dist/src/entities/ms-graph-route.js +70 -0
- package/dist/src/entities/ms-graph-route.js.map +1 -0
- package/dist/src/entities/namespace.d.ts +6 -1
- package/dist/src/entities/namespace.d.ts.map +1 -1
- package/dist/src/entities/namespace.js +107 -11
- package/dist/src/entities/namespace.js.map +1 -1
- package/dist/src/entities/operation.d.ts +4 -0
- package/dist/src/entities/operation.d.ts.map +1 -1
- package/dist/src/entities/operation.js +28 -8
- package/dist/src/entities/operation.js.map +1 -1
- package/dist/src/entities/revision-definition.d.ts +1 -0
- package/dist/src/entities/revision-definition.d.ts.map +1 -1
- package/dist/src/entities/revision-definition.js +3 -3
- package/dist/src/entities/revision-definition.js.map +1 -1
- package/dist/src/entities/term.d.ts +8 -0
- package/dist/src/entities/term.d.ts.map +1 -0
- package/dist/src/entities/term.js +14 -0
- package/dist/src/entities/term.js.map +1 -0
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/lib.d.ts +69 -146
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/lib.js +24 -10
- package/dist/src/lib.js.map +1 -1
- package/dist/src/rules/address-url.d.ts +6 -0
- package/dist/src/rules/address-url.d.ts.map +1 -0
- package/dist/src/rules/address-url.js +40 -0
- package/dist/src/rules/address-url.js.map +1 -0
- package/dist/src/rules/allowed-values.d.ts +2 -1
- package/dist/src/rules/allowed-values.d.ts.map +1 -1
- package/dist/src/rules/allowed-values.js +7 -7
- package/dist/src/rules/allowed-values.js.map +1 -1
- package/dist/src/rules/alternate-key.d.ts +4 -3
- package/dist/src/rules/alternate-key.d.ts.map +1 -1
- package/dist/src/rules/alternate-key.js +23 -23
- package/dist/src/rules/alternate-key.js.map +1 -1
- package/dist/src/rules/collection-navigation-properties-not-nullable.d.ts +2 -1
- package/dist/src/rules/collection-navigation-properties-not-nullable.d.ts.map +1 -1
- package/dist/src/rules/collection-navigation-properties-not-nullable.js +9 -9
- package/dist/src/rules/collection-navigation-properties-not-nullable.js.map +1 -1
- package/dist/src/rules/computed.d.ts +2 -1
- package/dist/src/rules/computed.d.ts.map +1 -1
- package/dist/src/rules/computed.js +9 -8
- package/dist/src/rules/computed.js.map +1 -1
- package/dist/src/rules/contains.d.ts +2 -1
- package/dist/src/rules/contains.d.ts.map +1 -1
- package/dist/src/rules/contains.js +9 -8
- package/dist/src/rules/contains.js.map +1 -1
- package/dist/src/rules/count.d.ts +2 -1
- package/dist/src/rules/count.d.ts.map +1 -1
- package/dist/src/rules/count.js +9 -8
- package/dist/src/rules/count.js.map +1 -1
- package/dist/src/rules/disallowed-typespec-decorators.d.ts +2 -1
- package/dist/src/rules/disallowed-typespec-decorators.d.ts.map +1 -1
- package/dist/src/rules/disallowed-typespec-decorators.js +29 -25
- package/dist/src/rules/disallowed-typespec-decorators.js.map +1 -1
- package/dist/src/rules/entity.d.ts +5 -2
- package/dist/src/rules/entity.d.ts.map +1 -1
- package/dist/src/rules/entity.js +102 -19
- package/dist/src/rules/entity.js.map +1 -1
- package/dist/src/rules/enum.d.ts +3 -1
- package/dist/src/rules/enum.d.ts.map +1 -1
- package/dist/src/rules/enum.js +9 -6
- package/dist/src/rules/enum.js.map +1 -1
- package/dist/src/rules/expand.d.ts +3 -2
- package/dist/src/rules/expand.d.ts.map +1 -1
- package/dist/src/rules/expand.js +16 -16
- package/dist/src/rules/expand.js.map +1 -1
- package/dist/src/rules/extends-on-same-type.d.ts +2 -1
- package/dist/src/rules/extends-on-same-type.d.ts.map +1 -1
- package/dist/src/rules/extends-on-same-type.js +9 -8
- package/dist/src/rules/extends-on-same-type.js.map +1 -1
- package/dist/src/rules/filter.d.ts +4 -3
- package/dist/src/rules/filter.d.ts.map +1 -1
- package/dist/src/rules/filter.js +23 -23
- package/dist/src/rules/filter.js.map +1 -1
- package/dist/src/rules/function.d.ts +2 -1
- package/dist/src/rules/function.d.ts.map +1 -1
- package/dist/src/rules/function.js +9 -9
- package/dist/src/rules/function.js.map +1 -1
- package/dist/src/rules/global-operation.d.ts +4 -0
- package/dist/src/rules/global-operation.d.ts.map +1 -0
- package/dist/src/rules/global-operation.js +60 -0
- package/dist/src/rules/global-operation.js.map +1 -0
- package/dist/src/rules/graph-deprecated.d.ts +8 -0
- package/dist/src/rules/graph-deprecated.d.ts.map +1 -0
- package/dist/src/rules/graph-deprecated.js +152 -0
- package/dist/src/rules/graph-deprecated.js.map +1 -0
- package/dist/src/rules/graph-route.d.ts +8 -2
- package/dist/src/rules/graph-route.d.ts.map +1 -1
- package/dist/src/rules/graph-route.js +80 -16
- package/dist/src/rules/graph-route.js.map +1 -1
- package/dist/src/rules/has-stream.d.ts +2 -1
- package/dist/src/rules/has-stream.d.ts.map +1 -1
- package/dist/src/rules/has-stream.js +9 -8
- package/dist/src/rules/has-stream.js.map +1 -1
- package/dist/src/rules/index.d.ts +5 -0
- package/dist/src/rules/index.d.ts.map +1 -1
- package/dist/src/rules/index.js +5 -0
- package/dist/src/rules/index.js.map +1 -1
- package/dist/src/rules/namespace.d.ts +4 -3
- package/dist/src/rules/namespace.d.ts.map +1 -1
- package/dist/src/rules/namespace.js +58 -73
- package/dist/src/rules/namespace.js.map +1 -1
- package/dist/src/rules/open.d.ts +2 -1
- package/dist/src/rules/open.d.ts.map +1 -1
- package/dist/src/rules/open.js +9 -8
- package/dist/src/rules/open.js.map +1 -1
- package/dist/src/rules/operation-inside-interface.d.ts +2 -1
- package/dist/src/rules/operation-inside-interface.d.ts.map +1 -1
- package/dist/src/rules/operation-inside-interface.js +9 -8
- package/dist/src/rules/operation-inside-interface.js.map +1 -1
- package/dist/src/rules/order-by.d.ts +3 -2
- package/dist/src/rules/order-by.d.ts.map +1 -1
- package/dist/src/rules/order-by.js +16 -16
- package/dist/src/rules/order-by.js.map +1 -1
- package/dist/src/rules/ownerless.d.ts +10 -0
- package/dist/src/rules/ownerless.d.ts.map +1 -0
- package/dist/src/rules/ownerless.js +155 -0
- package/dist/src/rules/ownerless.js.map +1 -0
- package/dist/src/rules/partial.d.ts +2 -1
- package/dist/src/rules/partial.d.ts.map +1 -1
- package/dist/src/rules/partial.js +9 -8
- package/dist/src/rules/partial.js.map +1 -1
- package/dist/src/rules/reference-target.d.ts +8 -0
- package/dist/src/rules/reference-target.d.ts.map +1 -0
- package/dist/src/rules/reference-target.js +119 -0
- package/dist/src/rules/reference-target.js.map +1 -0
- package/dist/src/rules/references.d.ts +2 -1
- package/dist/src/rules/references.d.ts.map +1 -1
- package/dist/src/rules/references.js +9 -8
- package/dist/src/rules/references.js.map +1 -1
- package/dist/src/rules/required-for-create.d.ts +2 -1
- package/dist/src/rules/required-for-create.d.ts.map +1 -1
- package/dist/src/rules/required-for-create.js +9 -8
- package/dist/src/rules/required-for-create.js.map +1 -1
- package/dist/src/rules/search.d.ts +2 -1
- package/dist/src/rules/search.d.ts.map +1 -1
- package/dist/src/rules/search.js +9 -8
- package/dist/src/rules/search.js.map +1 -1
- package/dist/src/rules/skip.d.ts +2 -1
- package/dist/src/rules/skip.d.ts.map +1 -1
- package/dist/src/rules/skip.js +9 -8
- package/dist/src/rules/skip.js.map +1 -1
- package/dist/src/rules/top.d.ts +2 -1
- package/dist/src/rules/top.d.ts.map +1 -1
- package/dist/src/rules/top.js +9 -8
- package/dist/src/rules/top.js.map +1 -1
- package/dist/src/testing/index.d.ts +1 -0
- package/dist/src/testing/index.d.ts.map +1 -1
- package/dist/src/testing/index.js +21 -0
- package/dist/src/testing/index.js.map +1 -1
- package/dist/src/utils.d.ts +19 -1
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +44 -21
- package/dist/src/utils.js.map +1 -1
- package/dist/src/{linter.d.ts → validate.d.ts} +1 -1
- package/dist/src/validate.d.ts.map +1 -0
- package/dist/src/validate.js +56 -0
- package/dist/src/validate.js.map +1 -0
- package/lib/decorators.tsp +114 -17
- package/lib/porcelain.tsp +18 -7
- package/lib/responses.tsp +32 -7
- package/lib/shared-models.tsp +0 -50
- package/package.json +5 -7
- package/dist/src/linter.d.ts.map +0 -1
- package/dist/src/linter.js +0 -44
- package/dist/src/linter.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enum.js","sourceRoot":"","sources":["../../../src/rules/enum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"enum.js","sourceRoot":"","sources":["../../../src/rules/enum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,CAAC,MAAM,oBAAoB,GAAG,UAAU,CAAC;IAC7C,IAAI,EAAE,oBAAoB;IAC1B,QAAQ,EAAE,SAAS;IACnB,WAAW,EAAE,yBAAyB;IACtC,QAAQ,EAAE;QACR,OAAO,EAAE,YAAY,CAAA,gBAAgB,MAAM,2EAA2E;KACvH;IACD,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,IAAI,EAAE,CAAC,QAAQ,EAAE,EAAE;gBACjB,IAAI,kBAAkB,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE;oBACjD,OAAO;iBACR;gBAED,IAAI,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,EAAE;oBAC9C,OAAO;iBACR;gBAED,OAAO,CAAC,gBAAgB,CAAC;oBACvB,MAAM,EAAE,QAAQ;oBAChB,MAAM,EAAE;wBACN,IAAI,EAAE,QAAQ,CAAC,IAAI;qBACpB;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export declare
|
|
1
|
+
import { Program } from "@typespec/compiler";
|
|
2
|
+
export declare function validateExpandOnlyOnGetNavigationSource(program: Program): void;
|
|
3
|
+
export declare function validateExpandOnlyNavigationProperties(program: Program): void;
|
|
3
4
|
//# sourceMappingURL=expand.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expand.d.ts","sourceRoot":"","sources":["../../../src/rules/expand.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"expand.d.ts","sourceRoot":"","sources":["../../../src/rules/expand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,OAAO,EAAqD,MAAM,oBAAoB,CAAC;AAOvG,wBAAgB,uCAAuC,CAAC,OAAO,EAAE,OAAO,QA0BvE;AAED,wBAAgB,sCAAsC,CAAC,OAAO,EAAE,OAAO,QAuCtE"}
|
package/dist/src/rules/expand.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { walkPropertiesInherited } from "@typespec/compiler";
|
|
2
|
-
import { createRule } from "@typespec/lint";
|
|
1
|
+
import { navigateTypesInNamespace, walkPropertiesInherited } from "@typespec/compiler";
|
|
3
2
|
import { getOperationVerb } from "@typespec/http";
|
|
4
3
|
import { getExpand, isContains, isExpand, isReferences } from "../index.js";
|
|
5
4
|
import { reportDiagnostic } from "../lib.js";
|
|
6
5
|
import { getNavigationSourceType } from "../utils.js";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
import { GetDeclaredNamespaces } from "../entities/namespace.js";
|
|
7
|
+
export function validateExpandOnlyOnGetNavigationSource(program) {
|
|
8
|
+
for (const namespace of GetDeclaredNamespaces(program)) {
|
|
9
|
+
navigateTypesInNamespace(namespace, {
|
|
11
10
|
operation: (operation) => {
|
|
12
11
|
if (!isExpand(program, operation)) {
|
|
13
12
|
return;
|
|
@@ -27,13 +26,13 @@ export const expandOnlyOnGetNavigationSourceRule = createRule({
|
|
|
27
26
|
},
|
|
28
27
|
});
|
|
29
28
|
},
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
;
|
|
33
|
+
export function validateExpandOnlyNavigationProperties(program) {
|
|
34
|
+
for (const namespace of GetDeclaredNamespaces(program)) {
|
|
35
|
+
navigateTypesInNamespace(namespace, {
|
|
37
36
|
operation: (operation) => {
|
|
38
37
|
const expanded = getExpand(program, operation);
|
|
39
38
|
if (!expanded.length) {
|
|
@@ -61,7 +60,8 @@ export const expandOnlyNavigationPropertiesRule = createRule({
|
|
|
61
60
|
},
|
|
62
61
|
});
|
|
63
62
|
},
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
;
|
|
67
67
|
//# sourceMappingURL=expand.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expand.js","sourceRoot":"","sources":["../../../src/rules/expand.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"expand.js","sourceRoot":"","sources":["../../../src/rules/expand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AACvG,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC5E,O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C,UAAU,EAAE;oBACf,OAAO;iBACR;gBAED,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC,CAAE,UAAU,CAAC,OAAO,CAAC,KAAe,CAAC,CAAC,CAAC,UAAU,CAAC;gBACxF,MAAM,oBAAoB,GAAG,CAAC,GAAG,uBAAuB,CAAC,SAAS,CAAC,CAAC;qBACjE,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;qBACtF,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;gBAEpC,MAAM,iBAAiB,GAAG,QAAQ,CAAC,MAAM,CACvC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,oBAAoB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CACvD,CAAC;gBAEF,IAAI,CAAC,iBAAiB,CAAC,MAAM,EAAE;oBAC7B,OAAO;iBACR;gBAED,gBAAgB,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,uBAAuB;oBAC7B,MAAM,EAAE,SAAS;oBACjB,SAAS,EAAE,kBAAkB;oBAC7B,MAAM,EAAE;wBACN,KAAK,EAAE,SAAS,CAAC,IAAI;wBACrB,UAAU,EAAE,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC;qBACzC;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC,CAAC;KACJ;AACH,CAAC;AAAA,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extends-on-same-type.d.ts","sourceRoot":"","sources":["../../../src/rules/extends-on-same-type.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"extends-on-same-type.d.ts","sourceRoot":"","sources":["../../../src/rules/extends-on-same-type.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAA4B,MAAM,oBAAoB,CAAC;AAGvE,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,QAkCzD"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { createRule } from "@typespec/lint";
|
|
2
1
|
import { reportDiagnostic } from "../lib.js";
|
|
3
2
|
import { isComplex, isEntity } from "../index.js";
|
|
4
3
|
import { isExcludedCoreType } from "../utils.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
import { navigateTypesInNamespace } from "@typespec/compiler";
|
|
5
|
+
import { GetDeclaredNamespaces } from "../entities/namespace.js";
|
|
6
|
+
export function validateExtendsOnSameType(program) {
|
|
7
|
+
for (const namespace of GetDeclaredNamespaces(program)) {
|
|
8
|
+
navigateTypesInNamespace(namespace, {
|
|
9
9
|
model: (model) => {
|
|
10
10
|
if (!model.baseModel) {
|
|
11
11
|
return;
|
|
@@ -32,7 +32,8 @@ export const extendsOnSameTypeRule = createRule({
|
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
;
|
|
38
39
|
//# sourceMappingURL=extends-on-same-type.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extends-on-same-type.js","sourceRoot":"","sources":["../../../src/rules/extends-on-same-type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"extends-on-same-type.js","sourceRoot":"","sources":["../../../src/rules/extends-on-same-type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAW,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,MAAM,UAAU,yBAAyB,CAAC,OAAgB;IACxD,KAAK,MAAM,SAAS,IAAI,qBAAqB,CAAC,OAAO,CAAC,EAAE;QACtD,wBAAwB,CAAC,SAAS,EAAE;YAClC,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;gBACf,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE;oBACpB,OAAO;iBACR;gBAED,IAAI,kBAAkB,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE;oBACtC,OAAO;iBACR;gBAED,IAAI,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,EAAE;oBACnE,gBAAgB,CAAC,OAAO,EAAE;wBACxB,IAAI,EAAE,qBAAqB;wBAC3B,MAAM,EAAE,KAAK;wBACb,MAAM,EAAE;4BACN,IAAI,EAAE,SAAS;yBAChB;qBACF,CAAC,CAAC;iBACJ;gBAED,IAAI,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,EAAE;oBACrE,gBAAgB,CAAC,OAAO,EAAE;wBACxB,IAAI,EAAE,qBAAqB;wBAC3B,MAAM,EAAE,KAAK;wBACb,MAAM,EAAE;4BACN,IAAI,EAAE,UAAU;yBACjB;qBACF,CAAC,CAAC;iBACJ;YACH,CAAC;SACF,CAAC,CAAC;KACJ;AACH,CAAC;AAAA,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
export declare
|
|
3
|
-
export declare
|
|
1
|
+
import { Program } from "@typespec/compiler";
|
|
2
|
+
export declare function validateFilterAppliesToGetOperationsThatReturnCollections(program: Program): void;
|
|
3
|
+
export declare function validateFilterOnlyAppliesToModelProperties(program: Program): void;
|
|
4
|
+
export declare function validateFilterPropertiesMustNotBeEmpty(program: Program): void;
|
|
4
5
|
//# sourceMappingURL=filter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../../src/rules/filter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../../src/rules/filter.ts"],"names":[],"mappings":"AAIA,OAAO,EAAS,OAAO,EAAqD,MAAM,oBAAoB,CAAC;AAGvG,wBAAgB,yDAAyD,CAAC,OAAO,EAAE,OAAO,QA4BzF;AAED,wBAAgB,0CAA0C,CAAC,OAAO,EAAE,OAAO,QAsC1E;AAED,wBAAgB,sCAAsC,CAAC,OAAO,EAAE,OAAO,QAyBtE"}
|
package/dist/src/rules/filter.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { createRule } from "@typespec/lint";
|
|
2
1
|
import { getFilter, isFilter } from "../index.js";
|
|
3
2
|
import { getOperationVerb } from "@typespec/http";
|
|
4
3
|
import { getNavigationSourceType, isTypeCollection } from "../utils.js";
|
|
5
4
|
import { reportDiagnostic } from "../lib.js";
|
|
6
|
-
import { walkPropertiesInherited } from "@typespec/compiler";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
import { navigateTypesInNamespace, walkPropertiesInherited } from "@typespec/compiler";
|
|
6
|
+
import { GetDeclaredNamespaces } from "../entities/namespace.js";
|
|
7
|
+
export function validateFilterAppliesToGetOperationsThatReturnCollections(program) {
|
|
8
|
+
for (const namespace of GetDeclaredNamespaces(program)) {
|
|
9
|
+
navigateTypesInNamespace(namespace, {
|
|
11
10
|
operation: (operation) => {
|
|
12
11
|
if (!isFilter(program, operation)) {
|
|
13
12
|
return;
|
|
@@ -29,13 +28,13 @@ export const filterAppliesToGetOperationsThatReturnCollectionsRule = createRule(
|
|
|
29
28
|
},
|
|
30
29
|
});
|
|
31
30
|
},
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
;
|
|
35
|
+
export function validateFilterOnlyAppliesToModelProperties(program) {
|
|
36
|
+
for (const namespace of GetDeclaredNamespaces(program)) {
|
|
37
|
+
navigateTypesInNamespace(namespace, {
|
|
39
38
|
operation: (operation) => {
|
|
40
39
|
if (!isFilter(program, operation)) {
|
|
41
40
|
return;
|
|
@@ -61,13 +60,13 @@ export const filterOnlyAppliesToModelPropertiesRule = createRule({
|
|
|
61
60
|
},
|
|
62
61
|
});
|
|
63
62
|
},
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
;
|
|
67
|
+
export function validateFilterPropertiesMustNotBeEmpty(program) {
|
|
68
|
+
for (const namespace of GetDeclaredNamespaces(program)) {
|
|
69
|
+
navigateTypesInNamespace(namespace, {
|
|
71
70
|
operation: (operation) => {
|
|
72
71
|
if (!isFilter(program, operation)) {
|
|
73
72
|
return;
|
|
@@ -86,7 +85,8 @@ export const filterPropertiesMustNotBeEmptyRule = createRule({
|
|
|
86
85
|
},
|
|
87
86
|
});
|
|
88
87
|
},
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
}
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
;
|
|
92
92
|
//# sourceMappingURL=filter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.js","sourceRoot":"","sources":["../../../src/rules/filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"filter.js","sourceRoot":"","sources":["../../../src/rules/filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,E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AAI,CAAC,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE;oBACjC,OAAO;iBACR;gBAED,MAAM,gBAAgB,GAAG,SAAS,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;gBACvD,IAAI,gBAAgB,CAAC,MAAM,EAAE;oBAC3B,OAAO;iBACR;gBAED,gBAAgB,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,uBAAuB;oBAC7B,MAAM,EAAE,SAAS;oBACjB,SAAS,EAAE,UAAU;oBACrB,MAAM,EAAE;wBACN,SAAS,EAAE,SAAS;wBACpB,UAAU,EAAE,mBAAmB;qBAChC;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC,CAAC;KACJ;AACH,CAAC;AAAA,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../../../src/rules/function.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../../../src/rules/function.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAwC,MAAM,oBAAoB,CAAC;AAKnF,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,QAqBpD"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { isVoidType } from "@typespec/compiler";
|
|
2
|
-
import { createRule } from "@typespec/lint";
|
|
1
|
+
import { isVoidType, navigateTypesInNamespace } from "@typespec/compiler";
|
|
3
2
|
import { isFunction } from "../index.js";
|
|
4
3
|
import { reportDiagnostic } from "../lib.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
import { GetDeclaredNamespaces } from "../entities/namespace.js";
|
|
5
|
+
export function validateVoidFunction(program) {
|
|
6
|
+
for (const namespace of GetDeclaredNamespaces(program)) {
|
|
7
|
+
navigateTypesInNamespace(namespace, {
|
|
9
8
|
operation: (operation) => {
|
|
10
9
|
if (!isFunction(program, operation)) {
|
|
11
10
|
return;
|
|
@@ -20,7 +19,8 @@ export const voidFunctionRule = createRule({
|
|
|
20
19
|
format: {},
|
|
21
20
|
});
|
|
22
21
|
},
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
;
|
|
26
26
|
//# sourceMappingURL=function.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"function.js","sourceRoot":"","sources":["../../../src/rules/function.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"function.js","sourceRoot":"","sources":["../../../src/rules/function.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,UAAU,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,MAAM,UAAU,oBAAoB,CAAC,OAAgB;IACnD,KAAK,MAAM,SAAS,IAAI,qBAAqB,CAAC,OAAO,CAAC,EAAE;QACtD,wBAAwB,CAAC,SAAS,EAAE;YAClC,SAAS,EAAE,CAAC,SAAS,EAAE,EAAE;gBACvB,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE;oBACnC,OAAO;iBACR;gBAED,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE;oBACrC,OAAO;iBACR;gBAED,gBAAgB,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,gCAAgC;oBACtC,MAAM,EAAE,SAAS;oBACjB,SAAS,EAAE,UAAU;oBACrB,MAAM,EAAE,EAAE;iBACX,CAAC,CAAC;YACL,CAAC;SACF,CAAC,CAAC;KACJ;AACH,CAAC;AAAA,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Program } from "@typespec/compiler";
|
|
2
|
+
export declare function validateGlobalOperationMustBeUsedWithNonRoutedInterface(program: Program): void;
|
|
3
|
+
export declare function validateGlobalOperationMustBeUsedWithProjectBindingType(program: Program): void;
|
|
4
|
+
//# sourceMappingURL=global-operation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global-operation.d.ts","sourceRoot":"","sources":["../../../src/rules/global-operation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,OAAO,EAAgD,MAAM,oBAAoB,CAAC;AAMtG,wBAAgB,uDAAuD,CAAC,OAAO,EAAE,OAAO,QAmBvF;AAED,wBAAgB,uDAAuD,CAAC,OAAO,EAAE,OAAO,QAuBvF"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { getLocationContext, navigateTypesInNamespace } from "@typespec/compiler";
|
|
2
|
+
import { GetDeclaredNamespaces } from "../entities/namespace.js";
|
|
3
|
+
import { isGlobalOperation, isPartial } from "../index.js";
|
|
4
|
+
import { reportDiagnostic } from "../lib.js";
|
|
5
|
+
import { getInterfaceNavigationSourceType } from "../utils.js";
|
|
6
|
+
export function validateGlobalOperationMustBeUsedWithNonRoutedInterface(program) {
|
|
7
|
+
for (const namespace of GetDeclaredNamespaces(program)) {
|
|
8
|
+
navigateTypesInNamespace(namespace, {
|
|
9
|
+
operation: (operation) => {
|
|
10
|
+
if (!isGlobalOperation(program, operation)) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
if (hasGraphRoutes(program, operation)) {
|
|
14
|
+
reportDiagnostic(program, {
|
|
15
|
+
code: "decorator-invalid-use",
|
|
16
|
+
target: operation,
|
|
17
|
+
messageId: "globalOperationMustBeUsedWithNonRoutedInterface",
|
|
18
|
+
format: {},
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export function validateGlobalOperationMustBeUsedWithProjectBindingType(program) {
|
|
26
|
+
for (const namespace of GetDeclaredNamespaces(program)) {
|
|
27
|
+
navigateTypesInNamespace(namespace, {
|
|
28
|
+
operation: (operation) => {
|
|
29
|
+
if (!isGlobalOperation(program, operation)) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (operation.interface) {
|
|
33
|
+
const interfaceBindingType = getInterfaceNavigationSourceType(program, operation.interface);
|
|
34
|
+
if (interfaceBindingType && (isPartial(program, interfaceBindingType) || getLocationContext(program, interfaceBindingType).type !== "project")) {
|
|
35
|
+
reportDiagnostic(program, {
|
|
36
|
+
code: "decorator-invalid-use",
|
|
37
|
+
target: operation,
|
|
38
|
+
messageId: "globalOperationMustBeUsedWithProjectBindingType",
|
|
39
|
+
format: {},
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function hasGraphRoutes(program, operation) {
|
|
48
|
+
var _a, _b;
|
|
49
|
+
const interfaceDecorators = (_a = operation.interface) === null || _a === void 0 ? void 0 : _a.decorators;
|
|
50
|
+
if (!(interfaceDecorators === null || interfaceDecorators === void 0 ? void 0 : interfaceDecorators.length)) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
for (const decorator of interfaceDecorators) {
|
|
54
|
+
if (((_b = decorator.definition) === null || _b === void 0 ? void 0 : _b.name) === "@graphRoute") {
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=global-operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global-operation.js","sourceRoot":"","sources":["../../../src/rules/global-operation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AACtG,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAA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,CAAC,OAAO,EAAE;4BACxB,IAAI,EAAE,uBAAuB;4BAC7B,MAAM,EAAE,SAAS;4BACjB,SAAS,EAAE,iDAAiD;4BAC5D,MAAM,EAAE,EAAE;yBACX,CAAC,CAAA;qBACH;iBAEF;YACH,CAAC;SACF,CAAC,CAAA;KACH;AACH,CAAC;AAED,SAAS,cAAc,CAAC,OAAgB,EAAE,SAAoB;;IAC5D,MAAM,mBAAmB,GAAG,MAAA,SAAS,CAAC,SAAS,0CAAE,UAAU,CAAC;IAC5D,IAAI,CAAC,CAAA,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAE,MAAM,CAAA,EAAE;QAChC,OAAO,KAAK,CAAC;KACd;IAED,KAAK,MAAM,SAAS,IAAI,mBAAmB,EAAE;QAC3C,IAAI,CAAA,MAAA,SAAS,CAAC,UAAU,0CAAE,IAAI,MAAK,aAAa,EAAE;YAChD,OAAO,IAAI,CAAC;SACb;KACF;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Program } from "@typespec/compiler";
|
|
2
|
+
/***
|
|
3
|
+
* @graphDeprecated can be applied to model, property, enum, enumMember, operation, operationParameter, interface, action, function and namespaces
|
|
4
|
+
|
|
5
|
+
*/
|
|
6
|
+
export declare function validateGraphDeprecatedMustBeAccompaniedByDefinition(program: Program): void;
|
|
7
|
+
export declare function validateGraphDeprecatedValueMustBeDefinedInDeprecatedDefinition(program: Program): void;
|
|
8
|
+
//# sourceMappingURL=graph-deprecated.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-deprecated.d.ts","sourceRoot":"","sources":["../../../src/rules/graph-deprecated.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmH,OAAO,EAAkC,MAAM,oBAAoB,CAAC;AAK9L;;;GAGG;AAEH,wBAAgB,oDAAoD,CAAC,OAAO,EAAE,OAAO,QAgDpF;AAyCD,wBAAgB,+DAA+D,CAAC,OAAO,EAAE,OAAO,QA+C/F"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { reportDiagnostic } from "../lib.js";
|
|
2
|
+
import { getDeprecatedDefinitions, getGraphDeprecated } from "../index.js";
|
|
3
|
+
import { navigateTypesInNamespace } from "@typespec/compiler";
|
|
4
|
+
import { GetDeclaredNamespaces } from "../entities/namespace.js";
|
|
5
|
+
// TODO: Add Unit tests for the rules in this file
|
|
6
|
+
/***
|
|
7
|
+
* @graphDeprecated can be applied to model, property, enum, enumMember, operation, operationParameter, interface, action, function and namespaces
|
|
8
|
+
|
|
9
|
+
*/
|
|
10
|
+
export function validateGraphDeprecatedMustBeAccompaniedByDefinition(program) {
|
|
11
|
+
for (const namespace of GetDeclaredNamespaces(program)) {
|
|
12
|
+
navigateTypesInNamespace(namespace, {
|
|
13
|
+
model: (model) => {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
if (hasGraphDeprecatedDecorator(program, model)) {
|
|
16
|
+
if (!((_b = (_a = model.namespace) === null || _a === void 0 ? void 0 : _a.decorators) === null || _b === void 0 ? void 0 : _b.some(d => hasDeprecatedDefinitionDecorator(d)))) {
|
|
17
|
+
returnDefinitionRuleDiagnostic(program, model);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
modelProperty: (property) => {
|
|
22
|
+
var _a, _b, _c;
|
|
23
|
+
if (hasGraphDeprecatedDecorator(program, property)) {
|
|
24
|
+
if (!((_c = (_b = (_a = property === null || property === void 0 ? void 0 : property.model) === null || _a === void 0 ? void 0 : _a.namespace) === null || _b === void 0 ? void 0 : _b.decorators) === null || _c === void 0 ? void 0 : _c.some(d => hasDeprecatedDefinitionDecorator(d)))) {
|
|
25
|
+
returnDefinitionRuleDiagnostic(program, property);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
enum: (enumModel) => {
|
|
30
|
+
var _a, _b;
|
|
31
|
+
if (hasGraphDeprecatedDecorator(program, enumModel)) {
|
|
32
|
+
if (!((_b = (_a = enumModel.namespace) === null || _a === void 0 ? void 0 : _a.decorators) === null || _b === void 0 ? void 0 : _b.some(d => hasDeprecatedDefinitionDecorator(d)))) {
|
|
33
|
+
returnDefinitionRuleDiagnostic(program, enumModel);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
enumMember: (member) => {
|
|
38
|
+
var _a, _b, _c;
|
|
39
|
+
if (hasGraphDeprecatedDecorator(program, member)) {
|
|
40
|
+
if (!((_c = (_b = (_a = member === null || member === void 0 ? void 0 : member.enum) === null || _a === void 0 ? void 0 : _a.namespace) === null || _b === void 0 ? void 0 : _b.decorators) === null || _c === void 0 ? void 0 : _c.some(d => hasDeprecatedDefinitionDecorator(d)))) {
|
|
41
|
+
returnDefinitionRuleDiagnostic(program, member);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
operation: (operation) => {
|
|
46
|
+
var _a, _b, _c;
|
|
47
|
+
if (hasGraphDeprecatedDecorator(program, operation)) {
|
|
48
|
+
if (!((_c = (_b = (_a = operation === null || operation === void 0 ? void 0 : operation.interface) === null || _a === void 0 ? void 0 : _a.namespace) === null || _b === void 0 ? void 0 : _b.decorators) === null || _c === void 0 ? void 0 : _c.some(d => hasDeprecatedDefinitionDecorator(d)))) {
|
|
49
|
+
returnDefinitionRuleDiagnostic(program, operation);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
interface: (interfaceModel) => {
|
|
54
|
+
var _a, _b;
|
|
55
|
+
if (hasGraphDeprecatedDecorator(program, interfaceModel)) {
|
|
56
|
+
if (!((_b = (_a = interfaceModel === null || interfaceModel === void 0 ? void 0 : interfaceModel.namespace) === null || _a === void 0 ? void 0 : _a.decorators) === null || _b === void 0 ? void 0 : _b.some(d => hasDeprecatedDefinitionDecorator(d)))) {
|
|
57
|
+
returnDefinitionRuleDiagnostic(program, interfaceModel);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
;
|
|
65
|
+
function hasDeprecatedDefinitionDecorator(decoratorApplication) {
|
|
66
|
+
return decoratorApplication.decorator.name.substring(1) === 'deprecatedDefinition';
|
|
67
|
+
}
|
|
68
|
+
function hasGraphDeprecatedDecorator(program, type) {
|
|
69
|
+
var _a;
|
|
70
|
+
return (_a = type.decorators) === null || _a === void 0 ? void 0 : _a.some(d => d.decorator.name.substring(1) === 'graphDeprecated');
|
|
71
|
+
}
|
|
72
|
+
function returnDefinitionRuleDiagnostic(program, target) {
|
|
73
|
+
reportDiagnostic(program, {
|
|
74
|
+
code: "decorator-invalid-use",
|
|
75
|
+
target: target,
|
|
76
|
+
messageId: "graphDeprecatedMustBeAccompaniedByDefinition",
|
|
77
|
+
format: {
|
|
78
|
+
decorator: "@graphDeprecated"
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function returnDeprecatedValueDiagnostic(program, target) {
|
|
83
|
+
reportDiagnostic(program, {
|
|
84
|
+
code: "decorator-invalid-use",
|
|
85
|
+
target: target,
|
|
86
|
+
messageId: "graphDeprecatedValueMustBeDefinedInDeprecatedDefinition",
|
|
87
|
+
format: {
|
|
88
|
+
decorator: "@graphDeprecated"
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
function definitionHasDeprecatedValue(program, type, namespace) {
|
|
93
|
+
const deprecatedDefinition = getDeprecatedDefinitions(program, namespace);
|
|
94
|
+
const deprecated = getGraphDeprecated(program, type);
|
|
95
|
+
if (deprecatedDefinition && deprecated) {
|
|
96
|
+
return deprecatedDefinition.has(deprecated);
|
|
97
|
+
}
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
export function validateGraphDeprecatedValueMustBeDefinedInDeprecatedDefinition(program) {
|
|
101
|
+
for (const namespace of GetDeclaredNamespaces(program)) {
|
|
102
|
+
navigateTypesInNamespace(namespace, {
|
|
103
|
+
model: (model) => {
|
|
104
|
+
if (hasGraphDeprecatedDecorator(program, model)) {
|
|
105
|
+
if (model.namespace && !definitionHasDeprecatedValue(program, model, model.namespace)) {
|
|
106
|
+
returnDeprecatedValueDiagnostic(program, model);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
modelProperty: (property) => {
|
|
111
|
+
var _a;
|
|
112
|
+
if (hasGraphDeprecatedDecorator(program, property)) {
|
|
113
|
+
if (((_a = property === null || property === void 0 ? void 0 : property.model) === null || _a === void 0 ? void 0 : _a.namespace) && !definitionHasDeprecatedValue(program, property, property.model.namespace)) {
|
|
114
|
+
returnDeprecatedValueDiagnostic(program, property);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
enum: (enumModel) => {
|
|
119
|
+
if (hasGraphDeprecatedDecorator(program, enumModel)) {
|
|
120
|
+
if (enumModel.namespace && !definitionHasDeprecatedValue(program, enumModel, enumModel.namespace)) {
|
|
121
|
+
returnDeprecatedValueDiagnostic(program, enumModel);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
enumMember: (member) => {
|
|
126
|
+
var _a;
|
|
127
|
+
if (hasGraphDeprecatedDecorator(program, member)) {
|
|
128
|
+
if (((_a = member === null || member === void 0 ? void 0 : member.enum) === null || _a === void 0 ? void 0 : _a.namespace) && !definitionHasDeprecatedValue(program, member, member.enum.namespace)) {
|
|
129
|
+
returnDeprecatedValueDiagnostic(program, member);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
operation: (operation) => {
|
|
134
|
+
var _a;
|
|
135
|
+
if (hasGraphDeprecatedDecorator(program, operation)) {
|
|
136
|
+
if (((_a = operation === null || operation === void 0 ? void 0 : operation.interface) === null || _a === void 0 ? void 0 : _a.namespace) && !definitionHasDeprecatedValue(program, operation, operation.interface.namespace)) {
|
|
137
|
+
returnDeprecatedValueDiagnostic(program, operation);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
interface: (interfaceModel) => {
|
|
142
|
+
if (hasGraphDeprecatedDecorator(program, interfaceModel)) {
|
|
143
|
+
if ((interfaceModel === null || interfaceModel === void 0 ? void 0 : interfaceModel.namespace) && !definitionHasDeprecatedValue(program, interfaceModel, interfaceModel.namespace)) {
|
|
144
|
+
returnDeprecatedValueDiagnostic(program, interfaceModel);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
;
|
|
152
|
+
//# sourceMappingURL=graph-deprecated.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-deprecated.js","sourceRoot":"","sources":["../../../src/rules/graph-deprecated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAkI,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9L,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,kDAAkD;AAElD;;;GAGG;AAEH,MAAM,UAAU,oDAAoD,CAAC,OAAgB;IACnF,KAAK,MAAM,SAAS,IAAI,qBAAqB,CAAC,OAAO,CAAC,EAAE;QACtD,wBAAwB,CAAC,SAAS,EAAE;YAClC,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;;gBACf,IAAG,2BAA2B,CAAC,OAAO,EAAE,KAAK,CAAC,EAAC;oBAC7C,IAAG,CAAC,CAAA,MAAA,MAAA,KAAK,CAAC,SAAS,0CAAE,UAAU,0CAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,gCAAgC,CAAC,CAAC,CAAC,CAAC,CAAA,EAAC;wBAC9E,8BAA8B,CAAC,OAAO,EAAE,KAAK,CAAC,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AAE,cAAc,CAAC,EAAC;oBACtD,IAAG,CAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,SAAS,KAAI,CAAC,4BAA4B,CAAC,OAAO,EAAE,cAAc,EAAE,cAAc,CAAC,SAAS,CAAC,EAAC;wBAC/G,+BAA+B,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;qBAC1D;iBACF;YACH,CAAC;SACF,CAAC,CAAC;KACJ;AACH,CAAC;AAAA,CAAC"}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
import { Program } from "@typespec/compiler";
|
|
1
2
|
/**
|
|
2
3
|
* @graphRoute should not have a leading forward slash
|
|
3
4
|
*/
|
|
4
|
-
export declare
|
|
5
|
-
export declare
|
|
5
|
+
export declare function validateGraphRouteLeadingSlash(program: Program): void;
|
|
6
|
+
export declare function validateOperationParametersMatchGraphRouteParameters(program: Program): void;
|
|
7
|
+
export declare function validateGraphRouteAndInterfaceExtendsMatchForCollections(program: Program): void;
|
|
8
|
+
/**
|
|
9
|
+
* A interface decorated with @graphRoute must ultimately extend one of the standard graph interface i.e Resource<T> or Collection<T>.
|
|
10
|
+
*/
|
|
11
|
+
export declare function validateGraphRouteInterfaceExtendsGraphStandardInterface(program: Program): void;
|
|
6
12
|
//# sourceMappingURL=graph-route.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-route.d.ts","sourceRoot":"","sources":["../../../src/rules/graph-route.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"graph-route.d.ts","sourceRoot":"","sources":["../../../src/rules/graph-route.ts"],"names":[],"mappings":"AAEA,OAAO,EAAwB,OAAO,EAAkC,MAAM,oBAAoB,CAAC;AAInG;;GAEG;AAEH,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,OAAO,QAW9D;AAyBD,wBAAgB,oDAAoD,CAAC,OAAO,EAAE,OAAO,QAWpF;AAqDD,wBAAgB,wDAAwD,CAAC,OAAO,EAAE,OAAO,QA2BxF;AAeD;;GAEG;AACH,wBAAgB,wDAAwD,CAAC,OAAO,EAAE,OAAO,QA0BxF"}
|