@azure-tools/typespec-azure-resource-manager 0.71.0-dev.1 → 0.71.0-dev.11

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.
Files changed (189) hide show
  1. package/README.md +10 -7
  2. package/dist/generated-defs/Azure.ResourceManager.BaseTypes.d.ts +1 -1
  3. package/dist/generated-defs/Azure.ResourceManager.Private.d.ts.map +1 -1
  4. package/dist/generated-defs/Azure.ResourceManager.d.ts +1 -1
  5. package/dist/src/base-types.d.ts +1 -1
  6. package/dist/src/base-types.d.ts.map +1 -1
  7. package/dist/src/common-types.d.ts +4 -4
  8. package/dist/src/common-types.d.ts.map +1 -1
  9. package/dist/src/commontypes.private.decorators.d.ts +2 -2
  10. package/dist/src/commontypes.private.decorators.d.ts.map +1 -1
  11. package/dist/src/linter.d.ts.map +1 -1
  12. package/dist/src/linter.js +8 -2
  13. package/dist/src/linter.js.map +1 -1
  14. package/dist/src/namespace.d.ts +2 -2
  15. package/dist/src/namespace.d.ts.map +1 -1
  16. package/dist/src/operations.d.ts +4 -4
  17. package/dist/src/operations.d.ts.map +1 -1
  18. package/dist/src/operations.js.map +1 -1
  19. package/dist/src/private.decorators.d.ts +2 -2
  20. package/dist/src/private.decorators.d.ts.map +1 -1
  21. package/dist/src/private.decorators.js +17 -6
  22. package/dist/src/private.decorators.js.map +1 -1
  23. package/dist/src/resource.d.ts +4 -4
  24. package/dist/src/resource.d.ts.map +1 -1
  25. package/dist/src/resource.js +6 -0
  26. package/dist/src/resource.js.map +1 -1
  27. package/dist/src/rules/arm-agent-base-type-child-resources.d.ts.map +1 -1
  28. package/dist/src/rules/arm-agent-base-type-child-resources.js +2 -1
  29. package/dist/src/rules/arm-agent-base-type-child-resources.js.map +1 -1
  30. package/dist/src/rules/arm-agent-base-type-lifecycle-operations.d.ts.map +1 -1
  31. package/dist/src/rules/arm-agent-base-type-lifecycle-operations.js +2 -1
  32. package/dist/src/rules/arm-agent-base-type-lifecycle-operations.js.map +1 -1
  33. package/dist/src/rules/arm-common-types-version.d.ts.map +1 -1
  34. package/dist/src/rules/arm-common-types-version.js +2 -1
  35. package/dist/src/rules/arm-common-types-version.js.map +1 -1
  36. package/dist/src/rules/arm-custom-resource-no-key.d.ts.map +1 -1
  37. package/dist/src/rules/arm-custom-resource-no-key.js +2 -1
  38. package/dist/src/rules/arm-custom-resource-no-key.js.map +1 -1
  39. package/dist/src/rules/arm-custom-resource-usage-discourage.d.ts.map +1 -1
  40. package/dist/src/rules/arm-custom-resource-usage-discourage.js +2 -1
  41. package/dist/src/rules/arm-custom-resource-usage-discourage.js.map +1 -1
  42. package/dist/src/rules/arm-delete-response-codes.d.ts.map +1 -1
  43. package/dist/src/rules/arm-delete-response-codes.js +3 -2
  44. package/dist/src/rules/arm-delete-response-codes.js.map +1 -1
  45. package/dist/src/rules/arm-feature-file-usage-discourage.d.ts.map +1 -1
  46. package/dist/src/rules/arm-feature-file-usage-discourage.js +2 -1
  47. package/dist/src/rules/arm-feature-file-usage-discourage.js.map +1 -1
  48. package/dist/src/rules/arm-legacy-operations-discourage.js.map +1 -1
  49. package/dist/src/rules/arm-no-path-casing-conflicts.d.ts.map +1 -1
  50. package/dist/src/rules/arm-no-path-casing-conflicts.js +2 -1
  51. package/dist/src/rules/arm-no-path-casing-conflicts.js.map +1 -1
  52. package/dist/src/rules/arm-no-record.d.ts.map +1 -1
  53. package/dist/src/rules/arm-no-record.js +2 -1
  54. package/dist/src/rules/arm-no-record.js.map +1 -1
  55. package/dist/src/rules/arm-post-response-codes.d.ts.map +1 -1
  56. package/dist/src/rules/arm-post-response-codes.js +3 -2
  57. package/dist/src/rules/arm-post-response-codes.js.map +1 -1
  58. package/dist/src/rules/arm-put-response-codes.d.ts.map +1 -1
  59. package/dist/src/rules/arm-put-response-codes.js +3 -2
  60. package/dist/src/rules/arm-put-response-codes.js.map +1 -1
  61. package/dist/src/rules/arm-resource-action-no-segment.d.ts.map +1 -1
  62. package/dist/src/rules/arm-resource-action-no-segment.js +2 -1
  63. package/dist/src/rules/arm-resource-action-no-segment.js.map +1 -1
  64. package/dist/src/rules/arm-resource-duplicate-property.d.ts.map +1 -1
  65. package/dist/src/rules/arm-resource-duplicate-property.js +2 -1
  66. package/dist/src/rules/arm-resource-duplicate-property.js.map +1 -1
  67. package/dist/src/rules/arm-resource-interfaces.d.ts.map +1 -1
  68. package/dist/src/rules/arm-resource-interfaces.js +2 -1
  69. package/dist/src/rules/arm-resource-interfaces.js.map +1 -1
  70. package/dist/src/rules/arm-resource-invalid-action-verb.d.ts.map +1 -1
  71. package/dist/src/rules/arm-resource-invalid-action-verb.js +2 -1
  72. package/dist/src/rules/arm-resource-invalid-action-verb.js.map +1 -1
  73. package/dist/src/rules/arm-resource-invalid-envelope-property.d.ts.map +1 -1
  74. package/dist/src/rules/arm-resource-invalid-envelope-property.js +2 -1
  75. package/dist/src/rules/arm-resource-invalid-envelope-property.js.map +1 -1
  76. package/dist/src/rules/arm-resource-invalid-version-format.d.ts.map +1 -1
  77. package/dist/src/rules/arm-resource-invalid-version-format.js +2 -1
  78. package/dist/src/rules/arm-resource-invalid-version-format.js.map +1 -1
  79. package/dist/src/rules/arm-resource-key-invalid-chars.d.ts.map +1 -1
  80. package/dist/src/rules/arm-resource-key-invalid-chars.js +2 -1
  81. package/dist/src/rules/arm-resource-key-invalid-chars.js.map +1 -1
  82. package/dist/src/rules/arm-resource-name-pattern.d.ts.map +1 -1
  83. package/dist/src/rules/arm-resource-name-pattern.js +3 -2
  84. package/dist/src/rules/arm-resource-name-pattern.js.map +1 -1
  85. package/dist/src/rules/arm-resource-operation-response.d.ts.map +1 -1
  86. package/dist/src/rules/arm-resource-operation-response.js +2 -1
  87. package/dist/src/rules/arm-resource-operation-response.js.map +1 -1
  88. package/dist/src/rules/arm-resource-patch.d.ts.map +1 -1
  89. package/dist/src/rules/arm-resource-patch.js +2 -1
  90. package/dist/src/rules/arm-resource-patch.js.map +1 -1
  91. package/dist/src/rules/arm-resource-path-invalid-chars.d.ts.map +1 -1
  92. package/dist/src/rules/arm-resource-path-invalid-chars.js +2 -1
  93. package/dist/src/rules/arm-resource-path-invalid-chars.js.map +1 -1
  94. package/dist/src/rules/arm-resource-provisioning-state-rule.d.ts.map +1 -1
  95. package/dist/src/rules/arm-resource-provisioning-state-rule.js +2 -1
  96. package/dist/src/rules/arm-resource-provisioning-state-rule.js.map +1 -1
  97. package/dist/src/rules/beyond-nesting-levels.d.ts.map +1 -1
  98. package/dist/src/rules/beyond-nesting-levels.js +2 -1
  99. package/dist/src/rules/beyond-nesting-levels.js.map +1 -1
  100. package/dist/src/rules/envelope-properties.d.ts.map +1 -1
  101. package/dist/src/rules/envelope-properties.js +2 -1
  102. package/dist/src/rules/envelope-properties.js.map +1 -1
  103. package/dist/src/rules/improper-subscription-list-operation.d.ts.map +1 -1
  104. package/dist/src/rules/improper-subscription-list-operation.js +2 -1
  105. package/dist/src/rules/improper-subscription-list-operation.js.map +1 -1
  106. package/dist/src/rules/lro-location-header.d.ts.map +1 -1
  107. package/dist/src/rules/lro-location-header.js +2 -1
  108. package/dist/src/rules/lro-location-header.js.map +1 -1
  109. package/dist/src/rules/missing-x-ms-identifiers.d.ts.map +1 -1
  110. package/dist/src/rules/missing-x-ms-identifiers.js +2 -1
  111. package/dist/src/rules/missing-x-ms-identifiers.js.map +1 -1
  112. package/dist/src/rules/no-empty-model.d.ts.map +1 -1
  113. package/dist/src/rules/no-empty-model.js +2 -1
  114. package/dist/src/rules/no-empty-model.js.map +1 -1
  115. package/dist/src/rules/no-override-props.d.ts.map +1 -1
  116. package/dist/src/rules/no-override-props.js +2 -1
  117. package/dist/src/rules/no-override-props.js.map +1 -1
  118. package/dist/src/rules/no-reserved-resource-property.d.ts.map +1 -1
  119. package/dist/src/rules/no-reserved-resource-property.js +2 -1
  120. package/dist/src/rules/no-reserved-resource-property.js.map +1 -1
  121. package/dist/src/rules/no-resource-delete-operation.d.ts.map +1 -1
  122. package/dist/src/rules/no-resource-delete-operation.js +2 -1
  123. package/dist/src/rules/no-resource-delete-operation.js.map +1 -1
  124. package/dist/src/rules/no-response-body.d.ts.map +1 -1
  125. package/dist/src/rules/no-response-body.js +3 -2
  126. package/dist/src/rules/no-response-body.js.map +1 -1
  127. package/dist/src/rules/operations-interface-missing.d.ts.map +1 -1
  128. package/dist/src/rules/operations-interface-missing.js +2 -1
  129. package/dist/src/rules/operations-interface-missing.js.map +1 -1
  130. package/dist/src/rules/patch-envelope-properties.d.ts.map +1 -1
  131. package/dist/src/rules/patch-envelope-properties.js +2 -1
  132. package/dist/src/rules/patch-envelope-properties.js.map +1 -1
  133. package/dist/src/rules/resource-name.d.ts.map +1 -1
  134. package/dist/src/rules/resource-name.js +2 -1
  135. package/dist/src/rules/resource-name.js.map +1 -1
  136. package/dist/src/rules/retry-after.d.ts.map +1 -1
  137. package/dist/src/rules/retry-after.js +2 -1
  138. package/dist/src/rules/retry-after.js.map +1 -1
  139. package/dist/src/rules/secret-prop.d.ts.map +1 -1
  140. package/dist/src/rules/secret-prop.js +2 -1
  141. package/dist/src/rules/secret-prop.js.map +1 -1
  142. package/dist/src/rules/unsupported-type.d.ts.map +1 -1
  143. package/dist/src/rules/unsupported-type.js +2 -1
  144. package/dist/src/rules/unsupported-type.js.map +1 -1
  145. package/dist/src/rules/use-api-version.d.ts +4 -0
  146. package/dist/src/rules/use-api-version.d.ts.map +1 -0
  147. package/dist/src/rules/use-api-version.js +45 -0
  148. package/dist/src/rules/use-api-version.js.map +1 -0
  149. package/dist/src/rules/use-interface.d.ts +4 -0
  150. package/dist/src/rules/use-interface.d.ts.map +1 -0
  151. package/dist/src/rules/use-interface.js +29 -0
  152. package/dist/src/rules/use-interface.js.map +1 -0
  153. package/dist/src/rules/use-operation-decorator.d.ts +5 -0
  154. package/dist/src/rules/use-operation-decorator.d.ts.map +1 -0
  155. package/dist/src/rules/use-operation-decorator.js +133 -0
  156. package/dist/src/rules/use-operation-decorator.js.map +1 -0
  157. package/dist/src/rules/use-relationship-required-properties.d.ts +5 -0
  158. package/dist/src/rules/use-relationship-required-properties.d.ts.map +1 -0
  159. package/dist/src/rules/use-relationship-required-properties.js +79 -0
  160. package/dist/src/rules/use-relationship-required-properties.js.map +1 -0
  161. package/dist/src/rules/utils.d.ts +2 -2
  162. package/dist/src/rules/utils.d.ts.map +1 -1
  163. package/dist/src/rules/utils.js.map +1 -1
  164. package/dist/src/rules/version-progression.d.ts.map +1 -1
  165. package/dist/src/rules/version-progression.js +2 -1
  166. package/dist/src/rules/version-progression.js.map +1 -1
  167. package/dist/src/testing/index.d.ts +1 -1
  168. package/dist/src/testing/index.d.ts.map +1 -1
  169. package/lib/arm.tsp +1 -0
  170. package/lib/base-types/agent.tsp +12 -8
  171. package/lib/base-types/base-types.tsp +1 -1
  172. package/lib/base-types/relationship.tsp +46 -0
  173. package/lib/common-types/managed-identity-ref.tsp +1 -1
  174. package/lib/common-types/nsp-operations.tsp +1 -5
  175. package/lib/common-types/private-links-ref.tsp +1 -1
  176. package/lib/decorators.tsp +1 -1
  177. package/lib/extension/operations.tsp +17 -17
  178. package/lib/extension/parameters.tsp +19 -5
  179. package/lib/legacy-types/extension-operations.tsp +5 -5
  180. package/lib/legacy-types/extension.tsp +2 -2
  181. package/lib/legacy-types/operations.tsp +4 -4
  182. package/lib/legacy-types/private-endpoints.tsp +0 -2
  183. package/lib/operations.tsp +2 -2
  184. package/lib/responses.tsp +3 -3
  185. package/package.json +15 -15
  186. package/dist/src/rules/core-operations.d.ts +0 -6
  187. package/dist/src/rules/core-operations.d.ts.map +0 -1
  188. package/dist/src/rules/core-operations.js +0 -104
  189. package/dist/src/rules/core-operations.js.map +0 -1
