@azure-tools/typespec-azure-resource-manager 0.70.0-dev.3 → 0.70.0-dev.5

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
@@ -67,6 +67,7 @@ Available ruleSets:
67
67
  | [`@azure-tools/typespec-azure-resource-manager/unsupported-type`](https://azure.github.io/typespec-azure/docs/libraries/azure-resource-manager/rules/unsupported-type) | Check for unsupported ARM types. |
68
68
  | [`@azure-tools/typespec-azure-resource-manager/secret-prop`](https://azure.github.io/typespec-azure/docs/libraries/azure-resource-manager/rules/secret-prop) | RPC-v1-13: Check that property with names indicating sensitive information(e.g. contains auth, password, token, secret, etc.) are marked with @secret decorator. |
69
69
  | [`@azure-tools/typespec-azure-resource-manager/no-empty-model`](https://azure.github.io/typespec-azure/docs/libraries/azure-resource-manager/rules/no-empty-model) | ARM Properties with type:object that don't reference a model definition are not allowed. ARM doesn't allow generic type definitions as this leads to bad customer experience. |
70
+ | [`@azure-tools/typespec-azure-resource-manager/no-reserved-resource-property`](https://azure.github.io/typespec-azure/docs/libraries/azure-resource-manager/rules/no-reserved-resource-property) | Reserved property names (for example 'billingData') must not be present in a resource's property bag. The property name is matched case-insensitively. |
70
71
 
71
72
  ## Decorators
72
73
 
@@ -1 +1 @@
1
- {"version":3,"file":"linter.d.ts","sourceRoot":"","sources":["../../src/linter.ts"],"names":[],"mappings":"AAmFA,eAAO,MAAM,OAAO,+CAElB,CAAC"}
1
+ {"version":3,"file":"linter.d.ts","sourceRoot":"","sources":["../../src/linter.ts"],"names":[],"mappings":"AAqFA,eAAO,MAAM,OAAO,+CAElB,CAAC"}
@@ -29,6 +29,7 @@ import { lroLocationHeaderRule } from "./rules/lro-location-header.js";
29
29
  import { missingXmsIdentifiersRule } from "./rules/missing-x-ms-identifiers.js";
30
30
  import { noEmptyModel } from "./rules/no-empty-model.js";
31
31
  import { noOverridePropsRule } from "./rules/no-override-props.js";
32
+ import { noReservedResourcePropertyRule } from "./rules/no-reserved-resource-property.js";
32
33
  import { deleteOperationMissingRule } from "./rules/no-resource-delete-operation.js";
33
34
  import { noResponseBodyRule } from "./rules/no-response-body.js";
34
35
  import { operationsInterfaceMissingRule } from "./rules/operations-interface-missing.js";
@@ -78,6 +79,7 @@ const rules = [
78
79
  unsupportedTypeRule,
79
80
  secretProprule,
80
81
  noEmptyModel,
82
+ noReservedResourcePropertyRule,
81
83
  ];
82
84
  export const $linter = defineLinter({
83
85
  rules,
@@ -1 +1 @@
1
- {"version":3,"file":"linter.js","sourceRoot":"","sources":["../../src/linter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,kCAAkC,EAAE,MAAM,gDAAgD,CAAC;AACpG,OAAO,EAAE,uCAAuC,EAAE,MAAM,qDAAqD,CAAC;AAC9G,OAAO,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AAChF,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,gCAAgC,EAAE,MAAM,iDAAiD,CAAC;AACnG,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAAE,4BAA4B,EAAE,MAAM,yCAAyC,CAAC;AACvF,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,OAAO,EAAE,8BAA8B,EAAE,MAAM,2CAA2C,CAAC;AAC3F,OAAO,EAAE,kCAAkC,EAAE,MAAM,4CAA4C,CAAC;AAChG,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,gCAAgC,EAAE,MAAM,6CAA6C,CAAC;AAC/F,OAAO,EAAE,6BAA6B,EAAE,MAAM,mDAAmD,CAAC;AA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efinition<"no-reserved-resource-property", {
2
+ readonly default: import("@typespec/compiler").CallableMessage<["propertyName", "reason"]>;
3
+ }, Record<string, never>>;
4
+ //# sourceMappingURL=no-reserved-resource-property.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-reserved-resource-property.d.ts","sourceRoot":"","sources":["../../../src/rules/no-reserved-resource-property.ts"],"names":[],"mappings":"AAuBA,eAAO,MAAM,8BAA8B;;yBAkCzC,CAAC"}
@@ -0,0 +1,50 @@
1
+ import { createRule, getProperty, paramMessage } from "@typespec/compiler";
2
+ import { getArmResource } from "../resource.js";
3
+ import { getProperties } from "./utils.js";
4
+ /**
5
+ * Property names that are reserved and must not appear in a resource's property bag, written with
6
+ * their canonical casing and mapped to the reason each name is reserved. Names are matched
7
+ * case-insensitively. Add a new entry here to reserve an additional resource property name.
8
+ */
9
+ const reservedProperties = new Map([
10
+ ["billingData", "platform billing integration"],
11
+ ]);
12
+ /**
13
+ * Case-insensitive lookup keyed by the lowercased reserved name. Both the reserved names and the
14
+ * resource property names are lowercased when compared, while diagnostics report the reserved name
15
+ * with its canonical casing.
16
+ */
17
+ const reservedPropertiesByLowerName = new Map([...reservedProperties].map(([name, reason]) => [name.toLowerCase(), { name, reason }]));
18
+ export const noReservedResourcePropertyRule = createRule({
19
+ name: "no-reserved-resource-property",
20
+ description: "Reserved property names (for example 'billingData') must not be present in a resource's property bag. The property name is matched case-insensitively.",
21
+ severity: "warning",
22
+ url: "https://azure.github.io/typespec-azure/docs/libraries/azure-resource-manager/rules/no-reserved-resource-property",
23
+ messages: {
24
+ default: paramMessage `Property "${"propertyName"}" is not allowed in the resource property bag. This property name is reserved for ${"reason"}.`,
25
+ },
26
+ create(context) {
27
+ return {
28
+ model: (model) => {
29
+ const resourceModel = getArmResource(context.program, model);
30
+ if (resourceModel === undefined) {
31
+ return;
32
+ }
33
+ const resourceProperties = getProperty(model, "properties")?.type;
34
+ if (resourceProperties === undefined || resourceProperties.kind !== "Model") {
35
+ return;
36
+ }
37
+ for (const property of getProperties(resourceProperties)) {
38
+ const reserved = reservedPropertiesByLowerName.get(property.name.toLowerCase());
39
+ if (reserved !== undefined) {
40
+ context.reportDiagnostic({
41
+ format: { propertyName: reserved.name, reason: reserved.reason },
42
+ target: property,
43
+ });
44
+ }
45
+ }
46
+ },
47
+ };
48
+ },
49
+ });
50
+ //# sourceMappingURL=no-reserved-resource-property.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-reserved-resource-property.js","sourceRoot":"","sources":["../../../src/rules/no-reserved-resource-property.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElF,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C;;;;GAIG;AACH,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAiB;IACjD,CAAC,aAAa,EAAE,8BAA8B,CAAC;CAChD,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,6BAA6B,GAAG,IAAI,GAAG,CAC3C,CAAC,GAAG,kBAAkB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CACxF,CAAC;AAEF,MAAM,CAAC,MAAM,8BAA8B,GAAG,UAAU,CAAC;IACvD,IAAI,EAAE,+BAA+B;IACrC,WAAW,EACT,wJAAwJ;IAC1J,QAAQ,EAAE,SAAS;IACnB,GAAG,EAAE,kHAAkH;IACvH,QAAQ,EAAE;QACR,OAAO,EAAE,YAAY,CAAA,aAAa,cAAc,qFAAqF,QAAQ,GAAG;KACjJ;IACD,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,KAAK,EAAE,CAAC,KAAY,EAAE,EAAE;gBACtB,MAAM,aAAa,GAAG,cAAc,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;gBAC7D,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;oBAChC,OAAO;gBACT,CAAC;gBAED,MAAM,kBAAkB,GAAG,WAAW,CAAC,KAAK,EAAE,YAAY,CAAC,EAAE,IAAI,CAAC;gBAClE,IAAI,kBAAkB,KAAK,SAAS,IAAI,kBAAkB,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;oBAC5E,OAAO;gBACT,CAAC;gBAED,KAAK,MAAM,QAAQ,IAAI,aAAa,CAAC,kBAAkB,CAAC,EAAE,CAAC;oBACzD,MAAM,QAAQ,GAAG,6BAA6B,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;oBAChF,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;wBAC3B,OAAO,CAAC,gBAAgB,CAAC;4BACvB,MAAM,EAAE,EAAE,YAAY,EAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE;4BAChE,MAAM,EAAE,QAAQ;yBACjB,CAAC,CAAC;oBACL,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -189,7 +189,7 @@ model ConversationProperties {
189
189
 
190
190
  /** Timestamp of when the conversation was created. Read-only. */
191
191
  @visibility(Lifecycle.Read)
192
- createdAt?: unixTimestamp32;
192
+ createdAt?: utcDateTime;
193
193
  }
194
194
 
195
195
  /**
@@ -226,24 +226,24 @@ model ConversationOutput {
226
226
  union ResponseStatus {
227
227
  /** The response completed successfully. */
228
228
  @Azure.Core.lroSucceeded
229
- Completed: "completed",
229
+ Completed: "Completed",
230
230
 
231
231
  /** The response failed. */
232
232
  @Azure.Core.lroFailed
233
- Failed: "failed",
233
+ Failed: "Failed",
234
234
 
235
235
  /** The response was cancelled. */
236
236
  @Azure.Core.lroCanceled
237
- Cancelled: "cancelled",
237
+ Cancelled: "Cancelled",
238
238
 
239
239
  /** The response is incomplete. */
240
- Incomplete: "incomplete",
240
+ Incomplete: "Incomplete",
241
241
 
242
242
  /** The response is queued for execution. */
243
- Queued: "queued",
243
+ Queued: "Queued",
244
244
 
245
245
  /** The response is in progress. */
246
- InProgress: "in_progress",
246
+ InProgress: "InProgress",
247
247
 
248
248
  string,
249
249
  }
@@ -259,7 +259,7 @@ model ResponseProperties {
259
259
 
260
260
  /** Timestamp of when the response was created. Read-only. */
261
261
  @visibility(Lifecycle.Read)
262
- createdAt?: unixTimestamp32;
262
+ createdAt?: utcDateTime;
263
263
 
264
264
  /** Model ID used to generate the response. May be specified on request to override the agent default; read-only in GET. */
265
265
  `model`?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure-tools/typespec-azure-resource-manager",
3
- "version": "0.70.0-dev.3",
3
+ "version": "0.70.0-dev.5",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "TypeSpec Azure Resource Manager library",
6
6
  "homepage": "https://azure.github.io/typespec-azure",