@microsoft/typespec-msgraph 0.0.1-Preview.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/LICENSE +21 -0
- package/README.md +7 -0
- package/dist/src/components/acceptable-media-types-annotation.d.ts +6 -0
- package/dist/src/components/acceptable-media-types-annotation.d.ts.map +1 -0
- package/dist/src/components/acceptable-media-types-annotation.js +15 -0
- package/dist/src/components/acceptable-media-types-annotation.js.map +1 -0
- package/dist/src/components/alternate-keys-annotation.d.ts +6 -0
- package/dist/src/components/alternate-keys-annotation.d.ts.map +1 -0
- package/dist/src/components/alternate-keys-annotation.js +30 -0
- package/dist/src/components/alternate-keys-annotation.js.map +1 -0
- package/dist/src/components/common-elements.d.ts +128 -0
- package/dist/src/components/common-elements.d.ts.map +1 -0
- package/dist/src/components/common-elements.js +38 -0
- package/dist/src/components/common-elements.js.map +1 -0
- package/dist/src/components/computed-annotation.d.ts +6 -0
- package/dist/src/components/computed-annotation.d.ts.map +1 -0
- package/dist/src/components/computed-annotation.js +12 -0
- package/dist/src/components/computed-annotation.js.map +1 -0
- package/dist/src/components/count-restrictions-annotation.d.ts +6 -0
- package/dist/src/components/count-restrictions-annotation.d.ts.map +1 -0
- package/dist/src/components/count-restrictions-annotation.js +15 -0
- package/dist/src/components/count-restrictions-annotation.js.map +1 -0
- package/dist/src/components/description-annotation.d.ts +6 -0
- package/dist/src/components/description-annotation.d.ts.map +1 -0
- package/dist/src/components/description-annotation.js +13 -0
- package/dist/src/components/description-annotation.js.map +1 -0
- package/dist/src/components/expand-restrictions-annotation.d.ts +7 -0
- package/dist/src/components/expand-restrictions-annotation.d.ts.map +1 -0
- package/dist/src/components/expand-restrictions-annotation.js +31 -0
- package/dist/src/components/expand-restrictions-annotation.js.map +1 -0
- package/dist/src/components/index.d.ts +15 -0
- package/dist/src/components/index.d.ts.map +1 -0
- package/dist/src/components/index.js +15 -0
- package/dist/src/components/index.js.map +1 -0
- package/dist/src/components/permissions-annotation.d.ts +6 -0
- package/dist/src/components/permissions-annotation.d.ts.map +1 -0
- package/dist/src/components/permissions-annotation.js +20 -0
- package/dist/src/components/permissions-annotation.js.map +1 -0
- package/dist/src/components/program-context.d.ts +4 -0
- package/dist/src/components/program-context.d.ts.map +1 -0
- package/dist/src/components/program-context.js +3 -0
- package/dist/src/components/program-context.js.map +1 -0
- package/dist/src/components/property-element.d.ts +6 -0
- package/dist/src/components/property-element.d.ts.map +1 -0
- package/dist/src/components/property-element.js +41 -0
- package/dist/src/components/property-element.js.map +1 -0
- package/dist/src/components/revisions-annotation.d.ts +7 -0
- package/dist/src/components/revisions-annotation.d.ts.map +1 -0
- package/dist/src/components/revisions-annotation.js +60 -0
- package/dist/src/components/revisions-annotation.js.map +1 -0
- package/dist/src/components/search-restrictions-annotation.d.ts +6 -0
- package/dist/src/components/search-restrictions-annotation.d.ts.map +1 -0
- package/dist/src/components/search-restrictions-annotation.js +15 -0
- package/dist/src/components/search-restrictions-annotation.js.map +1 -0
- package/dist/src/components/skip-supported-annotation.d.ts +6 -0
- package/dist/src/components/skip-supported-annotation.d.ts.map +1 -0
- package/dist/src/components/skip-supported-annotation.js +13 -0
- package/dist/src/components/skip-supported-annotation.js.map +1 -0
- package/dist/src/components/sort-restrictions-annotation.d.ts +7 -0
- package/dist/src/components/sort-restrictions-annotation.d.ts.map +1 -0
- package/dist/src/components/sort-restrictions-annotation.js +31 -0
- package/dist/src/components/sort-restrictions-annotation.js.map +1 -0
- package/dist/src/components/structured-type-element.d.ts +6 -0
- package/dist/src/components/structured-type-element.d.ts.map +1 -0
- package/dist/src/components/structured-type-element.js +77 -0
- package/dist/src/components/structured-type-element.js.map +1 -0
- package/dist/src/components/top-supported-annotation.d.ts +6 -0
- package/dist/src/components/top-supported-annotation.d.ts.map +1 -0
- package/dist/src/components/top-supported-annotation.js +13 -0
- package/dist/src/components/top-supported-annotation.js.map +1 -0
- package/dist/src/csdl.d.ts +8 -0
- package/dist/src/csdl.d.ts.map +1 -0
- package/dist/src/csdl.js +298 -0
- package/dist/src/csdl.js.map +1 -0
- package/dist/src/decorators/abstract.d.ts +9 -0
- package/dist/src/decorators/abstract.d.ts.map +1 -0
- package/dist/src/decorators/abstract.js +19 -0
- package/dist/src/decorators/abstract.js.map +1 -0
- package/dist/src/decorators/alternate-key.d.ts +9 -0
- package/dist/src/decorators/alternate-key.d.ts.map +1 -0
- package/dist/src/decorators/alternate-key.js +13 -0
- package/dist/src/decorators/alternate-key.js.map +1 -0
- package/dist/src/decorators/attribute-builder.d.ts +2 -0
- package/dist/src/decorators/attribute-builder.d.ts.map +1 -0
- package/dist/src/decorators/attribute-builder.js +166 -0
- package/dist/src/decorators/attribute-builder.js.map +1 -0
- package/dist/src/decorators/attributes.d.ts +57 -0
- package/dist/src/decorators/attributes.d.ts.map +1 -0
- package/dist/src/decorators/attributes.js +50 -0
- package/dist/src/decorators/attributes.js.map +1 -0
- package/dist/src/decorators/complex.d.ts +9 -0
- package/dist/src/decorators/complex.d.ts.map +1 -0
- package/dist/src/decorators/complex.js +19 -0
- package/dist/src/decorators/complex.js.map +1 -0
- package/dist/src/decorators/computed.d.ts +9 -0
- package/dist/src/decorators/computed.d.ts.map +1 -0
- package/dist/src/decorators/computed.js +13 -0
- package/dist/src/decorators/computed.js.map +1 -0
- package/dist/src/decorators/contains.d.ts +9 -0
- package/dist/src/decorators/contains.d.ts.map +1 -0
- package/dist/src/decorators/contains.js +13 -0
- package/dist/src/decorators/contains.js.map +1 -0
- package/dist/src/decorators/count.d.ts +9 -0
- package/dist/src/decorators/count.d.ts.map +1 -0
- package/dist/src/decorators/count.js +13 -0
- package/dist/src/decorators/count.js.map +1 -0
- package/dist/src/decorators/deprecated-definition.d.ts +21 -0
- package/dist/src/decorators/deprecated-definition.d.ts.map +1 -0
- package/dist/src/decorators/deprecated-definition.js +18 -0
- package/dist/src/decorators/deprecated-definition.js.map +1 -0
- package/dist/src/decorators/entity.d.ts +10 -0
- package/dist/src/decorators/entity.d.ts.map +1 -0
- package/dist/src/decorators/entity.js +23 -0
- package/dist/src/decorators/entity.js.map +1 -0
- package/dist/src/decorators/expand.d.ts +11 -0
- package/dist/src/decorators/expand.d.ts.map +1 -0
- package/dist/src/decorators/expand.js +17 -0
- package/dist/src/decorators/expand.js.map +1 -0
- package/dist/src/decorators/handlers/custom/additional-query-parameters.d.ts +14 -0
- package/dist/src/decorators/handlers/custom/additional-query-parameters.d.ts.map +1 -0
- package/dist/src/decorators/handlers/custom/additional-query-parameters.js +36 -0
- package/dist/src/decorators/handlers/custom/additional-query-parameters.js.map +1 -0
- package/dist/src/decorators/handlers/custom/ags-attribute.d.ts +7 -0
- package/dist/src/decorators/handlers/custom/ags-attribute.d.ts.map +1 -0
- package/dist/src/decorators/handlers/custom/ags-attribute.js +36 -0
- package/dist/src/decorators/handlers/custom/ags-attribute.js.map +1 -0
- package/dist/src/decorators/handlers/custom/index.d.ts +3 -0
- package/dist/src/decorators/handlers/custom/index.d.ts.map +1 -0
- package/dist/src/decorators/handlers/custom/index.js +3 -0
- package/dist/src/decorators/handlers/custom/index.js.map +1 -0
- package/dist/src/decorators/handlers/index.d.ts +30 -0
- package/dist/src/decorators/handlers/index.d.ts.map +1 -0
- package/dist/src/decorators/handlers/index.js +121 -0
- package/dist/src/decorators/handlers/index.js.map +1 -0
- package/dist/src/decorators/has-stream.d.ts +11 -0
- package/dist/src/decorators/has-stream.d.ts.map +1 -0
- package/dist/src/decorators/has-stream.js +30 -0
- package/dist/src/decorators/has-stream.js.map +1 -0
- package/dist/src/decorators/index.d.ts +21 -0
- package/dist/src/decorators/index.d.ts.map +1 -0
- package/dist/src/decorators/index.js +21 -0
- package/dist/src/decorators/index.js.map +1 -0
- package/dist/src/decorators/open.d.ts +9 -0
- package/dist/src/decorators/open.d.ts.map +1 -0
- package/dist/src/decorators/open.js +19 -0
- package/dist/src/decorators/open.js.map +1 -0
- package/dist/src/decorators/order-by.d.ts +11 -0
- package/dist/src/decorators/order-by.d.ts.map +1 -0
- package/dist/src/decorators/order-by.js +17 -0
- package/dist/src/decorators/order-by.js.map +1 -0
- package/dist/src/decorators/private-preview-definition.d.ts +19 -0
- package/dist/src/decorators/private-preview-definition.d.ts.map +1 -0
- package/dist/src/decorators/private-preview-definition.js +15 -0
- package/dist/src/decorators/private-preview-definition.js.map +1 -0
- package/dist/src/decorators/private-preview.d.ts +9 -0
- package/dist/src/decorators/private-preview.d.ts.map +1 -0
- package/dist/src/decorators/private-preview.js +25 -0
- package/dist/src/decorators/private-preview.js.map +1 -0
- package/dist/src/decorators/read-only.d.ts +9 -0
- package/dist/src/decorators/read-only.d.ts.map +1 -0
- package/dist/src/decorators/read-only.js +13 -0
- package/dist/src/decorators/read-only.js.map +1 -0
- package/dist/src/decorators/references.d.ts +9 -0
- package/dist/src/decorators/references.d.ts.map +1 -0
- package/dist/src/decorators/references.js +13 -0
- package/dist/src/decorators/references.js.map +1 -0
- package/dist/src/decorators/routed-interfaces.d.ts +19 -0
- package/dist/src/decorators/routed-interfaces.d.ts.map +1 -0
- package/dist/src/decorators/routed-interfaces.js +43 -0
- package/dist/src/decorators/routed-interfaces.js.map +1 -0
- package/dist/src/decorators/search.d.ts +8 -0
- package/dist/src/decorators/search.d.ts.map +1 -0
- package/dist/src/decorators/search.js +12 -0
- package/dist/src/decorators/search.js.map +1 -0
- package/dist/src/decorators/skip.d.ts +8 -0
- package/dist/src/decorators/skip.d.ts.map +1 -0
- package/dist/src/decorators/skip.js +12 -0
- package/dist/src/decorators/skip.js.map +1 -0
- package/dist/src/decorators/top.d.ts +8 -0
- package/dist/src/decorators/top.d.ts.map +1 -0
- package/dist/src/decorators/top.js +12 -0
- package/dist/src/decorators/top.js.map +1 -0
- package/dist/src/decorators/write-only.d.ts +9 -0
- package/dist/src/decorators/write-only.d.ts.map +1 -0
- package/dist/src/decorators/write-only.js +13 -0
- package/dist/src/decorators/write-only.js.map +1 -0
- package/dist/src/dom/reconciler.d.ts +10 -0
- package/dist/src/dom/reconciler.d.ts.map +1 -0
- package/dist/src/dom/reconciler.js +95 -0
- package/dist/src/dom/reconciler.js.map +1 -0
- package/dist/src/dom/renderer.d.ts +6 -0
- package/dist/src/dom/renderer.d.ts.map +1 -0
- package/dist/src/dom/renderer.js +33 -0
- package/dist/src/dom/renderer.js.map +1 -0
- package/dist/src/dom/types.d.ts +33 -0
- package/dist/src/dom/types.d.ts.map +1 -0
- package/dist/src/dom/types.js +2 -0
- package/dist/src/dom/types.js.map +1 -0
- package/dist/src/emitter.d.ts +4 -0
- package/dist/src/emitter.d.ts.map +1 -0
- package/dist/src/emitter.js +11 -0
- package/dist/src/emitter.js.map +1 -0
- package/dist/src/index.d.ts +7 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +7 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/lib.d.ts +138 -0
- package/dist/src/lib.d.ts.map +1 -0
- package/dist/src/lib.js +55 -0
- package/dist/src/lib.js.map +1 -0
- package/dist/src/linter.d.ts +3 -0
- package/dist/src/linter.d.ts.map +1 -0
- package/dist/src/linter.js +35 -0
- package/dist/src/linter.js.map +1 -0
- package/dist/src/rules/abstract.d.ts +5 -0
- package/dist/src/rules/abstract.d.ts.map +1 -0
- package/dist/src/rules/abstract.js +31 -0
- package/dist/src/rules/abstract.js.map +1 -0
- package/dist/src/rules/alternate-key.d.ts +4 -0
- package/dist/src/rules/alternate-key.d.ts.map +1 -0
- package/dist/src/rules/alternate-key.js +81 -0
- package/dist/src/rules/alternate-key.js.map +1 -0
- package/dist/src/rules/computed.d.ts +7 -0
- package/dist/src/rules/computed.d.ts.map +1 -0
- package/dist/src/rules/computed.js +47 -0
- package/dist/src/rules/computed.js.map +1 -0
- package/dist/src/rules/contains.d.ts +5 -0
- package/dist/src/rules/contains.d.ts.map +1 -0
- package/dist/src/rules/contains.js +32 -0
- package/dist/src/rules/contains.js.map +1 -0
- package/dist/src/rules/count.d.ts +5 -0
- package/dist/src/rules/count.d.ts.map +1 -0
- package/dist/src/rules/count.js +35 -0
- package/dist/src/rules/count.js.map +1 -0
- package/dist/src/rules/entity.d.ts +2 -0
- package/dist/src/rules/entity.d.ts.map +1 -0
- package/dist/src/rules/entity.js +31 -0
- package/dist/src/rules/entity.js.map +1 -0
- package/dist/src/rules/expand.d.ts +3 -0
- package/dist/src/rules/expand.d.ts.map +1 -0
- package/dist/src/rules/expand.js +69 -0
- package/dist/src/rules/expand.js.map +1 -0
- package/dist/src/rules/has-stream.d.ts +2 -0
- package/dist/src/rules/has-stream.d.ts.map +1 -0
- package/dist/src/rules/has-stream.js +29 -0
- package/dist/src/rules/has-stream.js.map +1 -0
- package/dist/src/rules/index.d.ts +21 -0
- package/dist/src/rules/index.d.ts.map +1 -0
- package/dist/src/rules/index.js +176 -0
- package/dist/src/rules/index.js.map +1 -0
- package/dist/src/rules/open.d.ts +5 -0
- package/dist/src/rules/open.d.ts.map +1 -0
- package/dist/src/rules/open.js +31 -0
- package/dist/src/rules/open.js.map +1 -0
- package/dist/src/rules/order-by.d.ts +3 -0
- package/dist/src/rules/order-by.d.ts.map +1 -0
- package/dist/src/rules/order-by.js +69 -0
- package/dist/src/rules/order-by.js.map +1 -0
- package/dist/src/rules/references.d.ts +5 -0
- package/dist/src/rules/references.d.ts.map +1 -0
- package/dist/src/rules/references.js +32 -0
- package/dist/src/rules/references.js.map +1 -0
- package/dist/src/rules/search.d.ts +5 -0
- package/dist/src/rules/search.d.ts.map +1 -0
- package/dist/src/rules/search.js +35 -0
- package/dist/src/rules/search.js.map +1 -0
- package/dist/src/rules/skip.d.ts +5 -0
- package/dist/src/rules/skip.d.ts.map +1 -0
- package/dist/src/rules/skip.js +35 -0
- package/dist/src/rules/skip.js.map +1 -0
- package/dist/src/rules/top.d.ts +5 -0
- package/dist/src/rules/top.d.ts.map +1 -0
- package/dist/src/rules/top.js +35 -0
- package/dist/src/rules/top.js.map +1 -0
- package/dist/src/testing/index.d.ts +3 -0
- package/dist/src/testing/index.d.ts.map +1 -0
- package/dist/src/testing/index.js +24 -0
- package/dist/src/testing/index.js.map +1 -0
- package/dist/src/utils.d.ts +27 -0
- package/dist/src/utils.d.ts.map +1 -0
- package/dist/src/utils.js +186 -0
- package/dist/src/utils.js.map +1 -0
- package/lib/decorators.tsp +164 -0
- package/lib/lib.tsp +35 -0
- package/lib/msgraph.tsp +2 -0
- package/package.json +68 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { walkPropertiesInherited } from "@typespec/compiler";
|
|
2
|
+
import { createRule } from "@typespec/lint";
|
|
3
|
+
import { getOperationVerb } from "@typespec/http";
|
|
4
|
+
import { getExpand, isContains, isExpand, isReferences } from "../index.js";
|
|
5
|
+
import { reportDiagnostic } from "../lib.js";
|
|
6
|
+
export const expandOnlyOnGetNavigationSourceRule = createRule({
|
|
7
|
+
name: "expand-only-on-get-navigation-source",
|
|
8
|
+
create({ program }) {
|
|
9
|
+
return {
|
|
10
|
+
operation: (operation) => {
|
|
11
|
+
var _a;
|
|
12
|
+
if (!isExpand(program, operation)) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (getOperationVerb(program, operation) === "get") {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if ((_a = operation.interface) === null || _a === void 0 ? void 0 : _a.operations.has("_isNavigationSource")) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
reportDiagnostic(program, {
|
|
22
|
+
code: "decorator-invalid-use",
|
|
23
|
+
target: operation,
|
|
24
|
+
messageId: "wrongType",
|
|
25
|
+
format: {
|
|
26
|
+
decorator: "@expand",
|
|
27
|
+
target: "get operation",
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
export const expandOnlyNavigationPropertiesRule = createRule({
|
|
35
|
+
name: "expand-only-navigation-properties",
|
|
36
|
+
create({ program }) {
|
|
37
|
+
return {
|
|
38
|
+
operation: (operation) => {
|
|
39
|
+
var _a, _b;
|
|
40
|
+
const expanded = getExpand(program, operation);
|
|
41
|
+
if (!expanded.length) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const returnType = (_b = (_a = operation.interface) === null || _a === void 0 ? void 0 : _a.operations.get("_isNavigationSource")) === null || _b === void 0 ? void 0 : _b.returnType;
|
|
45
|
+
if (!returnType) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const modelType = returnType.indexer ? returnType.indexer.value : returnType;
|
|
49
|
+
const navigationProperties = [...walkPropertiesInherited(modelType)]
|
|
50
|
+
.filter((property) => isContains(program, property) || isReferences(program, property))
|
|
51
|
+
.map((property) => property.name);
|
|
52
|
+
const invalidExpansions = expanded.filter((property) => !navigationProperties.includes(property));
|
|
53
|
+
if (!invalidExpansions.length) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
reportDiagnostic(program, {
|
|
57
|
+
code: "decorator-invalid-use",
|
|
58
|
+
target: operation,
|
|
59
|
+
messageId: "expandProperties",
|
|
60
|
+
format: {
|
|
61
|
+
model: modelType.name,
|
|
62
|
+
properties: invalidExpansions.join(", "),
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
//# sourceMappingURL=expand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expand.js","sourceRoot":"","sources":["../../../src/rules/expand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,MAAM,CAAC,MAAM,mCAAm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Ae,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;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"has-stream.d.ts","sourceRoot":"","sources":["../../../src/rules/has-stream.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,qBAAqB,mCAuBhC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createRule } from "@typespec/lint";
|
|
2
|
+
import { hasStream } from "../decorators/has-stream.js";
|
|
3
|
+
import { isEntity } from "../index.js";
|
|
4
|
+
import { reportDiagnostic } from "../lib.js";
|
|
5
|
+
export const hasStreamOnlyOnEntity = createRule({
|
|
6
|
+
name: "has-stream-on-entity",
|
|
7
|
+
create({ program }) {
|
|
8
|
+
return {
|
|
9
|
+
model: (model) => {
|
|
10
|
+
if (!hasStream(program, model)) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
if (isEntity(program, model)) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
reportDiagnostic(program, {
|
|
17
|
+
code: "decorator-invalid-use",
|
|
18
|
+
target: model,
|
|
19
|
+
messageId: "wrongType",
|
|
20
|
+
format: {
|
|
21
|
+
decorator: "@hasStream",
|
|
22
|
+
target: "@entity model",
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
//# sourceMappingURL=has-stream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"has-stream.js","sourceRoot":"","sources":["../../../src/rules/has-stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,MAAM,CAAC,MAAM,qBAAqB,GAAG,UAAU,CAAC;IAC9C,IAAI,EAAE,sBAAsB;IAC5B,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;gBACf,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE;oBAC9B,OAAO;iBACR;gBACD,IAAI,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE;oBAC5B,OAAO;iBACR;gBACD,gBAAgB,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,uBAAuB;oBAC7B,MAAM,EAAE,KAAK;oBACb,SAAS,EAAE,WAAW;oBACtB,MAAM,EAAE;wBACN,SAAS,EAAE,YAAY;wBACvB,MAAM,EAAE,eAAe;qBACxB;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export * from "./abstract.js";
|
|
2
|
+
export * from "./alternate-key.js";
|
|
3
|
+
export * from "./computed.js";
|
|
4
|
+
export * from "./contains.js";
|
|
5
|
+
export * from "./count.js";
|
|
6
|
+
export * from "./entity.js";
|
|
7
|
+
export * from "./expand.js";
|
|
8
|
+
export * from "./has-stream.js";
|
|
9
|
+
export * from "./open.js";
|
|
10
|
+
export * from "./order-by.js";
|
|
11
|
+
export * from "./references.js";
|
|
12
|
+
export * from "./search.js";
|
|
13
|
+
export * from "./skip.js";
|
|
14
|
+
export * from "./top.js";
|
|
15
|
+
export declare const extendsOnSameTypeRule: import("@typespec/lint").LintRule;
|
|
16
|
+
export declare const keyOnlyOnEntityNonNullablePrimitivePropertyRule: import("@typespec/lint").LintRule;
|
|
17
|
+
export declare const operationInsideInterfaceRule: import("@typespec/lint").LintRule;
|
|
18
|
+
export declare const voidFunctionRule: import("@typespec/lint").LintRule;
|
|
19
|
+
export declare const disallowedTypeSpecDecoratorsRule: import("@typespec/lint").LintRule;
|
|
20
|
+
export declare const useEvolvableEnumRule: import("@typespec/lint").LintRule;
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/rules/index.ts"],"names":[],"mappings":"AAMA,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AAEzB,eAAO,MAAM,qBAAqB,mCA+BhC,CAAC;AAEH,eAAO,MAAM,+CAA+C,mCAwC1D,CAAC;AAEH,eAAO,MAAM,4BAA4B,mCAkBvC,CAAC;AAEH,eAAO,MAAM,gBAAgB,mCAsB3B,CAAC;AAEH,eAAO,MAAM,gCAAgC,mCA+B3C,CAAC;AAEH,eAAO,MAAM,oBAAoB,mCAuB/B,CAAC"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { isKey, isVoidType } from "@typespec/compiler";
|
|
2
|
+
import { createRule } from "@typespec/lint";
|
|
3
|
+
import { isComplex, isEntity, isFunction } from "../decorators/index.js";
|
|
4
|
+
import { reportDiagnostic } from "../lib.js";
|
|
5
|
+
import { isExcludedCoreType, isTypeNullable } from "../utils.js";
|
|
6
|
+
export * from "./abstract.js";
|
|
7
|
+
export * from "./alternate-key.js";
|
|
8
|
+
export * from "./computed.js";
|
|
9
|
+
export * from "./contains.js";
|
|
10
|
+
export * from "./count.js";
|
|
11
|
+
export * from "./entity.js";
|
|
12
|
+
export * from "./expand.js";
|
|
13
|
+
export * from "./has-stream.js";
|
|
14
|
+
export * from "./open.js";
|
|
15
|
+
export * from "./order-by.js";
|
|
16
|
+
export * from "./references.js";
|
|
17
|
+
export * from "./search.js";
|
|
18
|
+
export * from "./skip.js";
|
|
19
|
+
export * from "./top.js";
|
|
20
|
+
export const extendsOnSameTypeRule = createRule({
|
|
21
|
+
name: "extends-on-same-type",
|
|
22
|
+
create({ program }) {
|
|
23
|
+
return {
|
|
24
|
+
model: (model) => {
|
|
25
|
+
if (!model.baseModel) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (isEntity(program, model) && !isEntity(program, model.baseModel)) {
|
|
29
|
+
reportDiagnostic(program, {
|
|
30
|
+
code: "extends-invalid-use",
|
|
31
|
+
target: model,
|
|
32
|
+
format: {
|
|
33
|
+
type: "@entity",
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
if (isComplex(program, model) && !isComplex(program, model.baseModel)) {
|
|
38
|
+
reportDiagnostic(program, {
|
|
39
|
+
code: "extends-invalid-use",
|
|
40
|
+
target: model,
|
|
41
|
+
format: {
|
|
42
|
+
type: "@complex",
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
export const keyOnlyOnEntityNonNullablePrimitivePropertyRule = createRule({
|
|
51
|
+
name: "key-only-on-entity-non-nullable-primitive-property",
|
|
52
|
+
create({ program }) {
|
|
53
|
+
return {
|
|
54
|
+
modelProperty: (property) => {
|
|
55
|
+
if (!property.model || !isKey(program, property)) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (!isEntity(program, property.model)) {
|
|
59
|
+
reportDiagnostic(program, {
|
|
60
|
+
code: "decorator-missing-dependencies",
|
|
61
|
+
target: property,
|
|
62
|
+
format: {
|
|
63
|
+
decorator: "@key",
|
|
64
|
+
required: "@entity",
|
|
65
|
+
location: "entity model",
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (isTypeNullable(program, property.type) ||
|
|
71
|
+
property.type.kind !== "Scalar" ||
|
|
72
|
+
property.name === "Array") {
|
|
73
|
+
reportDiagnostic(program, {
|
|
74
|
+
code: "decorator-invalid-use",
|
|
75
|
+
target: property,
|
|
76
|
+
messageId: "key",
|
|
77
|
+
format: {},
|
|
78
|
+
});
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
export const operationInsideInterfaceRule = createRule({
|
|
86
|
+
name: "operation-inside-interface",
|
|
87
|
+
create({ program }) {
|
|
88
|
+
return {
|
|
89
|
+
operation: (operation) => {
|
|
90
|
+
if (operation.interface) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
reportDiagnostic(program, {
|
|
94
|
+
code: "element-missing-dependencies",
|
|
95
|
+
target: operation,
|
|
96
|
+
messageId: "operation",
|
|
97
|
+
format: {},
|
|
98
|
+
});
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
export const voidFunctionRule = createRule({
|
|
104
|
+
name: "void-function",
|
|
105
|
+
create({ program }) {
|
|
106
|
+
return {
|
|
107
|
+
operation: (operation) => {
|
|
108
|
+
if (!isFunction(program, operation)) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (!isVoidType(operation.returnType)) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
reportDiagnostic(program, {
|
|
115
|
+
code: "decorator-missing-dependencies",
|
|
116
|
+
target: operation,
|
|
117
|
+
messageId: "function",
|
|
118
|
+
format: {},
|
|
119
|
+
});
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
export const disallowedTypeSpecDecoratorsRule = createRule({
|
|
125
|
+
name: "disallowed-typespec-decorators",
|
|
126
|
+
create({ program }) {
|
|
127
|
+
return {
|
|
128
|
+
decorator: (decorator) => {
|
|
129
|
+
const denyList = [
|
|
130
|
+
"@friendlyName",
|
|
131
|
+
"@secret",
|
|
132
|
+
"@summary",
|
|
133
|
+
"@tag",
|
|
134
|
+
"@visibility",
|
|
135
|
+
"@withVisibility",
|
|
136
|
+
"@withUpdateableProperties",
|
|
137
|
+
"@withDefaultKeyVisibility",
|
|
138
|
+
];
|
|
139
|
+
if (denyList.indexOf(decorator.name) < 0) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
reportDiagnostic(program, {
|
|
143
|
+
code: "decorator-invalid-use",
|
|
144
|
+
target: decorator.target,
|
|
145
|
+
messageId: "disallowedTypeSpecDecorators",
|
|
146
|
+
format: {
|
|
147
|
+
decorator: decorator.name,
|
|
148
|
+
},
|
|
149
|
+
});
|
|
150
|
+
},
|
|
151
|
+
};
|
|
152
|
+
},
|
|
153
|
+
});
|
|
154
|
+
export const useEvolvableEnumRule = createRule({
|
|
155
|
+
name: "use-evolvable-enum",
|
|
156
|
+
create({ program }) {
|
|
157
|
+
return {
|
|
158
|
+
enum: (enumType) => {
|
|
159
|
+
if (isExcludedCoreType(program, enumType)) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
if (enumType.members.has("unknownFutureValue")) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
reportDiagnostic(program, {
|
|
166
|
+
code: "use-evolvable-enum",
|
|
167
|
+
target: enumType,
|
|
168
|
+
format: {
|
|
169
|
+
enum: enumType.name,
|
|
170
|
+
},
|
|
171
|
+
});
|
|
172
|
+
},
|
|
173
|
+
};
|
|
174
|
+
},
|
|
175
|
+
});
|
|
176
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rules/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEjE,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cA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CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,IAAI,EAAE,CAAC,QAAQ,EAAE,EAAE;gBACjB,IAAI,kBAAkB,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE;oBACzC,OAAO;iBACR;gBAED,IAAI,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,EAAE;oBAC9C,OAAO;iBACR;gBAED,gBAAgB,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,oBAAoB;oBAC1B,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open.d.ts","sourceRoot":"","sources":["../../../src/rules/open.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,eAAO,MAAM,+BAA+B,mCAyB1C,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createRule } from "@typespec/lint";
|
|
2
|
+
import { isComplex, isEntity, isOpen } from "../index.js";
|
|
3
|
+
import { reportDiagnostic } from "../lib.js";
|
|
4
|
+
/**
|
|
5
|
+
* @open applies to either an entity or a complex type.
|
|
6
|
+
*/
|
|
7
|
+
export const openOnlyAppliesToStructuredType = createRule({
|
|
8
|
+
name: "open-only-applies-to-structured-type",
|
|
9
|
+
create({ program }) {
|
|
10
|
+
return {
|
|
11
|
+
model: (model) => {
|
|
12
|
+
if (!isOpen(program, model)) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (isEntity(program, model) || isComplex(program, model)) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
reportDiagnostic(program, {
|
|
19
|
+
code: "decorator-invalid-use",
|
|
20
|
+
target: model,
|
|
21
|
+
messageId: "wrongType",
|
|
22
|
+
format: {
|
|
23
|
+
decorator: "@open",
|
|
24
|
+
target: "@complex or @entity model type",
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=open.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open.js","sourceRoot":"","sources":["../../../src/rules/open.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C;;GAEG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,UAAU,CAAC;IACxD,IAAI,EAAE,sCAAsC;IAC5C,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;gBACf,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE;oBAC3B,OAAO;iBACR;gBAED,IAAI,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE;oBACzD,OAAO;iBACR;gBAED,gBAAgB,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,uBAAuB;oBAC7B,MAAM,EAAE,KAAK;oBACb,SAAS,EAAE,WAAW;oBACtB,MAAM,EAAE;wBACN,SAAS,EAAE,OAAO;wBAClB,MAAM,EAAE,gCAAgC;qBACzC;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"order-by.d.ts","sourceRoot":"","sources":["../../../src/rules/order-by.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,oCAAoC,mCA6B/C,CAAC;AAEH,eAAO,MAAM,sCAAsC,mCAyCjD,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { walkPropertiesInherited } from "@typespec/compiler";
|
|
2
|
+
import { createRule } from "@typespec/lint";
|
|
3
|
+
import { getOperationVerb } from "@typespec/http";
|
|
4
|
+
import { getOrderBy, isContains, isOrderBy, isReferences } from "../index.js";
|
|
5
|
+
import { reportDiagnostic } from "../lib.js";
|
|
6
|
+
export const orderByOnlyOnGetNavigationSourceRule = createRule({
|
|
7
|
+
name: "order-by-only-on-get-navigation-source",
|
|
8
|
+
create({ program }) {
|
|
9
|
+
return {
|
|
10
|
+
operation: (operation) => {
|
|
11
|
+
var _a;
|
|
12
|
+
if (!isOrderBy(program, operation)) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (getOperationVerb(program, operation) === "get") {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if ((_a = operation.interface) === null || _a === void 0 ? void 0 : _a.operations.has("_isNavigationSource")) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
reportDiagnostic(program, {
|
|
22
|
+
code: "decorator-invalid-use",
|
|
23
|
+
target: operation,
|
|
24
|
+
messageId: "wrongType",
|
|
25
|
+
format: {
|
|
26
|
+
decorator: "@orderBy",
|
|
27
|
+
target: "get operation",
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
export const orderByOnlyNonNavigationPropertiesRule = createRule({
|
|
35
|
+
name: "order-by-only-non-navigation-properties",
|
|
36
|
+
create({ program }) {
|
|
37
|
+
return {
|
|
38
|
+
operation: (operation) => {
|
|
39
|
+
var _a, _b;
|
|
40
|
+
const ordered = getOrderBy(program, operation);
|
|
41
|
+
if (!ordered.length) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const returnType = (_b = (_a = operation.interface) === null || _a === void 0 ? void 0 : _a.operations.get("_isNavigationSource")) === null || _b === void 0 ? void 0 : _b.returnType;
|
|
45
|
+
if (!returnType) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const modelType = returnType.indexer ? returnType.indexer.value : returnType;
|
|
49
|
+
const nonNavigationProperties = [...walkPropertiesInherited(modelType)]
|
|
50
|
+
.filter((property) => !isContains(program, property) && !isReferences(program, property))
|
|
51
|
+
.map((property) => property.name);
|
|
52
|
+
const invalidOrderBys = ordered.filter((property) => !nonNavigationProperties.includes(property));
|
|
53
|
+
if (!invalidOrderBys.length) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
reportDiagnostic(program, {
|
|
57
|
+
code: "decorator-invalid-use",
|
|
58
|
+
target: operation,
|
|
59
|
+
messageId: "orderByProperties",
|
|
60
|
+
format: {
|
|
61
|
+
model: modelType.name,
|
|
62
|
+
properties: invalidOrderBys.join(", "),
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
//# sourceMappingURL=order-by.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"order-by.js","sourceRoot":"","sources":["../../../src/rules/order-by.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,MAAM,CAAC,MAAM,oCAAoC,GAAG,UAAU,CAAC;IAC7D,IAAI,EAAE,wCAAwC;IAC9C,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,SAAS,EAAE,CAAC,SAAS,EAAE,EAAE;;gBACvB,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,CAAC,CAAC,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;qBACxF,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;gBAEpC,MAAM,eAAe,GAAG,OAAO,CAAC,MAAM,CACpC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,uBAAuB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAC1D,CAAC;gBAEF,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE;oBAC3B,OAAO;iBACR;gBAED,gBAAgB,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,uBAAuB;oBAC7B,MAAM,EAAE,SAAS;oBACjB,SAAS,EAAE,mBAAmB;oBAC9B,MAAM,EAAE;wBACN,KAAK,EAAE,SAAS,CAAC,IAAI;wBACrB,UAAU,EAAE,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC;qBACvC;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../../../src/rules/references.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,eAAO,MAAM,6CAA6C,mCAyBxD,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { createRule } from "@typespec/lint";
|
|
2
|
+
import { isReferences } from "../index.js";
|
|
3
|
+
import { reportDiagnostic } from "../lib.js";
|
|
4
|
+
import { isNavigationProperty } from "../utils.js";
|
|
5
|
+
/**
|
|
6
|
+
* @references applies to a navigation property.
|
|
7
|
+
*/
|
|
8
|
+
export const referencesOnlyAppliesToNavigationPropertyRule = createRule({
|
|
9
|
+
name: "references-only-applies-to-navigation-property",
|
|
10
|
+
create({ program }) {
|
|
11
|
+
return {
|
|
12
|
+
modelProperty: (property) => {
|
|
13
|
+
if (!isReferences(program, property)) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (isNavigationProperty(program, property)) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
reportDiagnostic(program, {
|
|
20
|
+
code: "decorator-invalid-use",
|
|
21
|
+
target: property,
|
|
22
|
+
messageId: "wrongType",
|
|
23
|
+
format: {
|
|
24
|
+
decorator: "@references",
|
|
25
|
+
target: "property that returns an @entity model",
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=references.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"references.js","sourceRoot":"","sources":["../../../src/rules/references.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD;;GAEG;AACH,MAAM,CAAC,MAAM,6CAA6C,GAAG,UAAU,CAAC;IACtE,IAAI,EAAE,gDAAgD;IACtD,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,aAAa,EAAE,CAAC,QAAQ,EAAE,EAAE;gBAC1B,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE;oBACpC,OAAO;iBACR;gBAED,IAAI,oBAAoB,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE;oBAC3C,OAAO;iBACR;gBAED,gBAAgB,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,uBAAuB;oBAC7B,MAAM,EAAE,QAAQ;oBAChB,SAAS,EAAE,WAAW;oBACtB,MAAM,EAAE;wBACN,SAAS,EAAE,aAAa;wBACxB,MAAM,EAAE,wCAAwC;qBACjD;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/rules/search.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,eAAO,MAAM,qDAAqD,mCA4BhE,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createRule } from "@typespec/lint";
|
|
2
|
+
import { getOperationVerb } from "@typespec/http";
|
|
3
|
+
import { isSearch } from "../index.js";
|
|
4
|
+
import { reportDiagnostic } from "../lib.js";
|
|
5
|
+
/**
|
|
6
|
+
* @search applies to get operations that return collections.
|
|
7
|
+
*/
|
|
8
|
+
export const searchAppliesToGetOperationsThatReturnCollectionsRule = createRule({
|
|
9
|
+
name: "search-applies-to-get-operations-that-return-collections",
|
|
10
|
+
create({ program }) {
|
|
11
|
+
return {
|
|
12
|
+
operation: (operation) => {
|
|
13
|
+
if (!isSearch(program, operation)) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (getOperationVerb(program, operation) === "get") {
|
|
17
|
+
const returnType = operation.returnType;
|
|
18
|
+
if (returnType.kind === "Model" && returnType.name === "PagedListResponse") {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
reportDiagnostic(program, {
|
|
23
|
+
code: "decorator-invalid-use",
|
|
24
|
+
target: operation,
|
|
25
|
+
messageId: "wrongType",
|
|
26
|
+
format: {
|
|
27
|
+
decorator: "@search",
|
|
28
|
+
target: "get operation that returns a collection",
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../../src/rules/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C;;GAEG;AACH,MAAM,CAAC,MAAM,qDAAqD,GAAG,UAAU,CAAC;IAC9E,IAAI,EAAE,0DAA0D;IAChE,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,SAAS,EAAE,CAAC,SAAS,EAAE,EAAE;gBACvB,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE;oBACjC,OAAO;iBACR;gBAED,IAAI,gBAAgB,CAAC,OAAO,EAAE,SAAS,CAAC,KAAK,KAAK,EAAE;oBAClD,MAAM,UAAU,GAAG,SAAS,CAAC,UAAU,CAAC;oBACxC,IAAI,UAAU,CAAC,IAAI,KAAK,OAAO,IAAI,UAAU,CAAC,IAAI,KAAK,mBAAmB,EAAE;wBAC1E,OAAO;qBACR;iBACF;gBAED,gBAAgB,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,uBAAuB;oBAC7B,MAAM,EAAE,SAAS;oBACjB,SAAS,EAAE,WAAW;oBACtB,MAAM,EAAE;wBACN,SAAS,EAAE,SAAS;wBACpB,MAAM,EAAE,yCAAyC;qBAClD;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skip.d.ts","sourceRoot":"","sources":["../../../src/rules/skip.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,eAAO,MAAM,mDAAmD,mCA4B9D,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createRule } from "@typespec/lint";
|
|
2
|
+
import { getOperationVerb } from "@typespec/http";
|
|
3
|
+
import { isSkip } from "../index.js";
|
|
4
|
+
import { reportDiagnostic } from "../lib.js";
|
|
5
|
+
/**
|
|
6
|
+
* @skip applies to get operations that return collections.
|
|
7
|
+
*/
|
|
8
|
+
export const skipAppliesToGetOperationsThatReturnCollectionsRule = createRule({
|
|
9
|
+
name: "skip-applies-to-get-operations-that-return-collections",
|
|
10
|
+
create({ program }) {
|
|
11
|
+
return {
|
|
12
|
+
operation: (operation) => {
|
|
13
|
+
if (!isSkip(program, operation)) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (getOperationVerb(program, operation) === "get") {
|
|
17
|
+
const returnType = operation.returnType;
|
|
18
|
+
if (returnType.kind === "Model" && returnType.name === "PagedListResponse") {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
reportDiagnostic(program, {
|
|
23
|
+
code: "decorator-invalid-use",
|
|
24
|
+
target: operation,
|
|
25
|
+
messageId: "wrongType",
|
|
26
|
+
format: {
|
|
27
|
+
decorator: "@skip",
|
|
28
|
+
target: "get operation that returns a collection",
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=skip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skip.js","sourceRoot":"","sources":["../../../src/rules/skip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C;;GAEG;AACH,MAAM,CAAC,MAAM,mDAAmD,GAAG,UAAU,CAAC;IAC5E,IAAI,EAAE,wDAAwD;IAC9D,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,SAAS,EAAE,CAAC,SAAS,EAAE,EAAE;gBACvB,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE;oBAC/B,OAAO;iBACR;gBAED,IAAI,gBAAgB,CAAC,OAAO,EAAE,SAAS,CAAC,KAAK,KAAK,EAAE;oBAClD,MAAM,UAAU,GAAG,SAAS,CAAC,UAAU,CAAC;oBACxC,IAAI,UAAU,CAAC,IAAI,KAAK,OAAO,IAAI,UAAU,CAAC,IAAI,KAAK,mBAAmB,EAAE;wBAC1E,OAAO;qBACR;iBACF;gBAED,gBAAgB,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,uBAAuB;oBAC7B,MAAM,EAAE,SAAS;oBACjB,SAAS,EAAE,WAAW;oBACtB,MAAM,EAAE;wBACN,SAAS,EAAE,OAAO;wBAClB,MAAM,EAAE,yCAAyC;qBAClD;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"top.d.ts","sourceRoot":"","sources":["../../../src/rules/top.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,eAAO,MAAM,kDAAkD,mCA4B7D,CAAC"}
|