@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.
- package/README.md +10 -7
- package/dist/generated-defs/Azure.ResourceManager.BaseTypes.d.ts +1 -1
- package/dist/generated-defs/Azure.ResourceManager.Private.d.ts.map +1 -1
- package/dist/generated-defs/Azure.ResourceManager.d.ts +1 -1
- package/dist/src/base-types.d.ts +1 -1
- package/dist/src/base-types.d.ts.map +1 -1
- package/dist/src/common-types.d.ts +4 -4
- package/dist/src/common-types.d.ts.map +1 -1
- package/dist/src/commontypes.private.decorators.d.ts +2 -2
- package/dist/src/commontypes.private.decorators.d.ts.map +1 -1
- package/dist/src/linter.d.ts.map +1 -1
- package/dist/src/linter.js +8 -2
- package/dist/src/linter.js.map +1 -1
- package/dist/src/namespace.d.ts +2 -2
- package/dist/src/namespace.d.ts.map +1 -1
- package/dist/src/operations.d.ts +4 -4
- package/dist/src/operations.d.ts.map +1 -1
- package/dist/src/operations.js.map +1 -1
- package/dist/src/private.decorators.d.ts +2 -2
- package/dist/src/private.decorators.d.ts.map +1 -1
- package/dist/src/private.decorators.js +17 -6
- package/dist/src/private.decorators.js.map +1 -1
- package/dist/src/resource.d.ts +4 -4
- package/dist/src/resource.d.ts.map +1 -1
- package/dist/src/resource.js +6 -0
- package/dist/src/resource.js.map +1 -1
- package/dist/src/rules/arm-agent-base-type-child-resources.d.ts.map +1 -1
- package/dist/src/rules/arm-agent-base-type-child-resources.js +2 -1
- package/dist/src/rules/arm-agent-base-type-child-resources.js.map +1 -1
- package/dist/src/rules/arm-agent-base-type-lifecycle-operations.d.ts.map +1 -1
- package/dist/src/rules/arm-agent-base-type-lifecycle-operations.js +2 -1
- package/dist/src/rules/arm-agent-base-type-lifecycle-operations.js.map +1 -1
- package/dist/src/rules/arm-common-types-version.d.ts.map +1 -1
- package/dist/src/rules/arm-common-types-version.js +2 -1
- package/dist/src/rules/arm-common-types-version.js.map +1 -1
- package/dist/src/rules/arm-custom-resource-no-key.d.ts.map +1 -1
- package/dist/src/rules/arm-custom-resource-no-key.js +2 -1
- package/dist/src/rules/arm-custom-resource-no-key.js.map +1 -1
- package/dist/src/rules/arm-custom-resource-usage-discourage.d.ts.map +1 -1
- package/dist/src/rules/arm-custom-resource-usage-discourage.js +2 -1
- package/dist/src/rules/arm-custom-resource-usage-discourage.js.map +1 -1
- package/dist/src/rules/arm-delete-response-codes.d.ts.map +1 -1
- package/dist/src/rules/arm-delete-response-codes.js +3 -2
- package/dist/src/rules/arm-delete-response-codes.js.map +1 -1
- package/dist/src/rules/arm-feature-file-usage-discourage.d.ts.map +1 -1
- package/dist/src/rules/arm-feature-file-usage-discourage.js +2 -1
- package/dist/src/rules/arm-feature-file-usage-discourage.js.map +1 -1
- package/dist/src/rules/arm-legacy-operations-discourage.js.map +1 -1
- package/dist/src/rules/arm-no-path-casing-conflicts.d.ts.map +1 -1
- package/dist/src/rules/arm-no-path-casing-conflicts.js +2 -1
- package/dist/src/rules/arm-no-path-casing-conflicts.js.map +1 -1
- package/dist/src/rules/arm-no-record.d.ts.map +1 -1
- package/dist/src/rules/arm-no-record.js +2 -1
- package/dist/src/rules/arm-no-record.js.map +1 -1
- package/dist/src/rules/arm-post-response-codes.d.ts.map +1 -1
- package/dist/src/rules/arm-post-response-codes.js +3 -2
- package/dist/src/rules/arm-post-response-codes.js.map +1 -1
- package/dist/src/rules/arm-put-response-codes.d.ts.map +1 -1
- package/dist/src/rules/arm-put-response-codes.js +3 -2
- package/dist/src/rules/arm-put-response-codes.js.map +1 -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 +2 -1
- package/dist/src/rules/arm-resource-action-no-segment.js.map +1 -1
- package/dist/src/rules/arm-resource-duplicate-property.d.ts.map +1 -1
- package/dist/src/rules/arm-resource-duplicate-property.js +2 -1
- package/dist/src/rules/arm-resource-duplicate-property.js.map +1 -1
- package/dist/src/rules/arm-resource-interfaces.d.ts.map +1 -1
- package/dist/src/rules/arm-resource-interfaces.js +2 -1
- package/dist/src/rules/arm-resource-interfaces.js.map +1 -1
- package/dist/src/rules/arm-resource-invalid-action-verb.d.ts.map +1 -1
- package/dist/src/rules/arm-resource-invalid-action-verb.js +2 -1
- package/dist/src/rules/arm-resource-invalid-action-verb.js.map +1 -1
- package/dist/src/rules/arm-resource-invalid-envelope-property.d.ts.map +1 -1
- package/dist/src/rules/arm-resource-invalid-envelope-property.js +2 -1
- package/dist/src/rules/arm-resource-invalid-envelope-property.js.map +1 -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 +2 -1
- package/dist/src/rules/arm-resource-invalid-version-format.js.map +1 -1
- package/dist/src/rules/arm-resource-key-invalid-chars.d.ts.map +1 -1
- package/dist/src/rules/arm-resource-key-invalid-chars.js +2 -1
- package/dist/src/rules/arm-resource-key-invalid-chars.js.map +1 -1
- package/dist/src/rules/arm-resource-name-pattern.d.ts.map +1 -1
- package/dist/src/rules/arm-resource-name-pattern.js +3 -2
- package/dist/src/rules/arm-resource-name-pattern.js.map +1 -1
- package/dist/src/rules/arm-resource-operation-response.d.ts.map +1 -1
- package/dist/src/rules/arm-resource-operation-response.js +2 -1
- package/dist/src/rules/arm-resource-operation-response.js.map +1 -1
- package/dist/src/rules/arm-resource-patch.d.ts.map +1 -1
- package/dist/src/rules/arm-resource-patch.js +2 -1
- package/dist/src/rules/arm-resource-patch.js.map +1 -1
- package/dist/src/rules/arm-resource-path-invalid-chars.d.ts.map +1 -1
- package/dist/src/rules/arm-resource-path-invalid-chars.js +2 -1
- package/dist/src/rules/arm-resource-path-invalid-chars.js.map +1 -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 +2 -1
- package/dist/src/rules/arm-resource-provisioning-state-rule.js.map +1 -1
- package/dist/src/rules/beyond-nesting-levels.d.ts.map +1 -1
- package/dist/src/rules/beyond-nesting-levels.js +2 -1
- package/dist/src/rules/beyond-nesting-levels.js.map +1 -1
- package/dist/src/rules/envelope-properties.d.ts.map +1 -1
- package/dist/src/rules/envelope-properties.js +2 -1
- package/dist/src/rules/envelope-properties.js.map +1 -1
- package/dist/src/rules/improper-subscription-list-operation.d.ts.map +1 -1
- package/dist/src/rules/improper-subscription-list-operation.js +2 -1
- package/dist/src/rules/improper-subscription-list-operation.js.map +1 -1
- package/dist/src/rules/lro-location-header.d.ts.map +1 -1
- package/dist/src/rules/lro-location-header.js +2 -1
- package/dist/src/rules/lro-location-header.js.map +1 -1
- package/dist/src/rules/missing-x-ms-identifiers.d.ts.map +1 -1
- package/dist/src/rules/missing-x-ms-identifiers.js +2 -1
- package/dist/src/rules/missing-x-ms-identifiers.js.map +1 -1
- package/dist/src/rules/no-empty-model.d.ts.map +1 -1
- package/dist/src/rules/no-empty-model.js +2 -1
- package/dist/src/rules/no-empty-model.js.map +1 -1
- package/dist/src/rules/no-override-props.d.ts.map +1 -1
- package/dist/src/rules/no-override-props.js +2 -1
- package/dist/src/rules/no-override-props.js.map +1 -1
- package/dist/src/rules/no-reserved-resource-property.d.ts.map +1 -1
- package/dist/src/rules/no-reserved-resource-property.js +2 -1
- package/dist/src/rules/no-reserved-resource-property.js.map +1 -1
- package/dist/src/rules/no-resource-delete-operation.d.ts.map +1 -1
- package/dist/src/rules/no-resource-delete-operation.js +2 -1
- package/dist/src/rules/no-resource-delete-operation.js.map +1 -1
- package/dist/src/rules/no-response-body.d.ts.map +1 -1
- package/dist/src/rules/no-response-body.js +3 -2
- package/dist/src/rules/no-response-body.js.map +1 -1
- package/dist/src/rules/operations-interface-missing.d.ts.map +1 -1
- package/dist/src/rules/operations-interface-missing.js +2 -1
- package/dist/src/rules/operations-interface-missing.js.map +1 -1
- package/dist/src/rules/patch-envelope-properties.d.ts.map +1 -1
- package/dist/src/rules/patch-envelope-properties.js +2 -1
- package/dist/src/rules/patch-envelope-properties.js.map +1 -1
- package/dist/src/rules/resource-name.d.ts.map +1 -1
- package/dist/src/rules/resource-name.js +2 -1
- package/dist/src/rules/resource-name.js.map +1 -1
- package/dist/src/rules/retry-after.d.ts.map +1 -1
- package/dist/src/rules/retry-after.js +2 -1
- package/dist/src/rules/retry-after.js.map +1 -1
- package/dist/src/rules/secret-prop.d.ts.map +1 -1
- package/dist/src/rules/secret-prop.js +2 -1
- package/dist/src/rules/secret-prop.js.map +1 -1
- package/dist/src/rules/unsupported-type.d.ts.map +1 -1
- package/dist/src/rules/unsupported-type.js +2 -1
- package/dist/src/rules/unsupported-type.js.map +1 -1
- package/dist/src/rules/use-api-version.d.ts +4 -0
- package/dist/src/rules/use-api-version.d.ts.map +1 -0
- package/dist/src/rules/use-api-version.js +45 -0
- package/dist/src/rules/use-api-version.js.map +1 -0
- package/dist/src/rules/use-interface.d.ts +4 -0
- package/dist/src/rules/use-interface.d.ts.map +1 -0
- package/dist/src/rules/use-interface.js +29 -0
- package/dist/src/rules/use-interface.js.map +1 -0
- package/dist/src/rules/use-operation-decorator.d.ts +5 -0
- package/dist/src/rules/use-operation-decorator.d.ts.map +1 -0
- package/dist/src/rules/use-operation-decorator.js +133 -0
- package/dist/src/rules/use-operation-decorator.js.map +1 -0
- package/dist/src/rules/use-relationship-required-properties.d.ts +5 -0
- package/dist/src/rules/use-relationship-required-properties.d.ts.map +1 -0
- package/dist/src/rules/use-relationship-required-properties.js +79 -0
- package/dist/src/rules/use-relationship-required-properties.js.map +1 -0
- package/dist/src/rules/utils.d.ts +2 -2
- package/dist/src/rules/utils.d.ts.map +1 -1
- package/dist/src/rules/utils.js.map +1 -1
- package/dist/src/rules/version-progression.d.ts.map +1 -1
- package/dist/src/rules/version-progression.js +2 -1
- package/dist/src/rules/version-progression.js.map +1 -1
- package/dist/src/testing/index.d.ts +1 -1
- package/dist/src/testing/index.d.ts.map +1 -1
- package/lib/arm.tsp +1 -0
- package/lib/base-types/agent.tsp +12 -8
- package/lib/base-types/base-types.tsp +1 -1
- package/lib/base-types/relationship.tsp +46 -0
- package/lib/common-types/managed-identity-ref.tsp +1 -1
- package/lib/common-types/nsp-operations.tsp +1 -5
- package/lib/common-types/private-links-ref.tsp +1 -1
- package/lib/decorators.tsp +1 -1
- package/lib/extension/operations.tsp +17 -17
- package/lib/extension/parameters.tsp +19 -5
- package/lib/legacy-types/extension-operations.tsp +5 -5
- package/lib/legacy-types/extension.tsp +2 -2
- package/lib/legacy-types/operations.tsp +4 -4
- package/lib/legacy-types/private-endpoints.tsp +0 -2
- package/lib/operations.tsp +2 -2
- package/lib/responses.tsp +3 -3
- package/package.json +15 -15
- package/dist/src/rules/core-operations.d.ts +0 -6
- package/dist/src/rules/core-operations.d.ts.map +0 -1
- package/dist/src/rules/core-operations.js +0 -104
- 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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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.
|
package/lib/operations.tsp
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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.
|
|
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
|
|
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
|
|
53
|
+
"@typespec/rest": "^0.84.0",
|
|
54
54
|
"@typespec/openapi": "^1.14.0",
|
|
55
|
-
"@typespec/versioning": "^0.84.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
|
|
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": "
|
|
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,gBAA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