@@ -94,7 +94,7 @@ interface ExtensionOperations<
94
94
 
95
95
  /**
96
96
  * A long-running resource Update (PATCH)
97
- * @template Resource the resource being created or updated
97
+ * @template Resource the resource being updated
98
98
  * @template PatchModel the PATCH request model
99
99
  * @template LroHeaders Optional. Allows overriding the lro headers returned on resource create
100
100
  * @template Parameters Optional. Additional parameters after the path parameters
@@ -134,7 +134,7 @@ interface ExtensionOperations<
134
134
 
135
135
  /**
136
136
  * A synchronous resource Update (PATCH)
137
- * @template Resource the resource being created or updated
137
+ * @template Resource the resource being updated
138
138
  * @template PatchModel the PATCH request model
139
139
  * @template Parameters Optional. Additional parameters after the path parameters
140
140
  * @template Response Optional. The success response(s) for the PATCH operation
@@ -13,7 +13,7 @@ using Rest;
13
13
  * is accessible at multiple, fixed resource paths.
14
14
  * @template ParentParameters The path parameters for the resource parent
15
15
  * @template ResourceTypeParameter The path parameter for the resource name
16
- * @template ErrorType Optional. The type of error models used in operations created form this template
16
+ * @template ErrorType Optional. The type of error models used in operations created from this template
17
17
  * @template ResourceName Optional. The name of the resource type described in this template
18
18
  */
