@azure-tools/typespec-azure-resource-manager 0.74.0-dev.12 → 0.74.0-dev.13
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/README.md
CHANGED
|
@@ -35,7 +35,7 @@ Available ruleSets:
|
|
|
35
35
|
| [`@azure-tools/typespec-azure-resource-manager/arm-no-path-casing-conflicts`](https://azure.github.io/typespec-azure/docs/libraries/azure-resource-manager/rules/arm-no-path-casing-conflicts) | Operation paths must be unique when compared case-insensitively. |
|
|
36
36
|
| [`@azure-tools/typespec-azure-resource-manager/scope-path-segment-casing`](https://azure.github.io/typespec-azure/docs/libraries/azure-resource-manager/rules/scope-path-segment-casing) | ARM paths must use the canonical subscriptions and resourceGroups segment casing. |
|
|
37
37
|
| [`@azure-tools/typespec-azure-resource-manager/no-override-props`](https://azure.github.io/typespec-azure/docs/libraries/azure-resource-manager/rules/no-override-props) | Disallow redefining properties already defined in a base type. |
|
|
38
|
-
| [`@azure-tools/typespec-azure-resource-manager/arm-common-types-version`](https://azure.github.io/typespec-azure/docs/libraries/azure-resource-manager/rules/arm-common-types-version) | Specify the ARM common-types version using @armCommonTypesVersion.
|
|
38
|
+
| [`@azure-tools/typespec-azure-resource-manager/arm-common-types-version`](https://azure.github.io/typespec-azure/docs/libraries/azure-resource-manager/rules/arm-common-types-version) | Specify the latest ARM common-types version using @armCommonTypesVersion. |
|
|
39
39
|
| [`@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes`](https://azure.github.io/typespec-azure/docs/libraries/azure-resource-manager/rules/arm-delete-operation-response-codes) | Ensure delete operations have the appropriate status codes. |
|
|
40
40
|
| [`@azure-tools/typespec-azure-resource-manager/arm-put-operation-response-codes`](https://azure.github.io/typespec-azure/docs/libraries/azure-resource-manager/rules/arm-put-operation-response-codes) | Ensure put operations have the appropriate status codes. |
|
|
41
41
|
| [`@azure-tools/typespec-azure-resource-manager/arm-post-operation-response-codes`](https://azure.github.io/typespec-azure/docs/libraries/azure-resource-manager/rules/arm-post-operation-response-codes) | Ensure post operations have the appropriate status codes. |
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The @armCommonTypesVersion decorator should
|
|
3
|
-
* common-types version used by the service.
|
|
2
|
+
* The @armCommonTypesVersion decorator should select the latest ARM common-types version.
|
|
4
3
|
*/
|
|
5
4
|
export declare const armCommonTypesVersionRule: import("@typespec/compiler").LinterRuleDefinition<"arm-common-types-version", {
|
|
6
5
|
readonly default: "Specify the ARM common-types version using the @armCommonTypesVersion decorator on the service namespace or on each version of the service version enum.";
|
|
6
|
+
readonly outdated: import("@typespec/compiler").CallableMessage<["latestVersion", "currentVersion"]>;
|
|
7
7
|
}, Record<string, never>>;
|
|
8
8
|
//# sourceMappingURL=arm-common-types-version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arm-common-types-version.d.ts","sourceRoot":"","sources":["../../../src/rules/arm-common-types-version.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"arm-common-types-version.d.ts","sourceRoot":"","sources":["../../../src/rules/arm-common-types-version.ts"],"names":[],"mappings":"AAYA;;GAEG;AACH,eAAO,MAAM,yBAAyB;;;yBAoEpC,CAAC"}
|
|
@@ -1,29 +1,30 @@
|
|
|
1
|
-
import { createRule, fileRef } from "@typespec/compiler";
|
|
2
|
-
import { getAllHttpServices } from "@typespec/http";
|
|
1
|
+
import { createRule, fileRef, listServices, paramMessage, } from "@typespec/compiler";
|
|
3
2
|
import { getVersion } from "@typespec/versioning";
|
|
3
|
+
import { getArmCommonTypesVersion, getArmCommonTypesVersions } from "../common-types.js";
|
|
4
4
|
import { getArmProviderNamespace } from "../namespace.js";
|
|
5
5
|
/**
|
|
6
|
-
* The @armCommonTypesVersion decorator should
|
|
7
|
-
* common-types version used by the service.
|
|
6
|
+
* The @armCommonTypesVersion decorator should select the latest ARM common-types version.
|
|
8
7
|
*/
|
|
9
8
|
export const armCommonTypesVersionRule = createRule({
|
|
10
9
|
name: "arm-common-types-version",
|
|
11
10
|
docs: fileRef.fromPackageRoot("src/rules/arm-common-types-version.md"),
|
|
12
11
|
severity: "warning",
|
|
13
|
-
description: "Specify the ARM common-types version using @armCommonTypesVersion.",
|
|
12
|
+
description: "Specify the latest ARM common-types version using @armCommonTypesVersion.",
|
|
14
13
|
url: "https://azure.github.io/typespec-azure/docs/libraries/azure-resource-manager/rules/arm-common-types-version",
|
|
15
14
|
messages: {
|
|
16
15
|
default: "Specify the ARM common-types version using the @armCommonTypesVersion decorator on the service namespace or on each version of the service version enum.",
|
|
16
|
+
outdated: paramMessage `Use the latest ARM common-types version '${"latestVersion"}' instead of '${"currentVersion"}'.`,
|
|
17
17
|
},
|
|
18
18
|
create(context) {
|
|
19
19
|
return {
|
|
20
20
|
root: (program) => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
// The common-types registry stores versions newest first.
|
|
22
|
+
const latestVersion = getArmCommonTypesVersions(program)?.allVersions[0]?.name;
|
|
23
|
+
for (const { type: namespace } of listServices(program)) {
|
|
24
|
+
if (!getArmProviderNamespace(program, namespace)) {
|
|
24
25
|
continue;
|
|
25
26
|
}
|
|
26
|
-
const versionMap = getVersion(program,
|
|
27
|
+
const versionMap = getVersion(program, namespace);
|
|
27
28
|
// If the namespace is versioned and not all versions have the
|
|
28
29
|
// common-types version and if the service namespace doesn't have a
|
|
29
30
|
// common-types version, raise a diagnostic.
|
|
@@ -31,10 +32,29 @@ export const armCommonTypesVersionRule = createRule({
|
|
|
31
32
|
versionMap
|
|
32
33
|
.getVersions()
|
|
33
34
|
.every((version) => !!version.enumMember.decorators.find((x) => x.definition?.name === "@armCommonTypesVersion"))) &&
|
|
34
|
-
!
|
|
35
|
+
!namespace.decorators.find((x) => x.definition?.name === "@armCommonTypesVersion")) {
|
|
35
36
|
context.reportDiagnostic({
|
|
36
|
-
|
|
37
|
+
messageId: "default",
|
|
38
|
+
target: namespace,
|
|
37
39
|
});
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
if (latestVersion === undefined) {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
const namespaceVersion = getArmCommonTypesVersion(program, namespace);
|
|
46
|
+
const targets = versionMap
|
|
47
|
+
? versionMap.getVersions().map((version) => version.enumMember)
|
|
48
|
+
: [namespace];
|
|
49
|
+
for (const target of targets) {
|
|
50
|
+
const currentVersion = getArmCommonTypesVersion(program, target) ?? namespaceVersion;
|
|
51
|
+
if (currentVersion !== undefined && currentVersion !== latestVersion) {
|
|
52
|
+
context.reportDiagnostic({
|
|
53
|
+
messageId: "outdated",
|
|
54
|
+
target,
|
|
55
|
+
format: { latestVersion, currentVersion },
|
|
56
|
+
});
|
|
57
|
+
}
|
|
38
58
|
}
|
|
39
59
|
}
|
|
40
60
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arm-common-types-version.js","sourceRoot":"","sources":["../../../src/rules/arm-common-types-version.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"arm-common-types-version.js","sourceRoot":"","sources":["../../../src/rules/arm-common-types-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EACV,OAAO,EACP,YAAY,EACZ,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AACzF,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE1D;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,UAAU,CAAC;IAClD,IAAI,EAAE,0BAA0B;IAChC,IAAI,EAAE,OAAO,CAAC,eAAe,CAAC,uCAAuC,CAAC;IACtE,QAAQ,EAAE,SAAS;IACnB,WAAW,EAAE,2EAA2E;IACxF,GAAG,EAAE,6GAA6G;IAClH,QAAQ,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AAC,OAAO,EAAE,SAAS,CAAC,CAAC;oBACtE,MAAM,OAAO,GAAG,UAAU;wBACxB,CAAC,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC;wBAC/D,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;oBAChB,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;wBAC7B,MAAM,cAAc,GAAG,wBAAwB,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,gBAAgB,CAAC;wBACrF,IAAI,cAAc,KAAK,SAAS,IAAI,cAAc,KAAK,aAAa,EAAE,CAAC;4BACrE,OAAO,CAAC,gBAAgB,CAAC;gCACvB,SAAS,EAAE,UAAU;gCACrB,MAAM;gCACN,MAAM,EAAE,EAAE,aAAa,EAAE,cAAc,EAAE;6BAC1C,CAAC,CAAC;wBACL,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure-tools/typespec-azure-resource-manager",
|
|
3
|
-
"version": "0.74.0-dev.
|
|
3
|
+
"version": "0.74.0-dev.13",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
5
|
"description": "TypeSpec Azure Resource Manager library",
|
|
6
6
|
"homepage": "https://azure.github.io/typespec-azure",
|
|
@@ -56,19 +56,19 @@
|
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@azure-tools/typespec-azure-core": "^0.73.0 || >= 0.74.0-dev.5",
|
|
59
|
-
"@types/node": "^26.6.
|
|
59
|
+
"@types/node": "^26.6.5",
|
|
60
60
|
"@types/pluralize": "^0.0.33",
|
|
61
61
|
"@vitest/coverage-v8": "^5.0.5",
|
|
62
62
|
"@vitest/ui": "^5.0.5",
|
|
63
63
|
"rimraf": "^6.1.3",
|
|
64
64
|
"typescript": "npm:@typescript/typescript6@~6.0.2",
|
|
65
65
|
"vitest": "^5.0.5",
|
|
66
|
+
"@typespec/compiler": "^1.17.0",
|
|
66
67
|
"@typespec/http": "^1.17.0",
|
|
67
68
|
"@typespec/rest": "^0.87.0",
|
|
68
|
-
"@typespec/compiler": "^1.17.0",
|
|
69
|
-
"@typespec/library-linter": "^0.87.0",
|
|
70
|
-
"@typespec/tspd": "^0.77.1",
|
|
71
69
|
"@typespec/versioning": "^0.87.0",
|
|
70
|
+
"@typespec/tspd": "^0.77.1",
|
|
71
|
+
"@typespec/library-linter": "^0.87.0",
|
|
72
72
|
"@typespec/openapi": "^1.17.0"
|
|
73
73
|
},
|
|
74
74
|
"scripts": {
|