@azure-tools/typespec-azure-resource-manager 0.34.0-dev.2 → 0.34.0-dev.4
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/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 +89 -516
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/lib.js +78 -171
- package/dist/src/lib.js.map +1 -1
- package/dist/src/namespace.d.ts.map +1 -1
- package/dist/src/namespace.js +15 -15
- package/dist/src/namespace.js.map +1 -1
- package/dist/src/operations.d.ts.map +1 -1
- package/dist/src/operations.js +6 -7
- package/dist/src/operations.js.map +1 -1
- package/dist/src/private.decorators.d.ts.map +1 -1
- package/dist/src/private.decorators.js +7 -8
- package/dist/src/private.decorators.js.map +1 -1
- package/dist/src/resource.d.ts.map +1 -1
- package/dist/src/resource.js +12 -12
- package/dist/src/resource.js.map +1 -1
- package/dist/src/rules/arm-resource-action-no-segment.d.ts +3 -1
- package/dist/src/rules/arm-resource-action-no-segment.d.ts.map +1 -1
- package/dist/src/rules/arm-resource-action-no-segment.js +9 -6
- package/dist/src/rules/arm-resource-action-no-segment.js.map +1 -1
- package/dist/src/rules/arm-resource-duplicate-property.d.ts +4 -0
- package/dist/src/rules/arm-resource-duplicate-property.d.ts.map +1 -0
- package/dist/src/rules/arm-resource-duplicate-property.js +43 -0
- package/dist/src/rules/arm-resource-duplicate-property.js.map +1 -0
- package/dist/src/rules/arm-resource-interfaces.d.ts +4 -0
- package/dist/src/rules/arm-resource-interfaces.d.ts.map +1 -0
- package/dist/src/rules/arm-resource-interfaces.js +26 -0
- package/dist/src/rules/arm-resource-interfaces.js.map +1 -0
- package/dist/src/rules/arm-resource-invalid-action-verb.d.ts +4 -0
- package/dist/src/rules/arm-resource-invalid-action-verb.d.ts.map +1 -0
- package/dist/src/rules/arm-resource-invalid-action-verb.js +28 -0
- package/dist/src/rules/arm-resource-invalid-action-verb.js.map +1 -0
- package/dist/src/rules/arm-resource-invalid-envelope-property.d.ts +4 -0
- package/dist/src/rules/arm-resource-invalid-envelope-property.d.ts.map +1 -0
- package/dist/src/rules/{arm-resource-properties.js → arm-resource-invalid-envelope-property.js} +13 -23
- package/dist/src/rules/arm-resource-invalid-envelope-property.js.map +1 -0
- package/dist/src/rules/arm-resource-invalid-version-format.d.ts +4 -1
- package/dist/src/rules/arm-resource-invalid-version-format.d.ts.map +1 -1
- package/dist/src/rules/arm-resource-invalid-version-format.js +12 -9
- package/dist/src/rules/arm-resource-invalid-version-format.js.map +1 -1
- package/dist/src/rules/arm-resource-key-invalid-chars.d.ts +4 -0
- package/dist/src/rules/arm-resource-key-invalid-chars.d.ts.map +1 -0
- package/dist/src/rules/arm-resource-key-invalid-chars.js +30 -0
- package/dist/src/rules/arm-resource-key-invalid-chars.js.map +1 -0
- package/dist/src/rules/arm-resource-operation-response.d.ts +4 -0
- package/dist/src/rules/arm-resource-operation-response.d.ts.map +1 -0
- package/dist/src/rules/{arm-resource-operations.js → arm-resource-operation-response.js} +24 -22
- package/dist/src/rules/arm-resource-operation-response.js.map +1 -0
- package/dist/src/rules/arm-resource-patch.d.ts +6 -0
- package/dist/src/rules/arm-resource-patch.d.ts.map +1 -0
- package/dist/src/rules/arm-resource-patch.js +108 -0
- package/dist/src/rules/arm-resource-patch.js.map +1 -0
- package/dist/src/rules/arm-resource-path-invalid-chars.d.ts +4 -0
- package/dist/src/rules/arm-resource-path-invalid-chars.d.ts.map +1 -0
- package/dist/src/rules/arm-resource-path-invalid-chars.js +37 -0
- package/dist/src/rules/arm-resource-path-invalid-chars.js.map +1 -0
- package/dist/src/rules/arm-resource-provisioning-state-rule.d.ts +4 -1
- package/dist/src/rules/arm-resource-provisioning-state-rule.d.ts.map +1 -1
- package/dist/src/rules/arm-resource-provisioning-state-rule.js +13 -11
- package/dist/src/rules/arm-resource-provisioning-state-rule.js.map +1 -1
- package/dist/src/rules/beyond-nesting-levels.d.ts +3 -1
- package/dist/src/rules/beyond-nesting-levels.d.ts.map +1 -1
- package/dist/src/rules/beyond-nesting-levels.js +10 -7
- package/dist/src/rules/beyond-nesting-levels.js.map +1 -1
- package/dist/src/rules/core-operations.d.ts +5 -1
- package/dist/src/rules/core-operations.d.ts.map +1 -1
- package/dist/src/rules/core-operations.js +19 -121
- package/dist/src/rules/core-operations.js.map +1 -1
- package/dist/src/rules/delete-operation.d.ts +3 -1
- package/dist/src/rules/delete-operation.d.ts.map +1 -1
- package/dist/src/rules/delete-operation.js +10 -7
- package/dist/src/rules/delete-operation.js.map +1 -1
- package/dist/src/rules/envelope-properties.d.ts +3 -1
- package/dist/src/rules/envelope-properties.d.ts.map +1 -1
- package/dist/src/rules/envelope-properties.js +12 -31
- package/dist/src/rules/envelope-properties.js.map +1 -1
- package/dist/src/rules/list-operation.d.ts +3 -1
- package/dist/src/rules/list-operation.d.ts.map +1 -1
- package/dist/src/rules/list-operation.js +9 -6
- package/dist/src/rules/list-operation.js.map +1 -1
- package/dist/src/rules/no-response-body.d.ts +3 -1
- package/dist/src/rules/no-response-body.d.ts.map +1 -1
- package/dist/src/rules/no-response-body.js +10 -7
- package/dist/src/rules/no-response-body.js.map +1 -1
- package/dist/src/rules/operations-interface-missing.d.ts +3 -1
- package/dist/src/rules/operations-interface-missing.d.ts.map +1 -1
- package/dist/src/rules/operations-interface-missing.js +12 -10
- package/dist/src/rules/operations-interface-missing.js.map +1 -1
- package/dist/src/rules/patch-envelope-properties.d.ts +4 -0
- package/dist/src/rules/patch-envelope-properties.d.ts.map +1 -0
- package/dist/src/rules/patch-envelope-properties.js +44 -0
- package/dist/src/rules/patch-envelope-properties.js.map +1 -0
- package/dist/src/rules/resource-name.d.ts +4 -1
- package/dist/src/rules/resource-name.d.ts.map +1 -1
- package/dist/src/rules/resource-name.js +14 -11
- package/dist/src/rules/resource-name.js.map +1 -1
- package/dist/src/rules/retry-after.d.ts +3 -1
- package/dist/src/rules/retry-after.d.ts.map +1 -1
- package/dist/src/rules/retry-after.js +10 -7
- package/dist/src/rules/retry-after.js.map +1 -1
- package/dist/src/rules/unsupported-types.d.ts +3 -1
- package/dist/src/rules/unsupported-types.d.ts.map +1 -1
- package/dist/src/rules/unsupported-types.js +9 -6
- package/dist/src/rules/unsupported-types.js.map +1 -1
- package/dist/src/rules/utils.d.ts +3 -1
- package/dist/src/rules/utils.d.ts.map +1 -1
- package/dist/src/rules/utils.js +18 -0
- package/dist/src/rules/utils.js.map +1 -1
- package/dist/src/state.d.ts +13 -0
- package/dist/src/state.d.ts.map +1 -0
- package/dist/src/state.js +20 -0
- package/dist/src/state.js.map +1 -0
- package/lib/arm.tsp +1 -0
- package/lib/private-links.tsp +137 -0
- package/package.json +2 -4
- package/dist/src/linter.d.ts +0 -3
- package/dist/src/linter.d.ts.map +0 -1
- package/dist/src/linter.js +0 -42
- package/dist/src/linter.js.map +0 -1
- package/dist/src/rules/arm-resource-invalid-chars.d.ts +0 -2
- package/dist/src/rules/arm-resource-invalid-chars.d.ts.map +0 -1
- package/dist/src/rules/arm-resource-invalid-chars.js +0 -61
- package/dist/src/rules/arm-resource-invalid-chars.js.map +0 -1
- package/dist/src/rules/arm-resource-operations.d.ts +0 -2
- package/dist/src/rules/arm-resource-operations.d.ts.map +0 -1
- package/dist/src/rules/arm-resource-operations.js.map +0 -1
- package/dist/src/rules/arm-resource-properties.d.ts +0 -2
- package/dist/src/rules/arm-resource-properties.d.ts.map +0 -1
- package/dist/src/rules/arm-resource-properties.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-operations.js","sourceRoot":"","sources":["../../../src/rules/core-operations.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"core-operations.js","sourceRoot":"","sources":["../../../src/rules/core-operations.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,UAAU,EACV,UAAU,EACV,YAAY,GACb,MAAM,oBAAoB,CAAC;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AO,KAAK,CAAC;IAC3C,MAAM,WAAW,GAAsB,cAAc,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;IAC/E,IAAI,WAAW,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IAC5C,OAAO,CACL,WAAW,CAAC,IAAI,KAAK,qBAAqB;QAC1C,gBAAgB,CAAC,OAAO,EAAE,WAAW,CAAC,KAAK,uBAAuB,CACnE,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,OAAgB,EAAE,KAAY;IACrD,IAAI,KAAK,CAAC,UAAU,KAAK,SAAS,IAAI,KAAK,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAChF,MAAM,gBAAgB,GAAoB,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CACpF,cAAc,CAAC,OAAO,EAAE,CAAC,CAAC,CAC3B,CAAC;IACF,OAAO,gBAAgB,KAAK,IAAI,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC,CAAC;AACpE,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* verify an resource should have delete operation
|
|
3
3
|
*/
|
|
4
|
-
export declare const deleteOperationMissingRule: import("@typespec/
|
|
4
|
+
export declare const deleteOperationMissingRule: import("@typespec/compiler").LinterRuleDefinition<"no-resource-delete-operation", {
|
|
5
|
+
readonly default: "The resource must have a delete operation.";
|
|
6
|
+
}>;
|
|
5
7
|
//# sourceMappingURL=delete-operation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete-operation.d.ts","sourceRoot":"","sources":["../../../src/rules/delete-operation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"delete-operation.d.ts","sourceRoot":"","sources":["../../../src/rules/delete-operation.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,eAAO,MAAM,0BAA0B;;EAyBrC,CAAC"}
|
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
import { createRule } from "@typespec/
|
|
2
|
-
import { reportDiagnostic } from "../lib.js";
|
|
1
|
+
import { createRule } from "@typespec/compiler";
|
|
3
2
|
import { getArmResources } from "../resource.js";
|
|
4
3
|
import { getInterface } from "./utils.js";
|
|
5
4
|
/**
|
|
6
5
|
* verify an resource should have delete operation
|
|
7
6
|
*/
|
|
8
7
|
export const deleteOperationMissingRule = createRule({
|
|
9
|
-
name: "delete-operation
|
|
10
|
-
|
|
8
|
+
name: "no-resource-delete-operation",
|
|
9
|
+
severity: "warning",
|
|
10
|
+
description: "Check for resources that must have a delete operation.",
|
|
11
|
+
messages: {
|
|
12
|
+
default: `The resource must have a delete operation.`,
|
|
13
|
+
},
|
|
14
|
+
create(context) {
|
|
11
15
|
return {
|
|
12
16
|
model: (model) => {
|
|
13
|
-
const resources = getArmResources(program);
|
|
17
|
+
const resources = getArmResources(context.program);
|
|
14
18
|
const armResource = resources.find((re) => re.typespecType === model);
|
|
15
19
|
if (armResource &&
|
|
16
20
|
armResource.operations.lifecycle.createOrUpdate &&
|
|
17
21
|
!armResource.operations.lifecycle.delete) {
|
|
18
22
|
const resourceInterface = getInterface(armResource);
|
|
19
|
-
reportDiagnostic(
|
|
20
|
-
code: "no-resource-delete-operation",
|
|
23
|
+
context.reportDiagnostic({
|
|
21
24
|
target: resourceInterface || model,
|
|
22
25
|
});
|
|
23
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete-operation.js","sourceRoot":"","sources":["../../../src/rules/delete-operation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"delete-operation.js","sourceRoot":"","sources":["../../../src/rules/delete-operation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,UAAU,CAAC;IACnD,IAAI,EAAE,8BAA8B;IACpC,QAAQ,EAAE,SAAS;IACnB,WAAW,EAAE,wDAAwD;IACrE,QAAQ,EAAE;QACR,OAAO,EAAE,4CAA4C;KACtD;IACD,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,KAAK,EAAE,CAAC,KAAY,EAAE,EAAE;gBACtB,MAAM,SAAS,GAAG,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;gBACnD,MAAM,WAAW,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,YAAY,KAAK,KAAK,CAAC,CAAC;gBACtE,IACE,WAAW;oBACX,WAAW,CAAC,UAAU,CAAC,SAAS,CAAC,cAAc;oBAC/C,CAAC,WAAW,CAAC,UAAU,CAAC,SAAS,CAAC,MAAM,EACxC;oBACA,MAAM,iBAAiB,GAAG,YAAY,CAAC,WAAW,CAAC,CAAC;oBACpD,OAAO,CAAC,gBAAgB,CAAC;wBACvB,MAAM,EAAE,iBAAiB,IAAI,KAAK;qBACnC,CAAC,CAAC;iBACJ;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* verify the 'identity' property should be present in the update resource properties.
|
|
3
3
|
*/
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const envelopePropertiesRules: import("@typespec/compiler").LinterRuleDefinition<"empty-updateable-properties", {
|
|
5
|
+
readonly default: "The RP-specific properties of the Resource (as defined in the 'properties' property) should have at least one updateable property. Properties are updateable if they do not have a '@visibility' decorator, or if they include 'update' in the '@visibility' decorator arguments.";
|
|
6
|
+
}>;
|
|
5
7
|
//# sourceMappingURL=envelope-properties.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"envelope-properties.d.ts","sourceRoot":"","sources":["../../../src/rules/envelope-properties.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"envelope-properties.d.ts","sourceRoot":"","sources":["../../../src/rules/envelope-properties.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,eAAO,MAAM,uBAAuB;;EAwClC,CAAC"}
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
import { getProperty } from "@typespec/compiler";
|
|
2
|
-
import { createRule } from "@typespec/lint";
|
|
3
|
-
import { reportDiagnostic } from "../lib.js";
|
|
1
|
+
import { createRule, getProperty } from "@typespec/compiler";
|
|
4
2
|
import { getArmResources } from "../resource.js";
|
|
5
3
|
import { getProperties } from "./utils.js";
|
|
6
4
|
/**
|
|
7
5
|
* verify the 'identity' property should be present in the update resource properties.
|
|
8
6
|
*/
|
|
9
|
-
export const
|
|
10
|
-
name: "
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
export const envelopePropertiesRules = createRule({
|
|
8
|
+
name: "empty-updateable-properties",
|
|
9
|
+
severity: "warning",
|
|
10
|
+
description: "Should have updateable properties.",
|
|
11
|
+
messages: {
|
|
12
|
+
default: `The RP-specific properties of the Resource (as defined in the 'properties' property) should have at least one updateable property. Properties are updateable if they do not have a '@visibility' decorator, or if they include 'update' in the '@visibility' decorator arguments.`,
|
|
13
|
+
},
|
|
14
|
+
create(context) {
|
|
13
15
|
return {
|
|
14
16
|
model: (model) => {
|
|
15
17
|
var _a, _b, _c;
|
|
16
|
-
const resources = getArmResources(program);
|
|
18
|
+
const resources = getArmResources(context.program);
|
|
17
19
|
const armResource = resources.find((re) => re.typespecType === model);
|
|
18
20
|
if (armResource &&
|
|
19
21
|
armResource.operations.lifecycle.update &&
|
|
@@ -21,42 +23,21 @@ export const envelopPropertiesRules = createRule({
|
|
|
21
23
|
const updateOperationProperties = (_a = armResource.operations.lifecycle.update.httpOperation.parameters.body) === null || _a === void 0 ? void 0 : _a.type;
|
|
22
24
|
if ((updateOperationProperties === null || updateOperationProperties === void 0 ? void 0 : updateOperationProperties.kind) === "Model") {
|
|
23
25
|
if (getProperties(updateOperationProperties).length < 1) {
|
|
24
|
-
reportDiagnostic(
|
|
25
|
-
code: "empty-updateable-properties",
|
|
26
|
+
context.reportDiagnostic({
|
|
26
27
|
target: model,
|
|
27
28
|
});
|
|
28
29
|
}
|
|
29
30
|
const updateablePropertiesBag = getProperty(updateOperationProperties, "properties");
|
|
30
31
|
if ((updateablePropertiesBag === null || updateablePropertiesBag === void 0 ? void 0 : updateablePropertiesBag.type.kind) === "Model" &&
|
|
31
32
|
getProperties(updateablePropertiesBag.type).length === 0) {
|
|
32
|
-
reportDiagnostic(
|
|
33
|
-
code: "empty-updateable-properties",
|
|
33
|
+
context.reportDiagnostic({
|
|
34
34
|
target: (_c = (_b = model.properties.get("properties")) === null || _b === void 0 ? void 0 : _b.type) !== null && _c !== void 0 ? _c : model,
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
const missingProperties = [];
|
|
39
|
-
for (const property of patchEnvelopeProperties) {
|
|
40
|
-
if (!checkForPatchProperty(property, model, updateOperationProperties)) {
|
|
41
|
-
missingProperties.push(property);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
if (missingProperties.length > 0) {
|
|
45
|
-
reportDiagnostic(program, {
|
|
46
|
-
code: "patch-envelope",
|
|
47
|
-
format: { resourceName: model.name, propertyName: missingProperties.join(", ") },
|
|
48
|
-
target: (updateOperationProperties === null || updateOperationProperties === void 0 ? void 0 : updateOperationProperties.kind) === "Model"
|
|
49
|
-
? updateOperationProperties
|
|
50
|
-
: armResource.operations.lifecycle.update.operation,
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
38
|
}
|
|
54
39
|
},
|
|
55
40
|
};
|
|
56
41
|
},
|
|
57
42
|
});
|
|
58
|
-
function checkForPatchProperty(propertyName, resourceModel, patchModel) {
|
|
59
|
-
return (getProperty(resourceModel, propertyName) === undefined ||
|
|
60
|
-
((patchModel === null || patchModel === void 0 ? void 0 : patchModel.kind) === "Model" && getProperty(patchModel, propertyName) !== undefined));
|
|
61
|
-
}
|
|
62
43
|
//# sourceMappingURL=envelope-properties.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"envelope-properties.js","sourceRoot":"","sources":["../../../src/rules/envelope-properties.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"envelope-properties.js","sourceRoot":"","sources":["../../../src/rules/envelope-properties.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,UAAU,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEpE,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,UAAU,CAAC;IAChD,IAAI,EAAE,6BAA6B;IACnC,QAAQ,EAAE,SAAS;IACnB,WAAW,EAAE,oCAAoC;IACjD,QAAQ,EAAE;QACR,OAAO,EAAE,oRAAoR;KAC9R;IACD,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,KAAK,EAAE,CAAC,KAAY,EAAE,EAAE;;gBACtB,MAAM,SAAS,GAAG,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;gBACnD,MAAM,WAAW,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,YAAY,KAAK,KAAK,CAAC,CAAC;gBAEtE,IACE,WAAW;oBACX,WAAW,CAAC,UAAU,CAAC,SAAS,CAAC,MAAM;oBACvC,WAAW,CAAC,UAAU,CAAC,SAAS,CAAC,cAAc,EAC/C;oBACA,MAAM,yBAAyB,GAC7B,MAAA,WAAW,CAAC,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC,IAAI,0CAAE,IAAI,CAAC;oBAC9E,IAAI,CAAA,yBAAyB,aAAzB,yBAAyB,uBAAzB,yBAAyB,CAAE,IAAI,MAAK,OAAO,EAAE;wBAC/C,IAAI,aAAa,CAAC,yBAAyB,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;4BACvD,OAAO,CAAC,gBAAgB,CAAC;gCACvB,MAAM,EAAE,KAAK;6BACd,CAAC,CAAC;yBACJ;wBACD,MAAM,uBAAuB,GAAG,WAAW,CAAC,yBAAyB,EAAE,YAAY,CAAC,CAAC;wBACrF,IACE,CAAA,uBAAuB,aAAvB,uBAAuB,uBAAvB,uBAAuB,CAAE,IAAI,CAAC,IAAI,MAAK,OAAO;4BAC9C,aAAa,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,EACxD;4BACA,OAAO,CAAC,gBAAgB,CAAC;gCACvB,MAAM,EAAE,MAAA,MAAA,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,YAAY,CAAC,0CAAE,IAAI,mCAAI,KAAK;6BAC1D,CAAC,CAAC;yBACJ;qBACF;iBACF;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* verify tenant and extension resources do not define list by subscription
|
|
3
3
|
*/
|
|
4
|
-
export declare const listBySubscriptionRule: import("@typespec/
|
|
4
|
+
export declare const listBySubscriptionRule: import("@typespec/compiler").LinterRuleDefinition<"improper-subscription-list-operation", {
|
|
5
|
+
readonly default: "Tenant and Extension resources should not define a list by subscription operation.";
|
|
6
|
+
}>;
|
|
5
7
|
//# sourceMappingURL=list-operation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-operation.d.ts","sourceRoot":"","sources":["../../../src/rules/list-operation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"list-operation.d.ts","sourceRoot":"","sources":["../../../src/rules/list-operation.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,eAAO,MAAM,sBAAsB;;EA8BjC,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { createRule } from "@typespec/
|
|
2
|
-
import { reportDiagnostic } from "../lib.js";
|
|
1
|
+
import { createRule } from "@typespec/compiler";
|
|
3
2
|
import { getArmResources, getResourceBaseType, ResourceBaseType } from "../resource.js";
|
|
4
3
|
import { getInterface } from "./utils.js";
|
|
5
4
|
/**
|
|
@@ -7,20 +6,24 @@ import { getInterface } from "./utils.js";
|
|
|
7
6
|
*/
|
|
8
7
|
export const listBySubscriptionRule = createRule({
|
|
9
8
|
name: "improper-subscription-list-operation",
|
|
10
|
-
|
|
9
|
+
severity: "warning",
|
|
10
|
+
description: `Tenant and Extension resources should not define a list by subscription operation.`,
|
|
11
|
+
messages: {
|
|
12
|
+
default: `Tenant and Extension resources should not define a list by subscription operation.`,
|
|
13
|
+
},
|
|
14
|
+
create(context) {
|
|
11
15
|
return {
|
|
12
16
|
root: (program) => {
|
|
13
17
|
const resources = getArmResources(program);
|
|
14
18
|
for (const armResource of resources) {
|
|
15
19
|
if (armResource && armResource.operations.lists) {
|
|
16
|
-
const baseType = getResourceBaseType(program, armResource.typespecType);
|
|
20
|
+
const baseType = getResourceBaseType(context.program, armResource.typespecType);
|
|
17
21
|
if (baseType === ResourceBaseType.Extension || baseType === ResourceBaseType.Tenant) {
|
|
18
22
|
for (const listOperationName of Object.keys(armResource.operations.lists)) {
|
|
19
23
|
const listOperation = armResource.operations.lists[listOperationName];
|
|
20
24
|
if (listOperation.path.includes("{subscriptionId}")) {
|
|
21
25
|
const resourceInterface = getInterface(armResource);
|
|
22
|
-
reportDiagnostic(
|
|
23
|
-
code: "improper-subscription-list-operation",
|
|
26
|
+
context.reportDiagnostic({
|
|
24
27
|
target: resourceInterface !== null && resourceInterface !== void 0 ? resourceInterface : armResource.typespecType,
|
|
25
28
|
});
|
|
26
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-operation.js","sourceRoot":"","sources":["../../../src/rules/list-operation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"list-operation.js","sourceRoot":"","sources":["../../../src/rules/list-operation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAW,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACxF,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,UAAU,CAAC;IAC/C,IAAI,EAAE,sCAAsC;IAC5C,QAAQ,EAAE,SAAS;IACnB,WAAW,EAAE,oFAAoF;IACjG,QAAQ,EAAE;QACR,OAAO,EAAE,oFAAoF;KAC9F;IACD,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,IAAI,EAAE,CAAC,OAAgB,EAAE,EAAE;gBACzB,MAAM,SAAS,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;gBAC3C,KAAK,MAAM,WAAW,IAAI,SAAS,EAAE;oBACnC,IAAI,WAAW,IAAI,WAAW,CAAC,UAAU,CAAC,KAAK,EAAE;wBAC/C,MAAM,QAAQ,GAAG,mBAAmB,CAAC,OAAO,CAAC,OAAO,EAAE,WAAW,CAAC,YAAY,CAAC,CAAC;wBAChF,IAAI,QAAQ,KAAK,gBAAgB,CAAC,SAAS,IAAI,QAAQ,KAAK,gBAAgB,CAAC,MAAM,EAAE;4BACnF,KAAK,MAAM,iBAAiB,IAAI,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;gCACzE,MAAM,aAAa,GAAG,WAAW,CAAC,UAAU,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;gCACtE,IAAI,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE;oCACnD,MAAM,iBAAiB,GAAG,YAAY,CAAC,WAAW,CAAC,CAAC;oCACpD,OAAO,CAAC,gBAAgB,CAAC;wCACvB,MAAM,EAAE,iBAAiB,aAAjB,iBAAiB,cAAjB,iBAAiB,GAAI,WAAW,CAAC,YAAY;qCACtD,CAAC,CAAC;iCACJ;6BACF;yBACF;qBACF;iBACF;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* verify an operation returns 202 should not contains response body.
|
|
3
3
|
*/
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const noResponseBodyRule: import("@typespec/compiler").LinterRuleDefinition<"no-response-body", {
|
|
5
|
+
readonly default: "The body of 202 response should be empty.";
|
|
6
|
+
}>;
|
|
5
7
|
//# sourceMappingURL=no-response-body.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-response-body.d.ts","sourceRoot":"","sources":["../../../src/rules/no-response-body.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"no-response-body.d.ts","sourceRoot":"","sources":["../../../src/rules/no-response-body.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,eAAO,MAAM,kBAAkB;;EAwB7B,CAAC"}
|
|
@@ -1,22 +1,25 @@
|
|
|
1
|
+
import { createRule } from "@typespec/compiler";
|
|
1
2
|
import { getResponsesForOperation } from "@typespec/http";
|
|
2
|
-
import { createRule } from "@typespec/lint";
|
|
3
|
-
import { reportDiagnostic } from "../lib.js";
|
|
4
3
|
import { isTemplatedInterfaceOperation } from "./utils.js";
|
|
5
4
|
/**
|
|
6
5
|
* verify an operation returns 202 should not contains response body.
|
|
7
6
|
*/
|
|
8
|
-
export const
|
|
7
|
+
export const noResponseBodyRule = createRule({
|
|
9
8
|
name: "no-response-body",
|
|
10
|
-
|
|
9
|
+
severity: "warning",
|
|
10
|
+
description: `The body of 202 response should be empty.`,
|
|
11
|
+
messages: {
|
|
12
|
+
default: `The body of 202 response should be empty.`,
|
|
13
|
+
},
|
|
14
|
+
create(context) {
|
|
11
15
|
return {
|
|
12
16
|
operation: (op) => {
|
|
13
17
|
if (isTemplatedInterfaceOperation(op)) {
|
|
14
18
|
return;
|
|
15
19
|
}
|
|
16
|
-
const responses = getResponsesForOperation(program, op)[0].find((v) => v.statusCode === "202");
|
|
20
|
+
const responses = getResponsesForOperation(context.program, op)[0].find((v) => v.statusCode === "202");
|
|
17
21
|
if (responses && responses.responses.some((v) => v.body)) {
|
|
18
|
-
reportDiagnostic(
|
|
19
|
-
code: "no-response-body",
|
|
22
|
+
context.reportDiagnostic({
|
|
20
23
|
target: op,
|
|
21
24
|
});
|
|
22
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-response-body.js","sourceRoot":"","sources":["../../../src/rules/no-response-body.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"no-response-body.js","sourceRoot":"","sources":["../../../src/rules/no-response-body.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,OAAO,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAE3D;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,UAAU,CAAC;IAC3C,IAAI,EAAE,kBAAkB;IACxB,QAAQ,EAAE,SAAS;IACnB,WAAW,EAAE,2CAA2C;IACxD,QAAQ,EAAE;QACR,OAAO,EAAE,2CAA2C;KACrD;IACD,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,SAAS,EAAE,CAAC,EAAa,EAAE,EAAE;gBAC3B,IAAI,6BAA6B,CAAC,EAAE,CAAC,EAAE;oBACrC,OAAO;iBACR;gBACD,MAAM,SAAS,GAAG,wBAAwB,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CACrE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,KAAK,KAAK,CAC9B,CAAC;gBACF,IAAI,SAAS,IAAI,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE;oBACxD,OAAO,CAAC,gBAAgB,CAAC;wBACvB,MAAM,EAAE,EAAE;qBACX,CAAC,CAAC;iBACJ;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* verify that the Arm Operations interface is included.
|
|
3
3
|
*/
|
|
4
|
-
export declare const operationsInterfaceMissingRule: import("@typespec/
|
|
4
|
+
export declare const operationsInterfaceMissingRule: import("@typespec/compiler").LinterRuleDefinition<"missing-operations-endpoint", {
|
|
5
|
+
readonly default: import("@typespec/compiler").CallableMessage<[string]>;
|
|
6
|
+
}>;
|
|
5
7
|
//# sourceMappingURL=operations-interface-missing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations-interface-missing.d.ts","sourceRoot":"","sources":["../../../src/rules/operations-interface-missing.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"operations-interface-missing.d.ts","sourceRoot":"","sources":["../../../src/rules/operations-interface-missing.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,eAAO,MAAM,8BAA8B;;EAgCzC,CAAC"}
|
|
@@ -1,30 +1,32 @@
|
|
|
1
|
-
import { isService } from "@typespec/compiler";
|
|
2
|
-
import { createRule } from "@typespec/lint";
|
|
3
|
-
import { reportDiagnostic } from "../lib.js";
|
|
1
|
+
import { createRule, isService, paramMessage } from "@typespec/compiler";
|
|
4
2
|
import { getArmProviderNamespace } from "../namespace.js";
|
|
5
3
|
import { isArmOperationsListInterface } from "../private.decorators.js";
|
|
6
4
|
/**
|
|
7
5
|
* verify that the Arm Operations interface is included.
|
|
8
6
|
*/
|
|
9
7
|
export const operationsInterfaceMissingRule = createRule({
|
|
10
|
-
name: "operations-
|
|
11
|
-
|
|
8
|
+
name: "missing-operations-endpoint",
|
|
9
|
+
severity: "warning",
|
|
10
|
+
description: "Check for missing Operations interface.",
|
|
11
|
+
messages: {
|
|
12
|
+
default: paramMessage `Arm namespace ${"namespace"} is missing the Operations interface. Add "interface Operations extends Azure.ResourceManager.Operations {}".`,
|
|
13
|
+
},
|
|
14
|
+
create(context) {
|
|
12
15
|
return {
|
|
13
16
|
namespace: (namespace) => {
|
|
14
|
-
if (!isService(program, namespace)) {
|
|
17
|
+
if (!isService(context.program, namespace)) {
|
|
15
18
|
return;
|
|
16
19
|
}
|
|
17
|
-
const providerName = getArmProviderNamespace(program, namespace);
|
|
20
|
+
const providerName = getArmProviderNamespace(context.program, namespace);
|
|
18
21
|
if (!providerName) {
|
|
19
22
|
return;
|
|
20
23
|
}
|
|
21
24
|
for (const item of namespace.interfaces.values()) {
|
|
22
|
-
if (isArmOperationsListInterface(program, item)) {
|
|
25
|
+
if (isArmOperationsListInterface(context.program, item)) {
|
|
23
26
|
return;
|
|
24
27
|
}
|
|
25
28
|
}
|
|
26
|
-
reportDiagnostic(
|
|
27
|
-
code: "missing-operations-endpoint",
|
|
29
|
+
context.reportDiagnostic({
|
|
28
30
|
format: {
|
|
29
31
|
namespace: namespace.name,
|
|
30
32
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations-interface-missing.js","sourceRoot":"","sources":["../../../src/rules/operations-interface-missing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"operations-interface-missing.js","sourceRoot":"","sources":["../../../src/rules/operations-interface-missing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AAExE;;GAEG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,UAAU,CAAC;IACvD,IAAI,EAAE,6BAA6B;IACnC,QAAQ,EAAE,SAAS;IACnB,WAAW,EAAE,yCAAyC;IACtD,QAAQ,EAAE;QACR,OAAO,EAAE,YAAY,CAAA,iBAAiB,WAAW,+GAA+G;KACjK;IACD,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,SAAS,EAAE,CAAC,SAAS,EAAE,EAAE;gBACvB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE;oBAC1C,OAAO;iBACR;gBAED,MAAM,YAAY,GAAG,uBAAuB,CAAC,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;gBACzE,IAAI,CAAC,YAAY,EAAE;oBACjB,OAAO;iBACR;gBACD,KAAK,MAAM,IAAI,IAAI,SAAS,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE;oBAChD,IAAI,4BAA4B,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE;wBACvD,OAAO;qBACR;iBACF;gBACD,OAAO,CAAC,gBAAgB,CAAC;oBACvB,MAAM,EAAE;wBACN,SAAS,EAAE,SAAS,CAAC,IAAI;qBAC1B;oBACD,MAAM,EAAE,SAAS;iBAClB,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patch-envelope-properties.d.ts","sourceRoot":"","sources":["../../../src/rules/patch-envelope-properties.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,4BAA4B;;EAwCvC,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { createRule, getProperty, paramMessage } from "@typespec/compiler";
|
|
2
|
+
import { getArmResources } from "../resource.js";
|
|
3
|
+
export const patchEnvelopePropertiesRules = createRule({
|
|
4
|
+
name: "patch-envelope",
|
|
5
|
+
severity: "warning",
|
|
6
|
+
description: "Patch envelope properties should match the resource properties.",
|
|
7
|
+
messages: {
|
|
8
|
+
default: paramMessage `The Resource PATCH request for resource '${"resourceName"}' is missing envelope properties: [${"propertyName"}]. Since these properties are supported in the resource, they must also be updatable via PATCH.`,
|
|
9
|
+
},
|
|
10
|
+
create(context) {
|
|
11
|
+
const patchEnvelopeProperties = ["identity", "managedBy", "plan", "sku", "tags"];
|
|
12
|
+
return {
|
|
13
|
+
model: (model) => {
|
|
14
|
+
var _a;
|
|
15
|
+
const resources = getArmResources(context.program);
|
|
16
|
+
const armResource = resources.find((re) => re.typespecType === model);
|
|
17
|
+
if (armResource &&
|
|
18
|
+
armResource.operations.lifecycle.update &&
|
|
19
|
+
armResource.operations.lifecycle.createOrUpdate) {
|
|
20
|
+
const updateOperationProperties = (_a = armResource.operations.lifecycle.update.httpOperation.parameters.body) === null || _a === void 0 ? void 0 : _a.type;
|
|
21
|
+
const missingProperties = [];
|
|
22
|
+
for (const property of patchEnvelopeProperties) {
|
|
23
|
+
if (!checkForPatchProperty(property, model, updateOperationProperties)) {
|
|
24
|
+
missingProperties.push(property);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (missingProperties.length > 0) {
|
|
28
|
+
context.reportDiagnostic({
|
|
29
|
+
format: { resourceName: model.name, propertyName: missingProperties.join(", ") },
|
|
30
|
+
target: (updateOperationProperties === null || updateOperationProperties === void 0 ? void 0 : updateOperationProperties.kind) === "Model"
|
|
31
|
+
? updateOperationProperties
|
|
32
|
+
: armResource.operations.lifecycle.update.operation,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
function checkForPatchProperty(propertyName, resourceModel, patchModel) {
|
|
41
|
+
return (getProperty(resourceModel, propertyName) === undefined ||
|
|
42
|
+
((patchModel === null || patchModel === void 0 ? void 0 : patchModel.kind) === "Model" && getProperty(patchModel, propertyName) !== undefined));
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=patch-envelope-properties.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patch-envelope-properties.js","sourceRoot":"","sources":["../../../src/rules/patch-envelope-properties.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAExF,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,MAAM,CAAC,MAAM,4BAA4B,GAAG,UAAU,CAAC;IACrD,IAAI,EAAE,gBAAgB;IACtB,QAAQ,EAAE,SAAS;IACnB,WAAW,EAAE,iEAAiE;IAC9E,QAAQ,EAAE;QACR,OAAO,EAAE,YAAY,CAAA,4CAA4C,cAAc,uCAAuC,cAAc,iGAAiG;KACtO;IACD,MAAM,CAAC,OAAO;QACZ,MAAM,uBAAuB,GAAa,CAAC,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;QAC3F,OAAO;YACL,KAAK,EAAE,CAAC,KAAY,EAAE,EAAE;;gBACtB,MAAM,SAAS,GAAG,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;gBACnD,MAAM,WAAW,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,YAAY,KAAK,KAAK,CAAC,CAAC;gBAEtE,IACE,WAAW;oBACX,WAAW,CAAC,UAAU,CAAC,SAAS,CAAC,MAAM;oBACvC,WAAW,CAAC,UAAU,CAAC,SAAS,CAAC,cAAc,EAC/C;oBACA,MAAM,yBAAyB,GAC7B,MAAA,WAAW,CAAC,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC,IAAI,0CAAE,IAAI,CAAC;oBAC9E,MAAM,iBAAiB,GAAa,EAAE,CAAC;oBACvC,KAAK,MAAM,QAAQ,IAAI,uBAAuB,EAAE;wBAC9C,IAAI,CAAC,qBAAqB,CAAC,QAAQ,EAAE,KAAK,EAAE,yBAAyB,CAAC,EAAE;4BACtE,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;yBAClC;qBACF;oBACD,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE;wBAChC,OAAO,CAAC,gBAAgB,CAAC;4BACvB,MAAM,EAAE,EAAE,YAAY,EAAE,KAAK,CAAC,IAAI,EAAE,YAAY,EAAE,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;4BAChF,MAAM,EACJ,CAAA,yBAAyB,aAAzB,yBAAyB,uBAAzB,yBAAyB,CAAE,IAAI,MAAK,OAAO;gCACzC,CAAC,CAAC,yBAAyB;gCAC3B,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS;yBACxD,CAAC,CAAC;qBACJ;iBACF;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAEH,SAAS,qBAAqB,CAC5B,YAAoB,EACpB,aAAoB,EACpB,UAA4B;IAE5B,OAAO,CACL,WAAW,CAAC,aAAa,EAAE,YAAY,CAAC,KAAK,SAAS;QACtD,CAAC,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,IAAI,MAAK,OAAO,IAAI,WAAW,CAAC,UAAU,EAAE,YAAY,CAAC,KAAK,SAAS,CAAC,CACtF,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The resource 'name' field should be marked with 'read' visibility and an @path decorator.
|
|
3
3
|
*/
|
|
4
|
-
export declare const resourceNameRule: import("@typespec/
|
|
4
|
+
export declare const resourceNameRule: import("@typespec/compiler").LinterRuleDefinition<"resource-name", {
|
|
5
|
+
readonly default: "The resource 'name' field should be marked with 'read' visibility and an @path decorator.";
|
|
6
|
+
readonly nameInvalid: "Arm resource name must contain only alphanumeric characters.";
|
|
7
|
+
}>;
|
|
5
8
|
//# sourceMappingURL=resource-name.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-name.d.ts","sourceRoot":"","sources":["../../../src/rules/resource-name.ts"],"names":[],"mappings":"AAYA;;GAEG;AACH,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"resource-name.d.ts","sourceRoot":"","sources":["../../../src/rules/resource-name.ts"],"names":[],"mappings":"AAYA;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;EA+C3B,CAAC"}
|
|
@@ -1,37 +1,40 @@
|
|
|
1
|
-
import { getProperty, getVisibility, } from "@typespec/compiler";
|
|
1
|
+
import { createRule, getProperty, getVisibility, } from "@typespec/compiler";
|
|
2
2
|
import * as http from "@typespec/http";
|
|
3
|
-
import { createRule } from "@typespec/lint";
|
|
4
|
-
import { reportDiagnostic } from "../lib.js";
|
|
5
3
|
import { getArmResources } from "../resource.js";
|
|
6
4
|
/**
|
|
7
5
|
* The resource 'name' field should be marked with 'read' visibility and an @path decorator.
|
|
8
6
|
*/
|
|
9
7
|
export const resourceNameRule = createRule({
|
|
10
8
|
name: "resource-name",
|
|
11
|
-
|
|
9
|
+
severity: "warning",
|
|
10
|
+
description: "Check the resource name.",
|
|
11
|
+
messages: {
|
|
12
|
+
default: `The resource 'name' field should be marked with 'read' visibility and an @path decorator.`,
|
|
13
|
+
nameInvalid: "Arm resource name must contain only alphanumeric characters.",
|
|
14
|
+
},
|
|
15
|
+
create(context) {
|
|
12
16
|
return {
|
|
13
17
|
model: (model) => {
|
|
14
|
-
const resources = getArmResources(program);
|
|
18
|
+
const resources = getArmResources(context.program);
|
|
15
19
|
const armResource = resources.find((re) => re.typespecType === model);
|
|
16
20
|
if (armResource) {
|
|
17
21
|
if (!checkResourceModelName(model.name)) {
|
|
18
|
-
reportDiagnostic(
|
|
19
|
-
|
|
22
|
+
context.reportDiagnostic({
|
|
23
|
+
messageId: "nameInvalid",
|
|
20
24
|
target: model,
|
|
21
25
|
});
|
|
22
26
|
}
|
|
23
27
|
// check that the name property is properly attributed
|
|
24
28
|
const name = getProperty(model, "name");
|
|
25
29
|
if (name && checkResourceName(name)) {
|
|
26
|
-
reportDiagnostic(
|
|
27
|
-
code: "resource-name",
|
|
30
|
+
context.reportDiagnostic({
|
|
28
31
|
target: name,
|
|
29
32
|
});
|
|
30
33
|
}
|
|
31
34
|
}
|
|
32
35
|
function checkResourceName(nameProp) {
|
|
33
|
-
const visibilities = getVisibility(program, nameProp);
|
|
34
|
-
return (!http.isPathParam(program, nameProp) ||
|
|
36
|
+
const visibilities = getVisibility(context.program, nameProp);
|
|
37
|
+
return (!http.isPathParam(context.program, nameProp) ||
|
|
35
38
|
!visibilities ||
|
|
36
39
|
visibilities.length !== 1 ||
|
|
37
40
|
visibilities[0] !== "read");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-name.js","sourceRoot":"","sources":["../../../src/rules/resource-name.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"resource-name.js","sourceRoot":"","sources":["../../../src/rules/resource-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,UAAU,EACV,WAAW,EACX,aAAa,GACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AAEvC,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAU,CAAC;IACzC,IAAI,EAAE,eAAe;IACrB,QAAQ,EAAE,SAAS;IACnB,WAAW,EAAE,0BAA0B;IACvC,QAAQ,EAAE;QACR,OAAO,EAAE,2FAA2F;QACpG,WAAW,EAAE,8DAA8D;KAC5E;IACD,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,KAAK,EAAE,CAAC,KAAY,EAAE,EAAE;gBACtB,MAAM,SAAS,GAAG,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;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Rule: import("@typespec/
|
|
4
|
+
export declare const retryAfterRule: import("@typespec/compiler").LinterRuleDefinition<"retry-after", {
|
|
5
|
+
readonly default: "For long-running operations, the Retry-After header indicates how long the client should wait before polling the operation status, please add this header to the 201 or 202 response for this operation.";
|
|
6
|
+
}>;
|
|
5
7
|
//# sourceMappingURL=retry-after.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retry-after.d.ts","sourceRoot":"","sources":["../../../src/rules/retry-after.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"retry-after.d.ts","sourceRoot":"","sources":["../../../src/rules/retry-after.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,eAAO,MAAM,cAAc;;EAsBzB,CAAC"}
|
|
@@ -1,23 +1,26 @@
|
|
|
1
|
+
import { createRule } from "@typespec/compiler";
|
|
1
2
|
import { getResponsesForOperation } from "@typespec/http";
|
|
2
|
-
import { createRule } from "@typespec/lint";
|
|
3
3
|
import { getExtensions } from "@typespec/openapi";
|
|
4
|
-
import { reportDiagnostic } from "../lib.js";
|
|
5
4
|
import { isTemplatedInterfaceOperation } from "./utils.js";
|
|
6
5
|
/**
|
|
7
6
|
* verify if retry-after header appears in response body .
|
|
8
7
|
*/
|
|
9
8
|
export const retryAfterRule = createRule({
|
|
10
9
|
name: "retry-after",
|
|
11
|
-
|
|
10
|
+
severity: "warning",
|
|
11
|
+
description: "Check if retry-after header appears in response body.",
|
|
12
|
+
messages: {
|
|
13
|
+
default: `For long-running operations, the Retry-After header indicates how long the client should wait before polling the operation status, please add this header to the 201 or 202 response for this operation.`,
|
|
14
|
+
},
|
|
15
|
+
create(context) {
|
|
12
16
|
return {
|
|
13
17
|
operation: (op) => {
|
|
14
18
|
if (isTemplatedInterfaceOperation(op)) {
|
|
15
19
|
return;
|
|
16
20
|
}
|
|
17
|
-
const isLRO = getExtensions(program, op).has("x-ms-long-running-operation");
|
|
18
|
-
if (isLRO && !hasRetryAfterHeader(program, op)) {
|
|
19
|
-
reportDiagnostic(
|
|
20
|
-
code: "retry-after",
|
|
21
|
+
const isLRO = getExtensions(context.program, op).has("x-ms-long-running-operation");
|
|
22
|
+
if (isLRO && !hasRetryAfterHeader(context.program, op)) {
|
|
23
|
+
context.reportDiagnostic({
|
|
21
24
|
target: op,
|
|
22
25
|
});
|
|
23
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retry-after.js","sourceRoot":"","sources":["../../../src/rules/retry-after.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"retry-after.js","sourceRoot":"","sources":["../../../src/rules/retry-after.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAE3D;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;IACvC,IAAI,EAAE,aAAa;IACnB,QAAQ,EAAE,SAAS;IACnB,WAAW,EAAE,uDAAuD;IACpE,QAAQ,EAAE;QACR,OAAO,EAAE,0MAA0M;KACpN;IACD,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,SAAS,EAAE,CAAC,EAAa,EAAE,EAAE;gBAC3B,IAAI,6BAA6B,CAAC,EAAE,CAAC,EAAE;oBACrC,OAAO;iBACR;gBACD,MAAM,KAAK,GAAG,aAAa,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;gBACpF,IAAI,KAAK,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,EAAE;oBACtD,OAAO,CAAC,gBAAgB,CAAC;wBACvB,MAAM,EAAE,EAAE;qBACX,CAAC,CAAC;iBACJ;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAEH,SAAS,mBAAmB,CAAC,OAAgB,EAAE,EAAa;IAC1D,OAAO,CAAC,CAAC,wBAAwB,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAC5D,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,WAAC,OAAA,MAAA,GAAG,CAAC,OAAO,0CAAG,aAAa,CAAC,CAAA,EAAA,CAAC,CACzD,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Validation related to versioning.
|
|
3
3
|
*/
|
|
4
|
-
export declare const unsupportedTypeRule: import("@typespec/
|
|
4
|
+
export declare const unsupportedTypeRule: import("@typespec/compiler").LinterRuleDefinition<"unsupported-type", {
|
|
5
|
+
readonly default: import("@typespec/compiler").CallableMessage<[string]>;
|
|
6
|
+
}>;
|
|
5
7
|
//# sourceMappingURL=unsupported-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unsupported-types.d.ts","sourceRoot":"","sources":["../../../src/rules/unsupported-types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"unsupported-types.d.ts","sourceRoot":"","sources":["../../../src/rules/unsupported-types.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,eAAO,MAAM,mBAAmB;;EAoC9B,CAAC"}
|