19
19
  interface LegacyOperations<
@@ -34,7 +34,7 @@ interface LegacyOperations<
34
34
  * is accessible at multiple, fixed resource paths. Can be used with static routes.
35
35
  * @template ParentParameters The path parameters for the resource parent
36
36
  * @template ResourceTypeParameter The path parameter for the resource name
37
- * @template ErrorType Optional. The type of error models used in operations created form this template
37
+ * @template ErrorType Optional. The type of error models used in operations created from this template
38
38
  * @template ResourceRoute Optional. The resource route to use for operations in the interface.
39
39
  * @template RoutedResourceName Optional. The name of the resource type described in this template
40
40
  */
@@ -660,7 +660,7 @@ op CreateOrReplaceSync<
660
660
 
661
661
  /**
662
662
  * A resource list operation, at the subscription scope, that lists only a single page
663
- * @template Resource the resource being patched
663
+ * @template Resource the resource being listed
664
664
  * @template Parameters Optional. Additional parameters after the path parameters
665
665
  * @template Response Optional. The success response for the list operation
666
666
  * @template Error Optional. The error response, if non-standard.
@@ -681,7 +681,7 @@ op ArmListSinglePageBySubscription<
681
681
 
682
682
  /**
683
683
  * A resource list operation, at the scope of the resource's parent that lists only a single page.
684
- * @template Resource the resource being patched
684
+ * @template Resource the resource being listed
685
685
  * @template BaseParameters Optional. Allows overriding the operation parameters
686
686
  * @template ParentName Optional. The name of the parent resource
687
687
  * @template ParentFriendlyName Optional. The friendly name of the parent resource
@@ -12,8 +12,6 @@ using Rest;
12
12
  * @template ParentResource the parent resource of the PrivateEndpointConnection
13
13
  * @template Resource Optional. The PrivateEndpointConnection resource being listed
14
14
  * @template BaseParameters Optional. Allows overriding the operation parameters
15
- * @template ParentName Optional. The name of the parent resource
16
- * @template ParentFriendlyName Optional. The friendly name of the parent resource
17
15
  * @template Parameters Optional. Additional parameters after the path parameters
18
16
  * @template Response Optional. The success response for the list operation
19
17
  * @template Error Optional. The error response, if non-standard.
@@ -885,7 +885,7 @@ op ArmResourceActionNoContentSync<
885
885
  /**
886
886
  * Adds check global name availability operation, normally used if
887
887
  * a resource name must be globally unique (for example, if the resource
888
- * exposes and endpoint that uses the resource name in the url)
888
+ * exposes an endpoint that uses the resource name in the url)
889
889
  * @template Request the availability request, defaults to the standard request, containing name and resource type
890
890
  * @template Response the availability response, default to the standard response
891
891
  * @template AdditionalParams A model specifying additional non-path parameters to the availability request
@@ -905,7 +905,7 @@ op checkGlobalNameAvailability<
905
905
  /**
906
906
  * Adds check location-specific name availability operation, normally used if
907
907
  * a resource name must be globally unique (for example, if the resource
908
- * exposes and endpoint that uses the resource name in the url)
908
+ * exposes an endpoint that uses the resource name in the url)
909
909
  * @template Request the availability request, defaults to the standard request, containing name and resource type
910
910
  * @template Response the availability response, default to the standard response
911
911
  * @template AdditionalParams A model specifying additional non-path parameters to the availability request
package/lib/responses.tsp CHANGED
@@ -246,7 +246,7 @@ model ArmLroLocationHeader<
246
246
  * @template StatusMonitor The type of the polling StatusMonitor when following the Azure-AsyncOperation url
247
247
  * @template FinalResult The type of the logical result when following the location header
248
248
  * @template PollingUrlValue The value type of the link to the status monitor
249
- * @template FinalUrlValue The value type fo the link to the final result
249
+ * @template FinalUrlValue The value type of the link to the final result
250
250
  *
251
251
  * @example
252
252
  * ```typespec
@@ -320,7 +320,7 @@ model ArmResourceUpdatedResponse<Resource extends Azure.ResourceManager.Foundati
320
320
 
321
321
  /**
322
322
  * Resource create operation succeeded
323
- * @template Resource The resource being updated
323
+ * @template Resource The resource being created
324
324
  * @template LroHeaders Optional. The lro headers returned with a Created response
325
325
  *
326
326
  * @example
@@ -350,7 +350,7 @@ model ArmResourceCreatedResponse<
350
350
 
351
351
  /**
352
352
  * Resource synchronous create operation succeeded
353
- * @template Resource The resource being updated
353
+ * @template Resource The resource being created
354
354
  *
355
355
  * @example
356
356
  * ```typespec
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure-tools/typespec-azure-resource-manager",
3
- "version": "0.71.0-dev.1",
3
+ "version": "0.71.0-dev.11",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "TypeSpec Azure Resource Manager library",
6
6
  "homepage": "https://azure.github.io/typespec-azure",
@@ -47,33 +47,33 @@
47
47
  "pluralize": "^8.0.0"
48
48
  },
49
49
  "peerDependencies": {
50
- "@azure-tools/typespec-azure-core": "^0.70.0 || >=0.71.0-dev <0.71.0",
50
+ "@azure-tools/typespec-azure-core": "^0.70.0 || >= 0.71.0-dev.4",
51
51
  "@typespec/compiler": "^1.14.0",
52
52
  "@typespec/http": "^1.14.0",
53
- "@typespec/rest": "^0.84.0 || >=0.85.0-dev <0.85.0",
53
+ "@typespec/rest": "^0.84.0",
54
54
  "@typespec/openapi": "^1.14.0",
55
- "@typespec/versioning": "^0.84.0 || >=0.85.0-dev <0.85.0"
55
+ "@typespec/versioning": "^0.84.0"
56
56
  },
57
57
  "devDependencies": {
58
- "@azure-tools/typespec-azure-core": "^0.70.0 || >=0.71.0-dev <0.71.0",
58
+ "@azure-tools/typespec-azure-core": "^0.70.0 || >= 0.71.0-dev.4",
59
59
  "@types/node": "^26.0.0",
60
60
  "@types/pluralize": "^0.0.33",
61
- "@typespec/compiler": "^1.14.0",
62
- "@typespec/http": "^1.14.0",
63
- "@typespec/library-linter": "^0.84.0 || >=0.85.0-dev <0.85.0",
64
- "@typespec/rest": "^0.84.0 || >=0.85.0-dev <0.85.0",
65
- "@typespec/tspd": "^0.76.0 || >=0.77.0-dev <0.77.0",
66
- "@typespec/versioning": "^0.84.0 || >=0.85.0-dev <0.85.0",
67
- "@typespec/openapi": "^1.14.0",
68
61
  "@vitest/coverage-v8": "^4.1.3",
69
62
  "@vitest/ui": "^4.1.3",
70
63
  "rimraf": "^6.1.3",
71
64
  "typescript": "~6.0.2",
72
- "vitest": "^4.1.3"
65
+ "vitest": "^4.1.3",
66
+ "@typespec/compiler": "^1.14.0",
67
+ "@typespec/library-linter": "^0.84.0",
68
+ "@typespec/http": "^1.14.0",
69
+ "@typespec/versioning": "^0.84.0",
70
+ "@typespec/rest": "^0.84.0",
71
+ "@typespec/tspd": "^0.76.0",
72
+ "@typespec/openapi": "^1.14.0"
73
73
  },
74
74
  "scripts": {
75
75
  "clean": "rimraf ./dist ./temp",
76
- "build": "npm run gen-extern-signature && tsc -p tsconfig.build.json && npm run lint-typespec-library",
76
+ "build": "pnpm gen-extern-signature && tsc -p tsconfig.build.json && pnpm lint-typespec-library",
77
77
  "watch": "tsc -p tsconfig.build.json --watch",
78
78
  "gen-extern-signature": "tspd --enable-experimental gen-extern-signature .",
79
79
  "lint-typespec-library": "tsp compile . --warn-as-error --import @typespec/library-linter --no-emit",
@@ -83,6 +83,6 @@
83
83
  "test:ci": "vitest run --coverage --reporter=junit --reporter=default",
84
84
  "lint": "oxlint . --deny-warnings",
85
85
  "lint:fix": "oxlint . --fix",
86
- "regen-docs": "tspd doc . --enable-experimental --llmstxt --output-dir ../../website/src/content/docs/docs/libraries/azure-resource-manager/reference"
86
+ "regen-docs": "tspd doc . --enable-experimental --llmstxt --rules-dir ../rules --output-dir ../../website/src/content/docs/docs/libraries/azure-resource-manager/reference"
87
87
  }
88
88
  }
@@ -1,6 +0,0 @@
1
- export declare const coreOperationsRule: import("@typespec/compiler").LinterRuleDefinition<"arm-resource-operation", {
2
- readonly default: "All Resource operations must use an api-version parameter. Please include Azure.ResourceManager.ApiVersionParameter in the operation parameter list using the spread (...ApiVersionParameter) operator, or using one of the common resource parameter models.";
3
- readonly opOutsideInterface: "All operations must be inside an interface declaration.";
4
- readonly opMissingDecorator: import("@typespec/compiler").CallableMessage<["verb", "decorator"]>;
5
- }, Record<string, never>>;
6
- //# sourceMappingURL=core-operations.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"core-operations.d.ts","sourceRoot":"","sources":["../../../src/rules/core-operations.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,kBAAkB;;;;yBA6D7B,CAAC"}
@@ -1,104 +0,0 @@
1
- import { createRule, isTemplateInstance, paramMessage, } from "@typespec/compiler";
2
- import { SyntaxKind } from "@typespec/compiler/ast";
3
- import { getOperationVerb } from "@typespec/http";
4
- import { getSegment } from "@typespec/rest";
5
- import { getNamespaceName, getSourceModel, isSourceOperationResourceManagerInternal, isTemplatedInterfaceOperation, } from "./utils.js";
6
- export const coreOperationsRule = createRule({
7
- name: "arm-resource-operation",
8
- severity: "warning",
9
- description: "Validate ARM Resource operations.",
10
- url: "https://azure.github.io/typespec-azure/docs/libraries/azure-resource-manager/rules/arm-resource-operation",
11
- messages: {
12
- default: "All Resource operations must use an api-version parameter. Please include Azure.ResourceManager.ApiVersionParameter in the operation parameter list using the spread (...ApiVersionParameter) operator, or using one of the common resource parameter models.",
13
- opOutsideInterface: "All operations must be inside an interface declaration.",
14
- opMissingDecorator: paramMessage `Resource ${"verb"} operation must be decorated with ${"decorator"}.`,
15
- },
16
- create(context) {
17
- return {
18
- operation: (operation) => {
19
- if (!isSourceOperationResourceManagerInternal(operation) &&
20
- !isTemplateInstance(operation)) {
21
- const verb = getOperationVerb(context.program, operation);
22
- if (!isTemplatedInterfaceOperation(operation) &&
23
- (!operation.node?.parent ||
24
- operation.node.parent.kind !== SyntaxKind.InterfaceStatement)) {
25
- context.reportDiagnostic({
26
- messageId: "opOutsideInterface",
27
- target: operation,
28
- });
29
- }
30
- const parameters = operation.parameters;
31
- if (parameters === undefined ||
32
- parameters === null ||
33
- !hasApiParameter(context.program, parameters)) {
34
- context.reportDiagnostic({
35
- target: operation,
36
- });
37
- }
38
- if (verb) {
39
- const requiredDecorators = resourceOperationDecorators[verb];
40
- if (requiredDecorators?.length > 0) {
41
- const decorator = operation.decorators.find((d) => requiredDecorators.indexOf(d.decorator.name) >= 0);
42
- if (!decorator && !isArmProviderOperation(context.program, operation)) {
43
- context.reportDiagnostic({
44
- messageId: "opMissingDecorator",
45
- target: operation,
46
- format: {
47
- verb: verb.toUpperCase(),
48
- decorator: requiredDecorators.map((d) => `@${d.substring(1)}`).join(" or "),
49
- },
50
- });
51
- }
52
- }
53
- }
54
- }
55
- },
56
- };
57
- },
58
- });
59
- const resourceOperationDecorators = {
60
- put: ["$armResourceCreateOrUpdate"],
61
- get: ["$armResourceRead", "$armResourceList"],
62
- patch: ["$armResourceUpdate"],
63
- delete: ["$armResourceDelete"],
64
- post: ["$armResourceAction", "$armResourceCollectionAction"],
65
- head: [],
66
- };
67
- function isApiParameter(program, property) {
68
- if (property.type.kind !== "Scalar")
69
- return false;
70
- if (!property.sourceProperty)
71
- return false;
72
- const sourceModel = getSourceModel(property.sourceProperty);
73
- if (sourceModel === undefined)
74
- return false;
75
- return (sourceModel.name === "ApiVersionParameter" &&
76
- getNamespaceName(program, sourceModel) === "Azure.ResourceManager.CommonTypes");
77
- }
78
- function hasApiParameter(program, model) {
79
- if (model.properties === undefined || model.properties.size === 0)
80
- return false;
81
- const apiVersionParams = [...model.properties.values()].filter((i) => isApiParameter(program, i));
82
- return apiVersionParams !== null && apiVersionParams.length === 1;
83
- }
84
- function isStaticSegment(segment, property) {
85
- return segment === undefined || segment === "locations";
86
- }
87
- function isArmProviderOperation(program, operation) {
88
- let isProviderAction = false;
89
- for (const [index, [, property]] of [...operation.parameters.properties].entries()) {
90
- const segment = getSegment(program, property);
91
- if (segment === "providers") {
92
- isProviderAction = true;
93
- }
94
- else if (isProviderAction && !isStaticSegment(segment, property)) {
95
- return false;
96
- }
97
- const isLastSegment = index === operation.parameters.properties.size - 1;
98
- if (isLastSegment && !segment) {
99
- return true;
100
- }
101
- }
102
- return false;
103
- }
104
- //# sourceMappingURL=core-operations.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"core-operations.js","sourceRoot":"","sources":["../../../src/rules/core-operations.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,UAAU,EACV,kBAAkB,EAClB,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAY,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,wCAAwC,EACxC,6BAA6B,GAC9B,MAAM,YAAY,CAAC;AAEpB,MAAM,CAAC,MAAM,kBAAkB,GAAG,UAAU,CAAC;IAC3C,IAAI,EAAE,wBAAwB;IAC9B,QAAQ,EAAE,SAAS;IACnB,WAAW,EAAE,mCAAmC;IAChD,GAAG,EAAE,2GAA2G;IAChH,QAAQ,EAAE;QACR,OAAO,EACL,+PAA+P;QACjQ,kBAAkB,EAAE,yDAAyD;QAC7E,kBAAkB,EAAE,YAAY,CAAA,YAAY,MAAM,qCAAqC,WAAW,GAAG;KACtG;IACD,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,SAAS,EAAE,CAAC,SAAoB,EAAE,EAAE;gBAClC,IACE,CAAC,wCAAwC,CAAC,SAAS,CAAC;oBACpD,CAAC,kBAAkB,CAAC,SAAS,CAAC,EAC9B,CAAC;oBACD,MAAM,IAAI,GAAG,gBAAgB,CAAC,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;oBAC1D,IACE,CAAC,6BAA6B,CAAC,SAAS,CAAC;wBACzC,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM;4BACtB,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,UAAU,CAAC,kBAAkB,CAAC,EAC/D,CAAC;wBACD,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