@azure-tools/typespec-azure-resource-manager 0.74.0-dev.16 → 0.74.0-dev.17

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 latest 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 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 select the latest ARM common-types version.
2
+ * The @armCommonTypesVersion decorator should be used to set the ARM
3
+ * common-types version used by the service.
3
4
  */
4
5
  export declare const armCommonTypesVersionRule: import("@typespec/compiler").LinterRuleDefinition<"arm-common-types-version", {
5
6
  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":"AAYA;;GAEG;AACH,eAAO,MAAM,yBAAyB;;;yBAoEpC,CAAC"}
1
+ {"version":3,"file":"arm-common-types-version.d.ts","sourceRoot":"","sources":["../../../src/rules/arm-common-types-version.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,eAAO,MAAM,yBAAyB;;yBA+CpC,CAAC"}
@@ -1,30 +1,29 @@
1
- import { createRule, fileRef, listServices, paramMessage, } from "@typespec/compiler";
1
+ import { createRule, fileRef } from "@typespec/compiler";
2
+ import { getAllHttpServices } from "@typespec/http";
2
3
  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 select the latest ARM common-types version.
6
+ * The @armCommonTypesVersion decorator should be used to set the ARM
7
+ * common-types version used by the service.
7
8
  */
8
9
  export const armCommonTypesVersionRule = createRule({
9
10
  name: "arm-common-types-version",
10
11
  docs: fileRef.fromPackageRoot("src/rules/arm-common-types-version.md"),
11
12
  severity: "warning",
12
- description: "Specify the latest ARM common-types version using @armCommonTypesVersion.",
13
+ description: "Specify the ARM common-types version using @armCommonTypesVersion.",
13
14
  url: "https://azure.github.io/typespec-azure/docs/libraries/azure-resource-manager/rules/arm-common-types-version",
14
15
  messages: {
15
16
  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
- // 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)) {
21
+ const [services, _] = getAllHttpServices(program);
22
+ for (const service of services) {
23
+ if (!getArmProviderNamespace(program, service.namespace)) {
25
24
  continue;
26
25
  }
27
- const versionMap = getVersion(program, namespace);
26
+ const versionMap = getVersion(program, service.namespace);
28
27
  // If the namespace is versioned and not all versions have the
29
28
  // common-types version and if the service namespace doesn't have a
30
29
  // common-types version, raise a diagnostic.
@@ -32,29 +31,10 @@ export const armCommonTypesVersionRule = createRule({
32
31
  versionMap
33
32
  .getVersions()
34
33
  .every((version) => !!version.enumMember.decorators.find((x) => x.definition?.name === "@armCommonTypesVersion"))) &&
35
- !namespace.decorators.find((x) => x.definition?.name === "@armCommonTypesVersion")) {
34
+ !service.namespace.decorators.find((x) => x.definition?.name === "@armCommonTypesVersion")) {
36
35
  context.reportDiagnostic({
37
- messageId: "default",
38
- target: namespace,
36
+ target: service.namespace,
39
37
  });
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
- }
58
38
  }
59
39
  }
60
40
  },
@@ -1 +1 @@
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,EAAE;QACR,OAAO,EACL,0JAA0J;QAC5J,QAAQ,EAAE,YAAY,CAAA,4CAA4C,eAAe,iBAAiB,gBAAgB,IAAI;KACvH;IACD,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,IAAI,EAAE,CAAC,OAAgB,EAAE,EAAE;gBACzB,0DAA0D;gBAC1D,MAAM,aAAa,GAAG,yBAAyB,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC;gBAC/E,KAAK,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC;oBACxD,IAAI,CAAC,uBAAuB,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE,CAAC;wBACjD,SAAS;oBACX,CAAC;oBAED,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;oBAClD,8DAA8D;oBAC9D,mEAAmE;oBACnE,4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BACH,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"arm-common-types-version.js","sourceRoot":"","sources":["../../../src/rules/arm-common-types-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2C,UAAU,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClG,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE1D;;;GAGG;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,oEAAoE;IACjF,GAAG,EAAE,6GAA6G;IAClH,QAAQ,EAAE;QACR,OAAO,EACL,0JAA0J;KAC7J;IACD,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,IAAI,EAAE,CAAC,OAAgB,EAAE,EAAE;gBACzB,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;gBAClD,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;oBAC/B,IAAI,CAAC,uBAAuB,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;wBACzD,SAAS;oBACX,CAAC;oBAED,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;oBAC1D,8DAA8D;oBAC9D,mEAAmE;oBACnE,4CAA4C;oBAC5C,IACE,CAAC,CACC,UAAU;wBACV,UAAU;6BACP,WAAW,EAAE;6BACb,KAAK,CACJ,CAAC,OAAO,EAAE,EAAE,CACV,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,CAClC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,EAAE,IAAI,KAAK,wBAAwB,CACvD,CACJ,CACJ;wBACD,CAAC,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAChC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,EAAE,IAAI,KAAK,wBAAwB,CACvD,EACD,CAAC;wBACD,OAAO,CAAC,gBAAgB,CAAC;4BACvB,MAAM,EAAE,OAAO,CAAC,SAAS;yBAC1B,CAAC,CAAC;oBACL,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.16",
3
+ "version": "0.74.0-dev.17",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "TypeSpec Azure Resource Manager library",
6
6
  "homepage": "https://azure.github.io/typespec-azure",
@@ -64,8 +64,8 @@
64
64
  "typescript": "npm:@typescript/typescript6@~6.0.2",
65
65
  "vitest": "^5.0.5",
66
66
  "@typespec/compiler": "^1.17.0",
67
- "@typespec/library-linter": "^0.87.0",
68
67
  "@typespec/http": "^1.17.0",
68
+ "@typespec/library-linter": "^0.87.0",
69
69
  "@typespec/rest": "^0.87.0",
70
70
  "@typespec/versioning": "^0.87.0",
71
71
  "@typespec/tspd": "^0.77.1",