@azure-tools/typespec-azure-resource-manager 0.40.0-dev.2 → 0.40.0-dev.3
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 +26 -25
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/lib.js +0 -81
- package/dist/src/lib.js.map +1 -1
- package/dist/src/linter.d.ts +2 -0
- package/dist/src/linter.d.ts.map +1 -0
- package/dist/src/linter.js +66 -0
- package/dist/src/linter.js.map +1 -0
- package/dist/src/rules/missing-x-ms-identifiers.d.ts +6 -0
- package/dist/src/rules/missing-x-ms-identifiers.d.ts.map +1 -0
- package/dist/src/rules/missing-x-ms-identifiers.js +79 -0
- package/dist/src/rules/missing-x-ms-identifiers.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,31 +28,32 @@ Available ruleSets:
|
|
|
28
28
|
|
|
29
29
|
### Rules
|
|
30
30
|
|
|
31
|
-
| Name
|
|
32
|
-
|
|
|
33
|
-
| `@azure-tools/typespec-azure-resource-manager/arm-
|
|
34
|
-
| `@azure-tools/typespec-azure-resource-manager/arm-resource-
|
|
35
|
-
| `@azure-tools/typespec-azure-resource-manager/arm-resource-
|
|
36
|
-
| `@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-
|
|
37
|
-
| `@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-
|
|
38
|
-
| `@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-
|
|
39
|
-
| `@azure-tools/typespec-azure-resource-manager/arm-resource-
|
|
40
|
-
| `@azure-tools/typespec-azure-resource-manager/arm-resource-
|
|
41
|
-
| `@azure-tools/typespec-azure-resource-manager/arm-resource-
|
|
42
|
-
| `@azure-tools/typespec-azure-resource-manager/
|
|
43
|
-
| `@azure-tools/typespec-azure-resource-manager/arm-resource-
|
|
44
|
-
| `@azure-tools/typespec-azure-resource-manager/
|
|
45
|
-
| `@azure-tools/typespec-azure-resource-manager/
|
|
46
|
-
| `@azure-tools/typespec-azure-resource-manager/arm-resource-
|
|
47
|
-
| `@azure-tools/typespec-azure-resource-manager/
|
|
48
|
-
| `@azure-tools/typespec-azure-resource-manager/
|
|
49
|
-
| `@azure-tools/typespec-azure-resource-manager/
|
|
50
|
-
| `@azure-tools/typespec-azure-resource-manager/no-response-body`
|
|
51
|
-
| `@azure-tools/typespec-azure-resource-manager/missing-operations-endpoint`
|
|
52
|
-
| `@azure-tools/typespec-azure-resource-manager/patch-envelope`
|
|
53
|
-
| `@azure-tools/typespec-azure-resource-manager/resource-
|
|
54
|
-
| `@azure-tools/typespec-azure-resource-manager/
|
|
55
|
-
|
|
|
31
|
+
| Name | Description |
|
|
32
|
+
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
|
|
33
|
+
| `@azure-tools/typespec-azure-resource-manager/arm-common-types-version` | Specify the ARM common-types version using @armCommonTypesVersion. |
|
|
34
|
+
| `@azure-tools/typespec-azure-resource-manager/arm-resource-action-no-segment` | `@armResourceAction` should not be used with `@segment`. |
|
|
35
|
+
| `@azure-tools/typespec-azure-resource-manager/arm-resource-duplicate-property` | Warn about duplicate properties in resources. |
|
|
36
|
+
| `@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property` | Check for invalid resource envelope properties. |
|
|
37
|
+
| `@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-version-format` | Check for valid versions. |
|
|
38
|
+
| `@azure-tools/typespec-azure-resource-manager/arm-resource-key-invalid-chars` | Arm resource key must contain only alphanumeric characters. |
|
|
39
|
+
| `@azure-tools/typespec-azure-resource-manager/arm-resource-operation-response` | [RPC 008]: PUT, GET, PATCH & LIST must return the same resource schema. |
|
|
40
|
+
| `@azure-tools/typespec-azure-resource-manager/arm-resource-path-segment-invalid-chars` | Arm resource name must contain only alphanumeric characters. |
|
|
41
|
+
| `@azure-tools/typespec-azure-resource-manager/arm-resource-provisioning-state` | Check for properly configured provisioningState property. |
|
|
42
|
+
| `@azure-tools/typespec-azure-resource-manager/beyond-nesting-levels` | Tracked Resources must use 3 or fewer levels of nesting. |
|
|
43
|
+
| `@azure-tools/typespec-azure-resource-manager/arm-resource-operation` | Validate ARM Resource operations. |
|
|
44
|
+
| `@azure-tools/typespec-azure-resource-manager/no-resource-delete-operation` | Check for resources that must have a delete operation. |
|
|
45
|
+
| `@azure-tools/typespec-azure-resource-manager/empty-updateable-properties` | Should have updateable properties. |
|
|
46
|
+
| `@azure-tools/typespec-azure-resource-manager/arm-resource-interface-requires-decorator` | Each resource interface must have an @armResourceOperations decorator. |
|
|
47
|
+
| `@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-action-verb` | Actions must be HTTP Post operations. |
|
|
48
|
+
| `@azure-tools/typespec-azure-resource-manager/improper-subscription-list-operation` | Tenant and Extension resources should not define a list by subscription operation. |
|
|
49
|
+
| [`@azure-tools/typespec-azure-resource-manager/missing-x-ms-identifiers`](https://azure.github.io/typespec-azure/docs/libraries/azure-resource-manager/rules/missing-x-ms-identifiers) | Azure services should not use enums. |
|
|
50
|
+
| `@azure-tools/typespec-azure-resource-manager/no-response-body` | The body of 202 response should be empty. |
|
|
51
|
+
| `@azure-tools/typespec-azure-resource-manager/missing-operations-endpoint` | Check for missing Operations interface. |
|
|
52
|
+
| `@azure-tools/typespec-azure-resource-manager/patch-envelope` | Patch envelope properties should match the resource properties. |
|
|
53
|
+
| `@azure-tools/typespec-azure-resource-manager/arm-resource-patch` | Validate ARM PATCH operations. |
|
|
54
|
+
| `@azure-tools/typespec-azure-resource-manager/resource-name` | Check the resource name. |
|
|
55
|
+
| `@azure-tools/typespec-azure-resource-manager/retry-after` | Check if retry-after header appears in response body. |
|
|
56
|
+
| [`@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. |
|
|
56
57
|
|
|
57
58
|
## Decorators
|
|
58
59
|
|
package/dist/src/index.d.ts
CHANGED
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,0BAA0B,CAAC;AAEjD,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAE9B,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,0BAA0B,CAAC;AAEjD,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAE9B,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/src/index.js
CHANGED
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG,uBAAuB,CAAC;AAEjD,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAE9B,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG,uBAAuB,CAAC;AAEjD,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAE9B,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/src/lib.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../../src/lib.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../../src/lib.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BA+Ff,CAAC;AAEH,eAAO,MAAQ,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAAE,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oDAAS,CAAC"}
|
package/dist/src/lib.js
CHANGED
|
@@ -1,27 +1,4 @@
|
|
|
1
1
|
import { createTypeSpecLibrary, paramMessage } from "@typespec/compiler";
|
|
2
|
-
import { armCommonTypesVersionRule } from "./rules/arm-common-types-version.js";
|
|
3
|
-
import { armResourceActionNoSegmentRule } from "./rules/arm-resource-action-no-segment.js";
|
|
4
|
-
import { armResourceDuplicatePropertiesRule } from "./rules/arm-resource-duplicate-property.js";
|
|
5
|
-
import { interfacesRule } from "./rules/arm-resource-interfaces.js";
|
|
6
|
-
import { invalidActionVerbRule } from "./rules/arm-resource-invalid-action-verb.js";
|
|
7
|
-
import { armResourceEnvelopeProperties } from "./rules/arm-resource-invalid-envelope-property.js";
|
|
8
|
-
import { armResourceInvalidVersionFormatRule } from "./rules/arm-resource-invalid-version-format.js";
|
|
9
|
-
import { armResourceKeyInvalidCharsRule } from "./rules/arm-resource-key-invalid-chars.js";
|
|
10
|
-
import { armResourceOperationsRule } from "./rules/arm-resource-operation-response.js";
|
|
11
|
-
import { patchOperationsRule } from "./rules/arm-resource-patch.js";
|
|
12
|
-
import { armResourcePathInvalidCharsRule } from "./rules/arm-resource-path-invalid-chars.js";
|
|
13
|
-
import { armResourceProvisioningStateRule } from "./rules/arm-resource-provisioning-state-rule.js";
|
|
14
|
-
import { beyondNestingRule } from "./rules/beyond-nesting-levels.js";
|
|
15
|
-
import { coreOperationsRule } from "./rules/core-operations.js";
|
|
16
|
-
import { deleteOperationMissingRule } from "./rules/delete-operation.js";
|
|
17
|
-
import { envelopePropertiesRules } from "./rules/envelope-properties.js";
|
|
18
|
-
import { listBySubscriptionRule } from "./rules/list-operation.js";
|
|
19
|
-
import { noResponseBodyRule } from "./rules/no-response-body.js";
|
|
20
|
-
import { operationsInterfaceMissingRule } from "./rules/operations-interface-missing.js";
|
|
21
|
-
import { patchEnvelopePropertiesRules } from "./rules/patch-envelope-properties.js";
|
|
22
|
-
import { resourceNameRule } from "./rules/resource-name.js";
|
|
23
|
-
import { retryAfterRule } from "./rules/retry-after.js";
|
|
24
|
-
import { unsupportedTypeRule } from "./rules/unsupported-type.js";
|
|
25
2
|
export const $lib = createTypeSpecLibrary({
|
|
26
3
|
name: "@azure-tools/typespec-azure-resource-manager",
|
|
27
4
|
diagnostics: {
|
|
@@ -110,64 +87,6 @@ export const $lib = createTypeSpecLibrary({
|
|
|
110
87
|
},
|
|
111
88
|
},
|
|
112
89
|
},
|
|
113
|
-
linter: {
|
|
114
|
-
rules: [
|
|
115
|
-
armResourceActionNoSegmentRule,
|
|
116
|
-
armResourceDuplicatePropertiesRule,
|
|
117
|
-
interfacesRule,
|
|
118
|
-
invalidActionVerbRule,
|
|
119
|
-
armResourceEnvelopeProperties,
|
|
120
|
-
armResourceInvalidVersionFormatRule,
|
|
121
|
-
armResourceKeyInvalidCharsRule,
|
|
122
|
-
armResourceOperationsRule,
|
|
123
|
-
patchOperationsRule,
|
|
124
|
-
armResourcePathInvalidCharsRule,
|
|
125
|
-
armResourceProvisioningStateRule,
|
|
126
|
-
armCommonTypesVersionRule,
|
|
127
|
-
beyondNestingRule,
|
|
128
|
-
coreOperationsRule,
|
|
129
|
-
deleteOperationMissingRule,
|
|
130
|
-
envelopePropertiesRules,
|
|
131
|
-
listBySubscriptionRule,
|
|
132
|
-
noResponseBodyRule,
|
|
133
|
-
operationsInterfaceMissingRule,
|
|
134
|
-
patchEnvelopePropertiesRules,
|
|
135
|
-
resourceNameRule,
|
|
136
|
-
retryAfterRule,
|
|
137
|
-
unsupportedTypeRule,
|
|
138
|
-
],
|
|
139
|
-
ruleSets: {
|
|
140
|
-
all: {
|
|
141
|
-
enable: {
|
|
142
|
-
[`@azure-tools/typespec-azure-resource-manager/${armResourceActionNoSegmentRule.name}`]: true,
|
|
143
|
-
[`@azure-tools/typespec-azure-resource-manager/${armResourceDuplicatePropertiesRule.name}`]: true,
|
|
144
|
-
[`@azure-tools/typespec-azure-resource-manager/${interfacesRule.name}`]: true,
|
|
145
|
-
[`@azure-tools/typespec-azure-resource-manager/${invalidActionVerbRule.name}`]: true,
|
|
146
|
-
[`@azure-tools/typespec-azure-resource-manager/${armResourceEnvelopeProperties.name}`]: true,
|
|
147
|
-
[`@azure-tools/typespec-azure-resource-manager/${armResourceInvalidVersionFormatRule.name}`]: true,
|
|
148
|
-
[`@azure-tools/typespec-azure-resource-manager/${armResourceKeyInvalidCharsRule.name}`]: true,
|
|
149
|
-
[`@azure-tools/typespec-azure-resource-manager/${armResourceOperationsRule.name}`]: true,
|
|
150
|
-
[`@azure-tools/typespec-azure-resource-manager/${patchOperationsRule.name}`]: true,
|
|
151
|
-
[`@azure-tools/typespec-azure-resource-manager/${armResourcePathInvalidCharsRule.name}`]: true,
|
|
152
|
-
[`@azure-tools/typespec-azure-resource-manager/${armResourceProvisioningStateRule.name}`]: true,
|
|
153
|
-
// TODO: Enable this rule once azure-rest-api-specs repo is ready (issue #3839)
|
|
154
|
-
[`@azure-tools/typespec-azure-resource-manager/${armCommonTypesVersionRule.name}`]: false,
|
|
155
|
-
[`@azure-tools/typespec-azure-resource-manager/${beyondNestingRule.name}`]: true,
|
|
156
|
-
[`@azure-tools/typespec-azure-resource-manager/${coreOperationsRule.name}`]: true,
|
|
157
|
-
[`@azure-tools/typespec-azure-resource-manager/${deleteOperationMissingRule.name}`]: true,
|
|
158
|
-
[`@azure-tools/typespec-azure-resource-manager/${envelopePropertiesRules.name}`]: true,
|
|
159
|
-
[`@azure-tools/typespec-azure-resource-manager/${listBySubscriptionRule.name}`]: true,
|
|
160
|
-
[`@azure-tools/typespec-azure-resource-manager/${noResponseBodyRule.name}`]: true,
|
|
161
|
-
[`@azure-tools/typespec-azure-resource-manager/${operationsInterfaceMissingRule.name}`]: true,
|
|
162
|
-
[`@azure-tools/typespec-azure-resource-manager/${patchEnvelopePropertiesRules.name}`]: true,
|
|
163
|
-
[`@azure-tools/typespec-azure-resource-manager/${resourceNameRule.name}`]: true,
|
|
164
|
-
[`@azure-tools/typespec-azure-resource-manager/${retryAfterRule.name}`]: true,
|
|
165
|
-
[`@azure-tools/typespec-azure-resource-manager/${unsupportedTypeRule.name}`]: true,
|
|
166
|
-
},
|
|
167
|
-
extends: ["@azure-tools/typespec-azure-core/all"],
|
|
168
|
-
},
|
|
169
|
-
},
|
|
170
|
-
},
|
|
171
90
|
});
|
|
172
91
|
export const { reportDiagnostic, createDiagnostic } = $lib;
|
|
173
92
|
//# sourceMappingURL=lib.js.map
|
package/dist/src/lib.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../../src/lib.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../../src/lib.ts"],"names":[],"mappings":"AAAA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,SAAS;YACnB,QAAQ,EAAE;gBACR,OAAO,EAAE,YAAY,CAAA,4EAA4E,iBAAiB,wDAAwD,mBAAmB,EAAE;aAChM;SACF;QACD,wBAAwB,EAAE;YACxB,QAAQ,EAAE,OAAO;YACjB,QAAQ,EAAE;gBACR,OAAO,EAAE,YAAY,CAAA,QAAQ,eAAe,uFAAuF;aACpI;SACF;QACD,aAAa,EAAE;YACb,QAAQ,EAAE,OAAO;YACjB,QAAQ,EAAE;gBACR,eAAe,EAAE,YAAY,CAAA,eAAe,QAAQ,OAAO,MAAM,6CAA6C;aAC/G;SACF;QACD,mCAAmC,EAAE;YACnC,QAAQ,EAAE,OAAO;YACjB,QAAQ,EAAE;gBACR,OAAO,EAAE,6EAA6E;aACvF;SACF;KACF;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,GAAG,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linter.d.ts","sourceRoot":"","sources":["../../src/linter.ts"],"names":[],"mappings":"AAyDA,eAAO,MAAM,OAAO,+CAYlB,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { defineLinter } from "@typespec/compiler";
|
|
2
|
+
import { armCommonTypesVersionRule } from "./rules/arm-common-types-version.js";
|
|
3
|
+
import { armResourceActionNoSegmentRule } from "./rules/arm-resource-action-no-segment.js";
|
|
4
|
+
import { armResourceDuplicatePropertiesRule } from "./rules/arm-resource-duplicate-property.js";
|
|
5
|
+
import { interfacesRule } from "./rules/arm-resource-interfaces.js";
|
|
6
|
+
import { invalidActionVerbRule } from "./rules/arm-resource-invalid-action-verb.js";
|
|
7
|
+
import { armResourceEnvelopeProperties } from "./rules/arm-resource-invalid-envelope-property.js";
|
|
8
|
+
import { armResourceInvalidVersionFormatRule } from "./rules/arm-resource-invalid-version-format.js";
|
|
9
|
+
import { armResourceKeyInvalidCharsRule } from "./rules/arm-resource-key-invalid-chars.js";
|
|
10
|
+
import { armResourceOperationsRule } from "./rules/arm-resource-operation-response.js";
|
|
11
|
+
import { patchOperationsRule } from "./rules/arm-resource-patch.js";
|
|
12
|
+
import { armResourcePathInvalidCharsRule } from "./rules/arm-resource-path-invalid-chars.js";
|
|
13
|
+
import { armResourceProvisioningStateRule } from "./rules/arm-resource-provisioning-state-rule.js";
|
|
14
|
+
import { beyondNestingRule } from "./rules/beyond-nesting-levels.js";
|
|
15
|
+
import { coreOperationsRule } from "./rules/core-operations.js";
|
|
16
|
+
import { deleteOperationMissingRule } from "./rules/delete-operation.js";
|
|
17
|
+
import { envelopePropertiesRules } from "./rules/envelope-properties.js";
|
|
18
|
+
import { listBySubscriptionRule } from "./rules/list-operation.js";
|
|
19
|
+
import { missingXmsIdentifiersRule } from "./rules/missing-x-ms-identifiers.js";
|
|
20
|
+
import { noResponseBodyRule } from "./rules/no-response-body.js";
|
|
21
|
+
import { operationsInterfaceMissingRule } from "./rules/operations-interface-missing.js";
|
|
22
|
+
import { patchEnvelopePropertiesRules } from "./rules/patch-envelope-properties.js";
|
|
23
|
+
import { resourceNameRule } from "./rules/resource-name.js";
|
|
24
|
+
import { retryAfterRule } from "./rules/retry-after.js";
|
|
25
|
+
import { unsupportedTypeRule } from "./rules/unsupported-type.js";
|
|
26
|
+
const rules = [
|
|
27
|
+
armCommonTypesVersionRule,
|
|
28
|
+
armResourceActionNoSegmentRule,
|
|
29
|
+
armResourceDuplicatePropertiesRule,
|
|
30
|
+
armResourceEnvelopeProperties,
|
|
31
|
+
armResourceInvalidVersionFormatRule,
|
|
32
|
+
armResourceKeyInvalidCharsRule,
|
|
33
|
+
armResourceOperationsRule,
|
|
34
|
+
armResourcePathInvalidCharsRule,
|
|
35
|
+
armResourceProvisioningStateRule,
|
|
36
|
+
beyondNestingRule,
|
|
37
|
+
coreOperationsRule,
|
|
38
|
+
deleteOperationMissingRule,
|
|
39
|
+
envelopePropertiesRules,
|
|
40
|
+
interfacesRule,
|
|
41
|
+
invalidActionVerbRule,
|
|
42
|
+
listBySubscriptionRule,
|
|
43
|
+
missingXmsIdentifiersRule,
|
|
44
|
+
noResponseBodyRule,
|
|
45
|
+
operationsInterfaceMissingRule,
|
|
46
|
+
patchEnvelopePropertiesRules,
|
|
47
|
+
patchOperationsRule,
|
|
48
|
+
resourceNameRule,
|
|
49
|
+
retryAfterRule,
|
|
50
|
+
unsupportedTypeRule,
|
|
51
|
+
];
|
|
52
|
+
const allRulesEnabled = Object.fromEntries(rules.map((rule) => [`@azure-tools/typespec-azure-resource-manager/${rule.name}`, true]));
|
|
53
|
+
export const $linter = defineLinter({
|
|
54
|
+
rules,
|
|
55
|
+
ruleSets: {
|
|
56
|
+
all: {
|
|
57
|
+
enable: {
|
|
58
|
+
...allRulesEnabled,
|
|
59
|
+
// TODO: Enable this rule once azure-rest-api-specs repo is ready (issue #3839)
|
|
60
|
+
[`@azure-tools/typespec-azure-resource-manager/${armCommonTypesVersionRule.name}`]: false,
|
|
61
|
+
},
|
|
62
|
+
extends: ["@azure-tools/typespec-azure-core/all"],
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
//# sourceMappingURL=linter.js.map
|
|
@@ -0,0 +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,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AAChF,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,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AACpF,OAAO,EAAE,6BAA6B,EAAE,MAAM,mDAAmD,CAAC;AAClG,OAAO,EAAE,mCAAmC,EAAE,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AA4B;IAC5B,mBAAmB;IACnB,gBAAgB;IAChB,cAAc;IACd,mBAAmB;CACpB,CAAC;AAEF,MAAM,eAAe,GAAG,MAAM,CAAC,WAAW,CACxC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,gDAAgD,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,CAAC,CAAC,CACzF,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,YAAY,CAAC;IAClC,KAAK;IACL,QAAQ,EAAE;QACR,GAAG,EAAE;YACH,MAAM,EAAE;gBACN,GAAG,eAAe;gBAClB,+EAA+E;gBAC/E,CAAC,gDAAgD,yBAAyB,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK;aAC1F;YACD,OAAO,EAAE,CAAC,sCAAsC,CAAC;SAClD;KACF;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const missingXmsIdentifiersRule: import("@typespec/compiler").LinterRuleDefinition<"missing-x-ms-identifiers", {
|
|
2
|
+
readonly default: "Missing identifying properties of objects in the array item, please add @extension(\"x-ms-identifiers\", [<prop>]) to specify it. If there are no appropriate identifying properties, please add @extension(\"x-ms-identifiers\",[]).";
|
|
3
|
+
readonly notArray: import("@typespec/compiler").CallableMessage<[string]>;
|
|
4
|
+
readonly missingProperty: import("@typespec/compiler").CallableMessage<[string, string]>;
|
|
5
|
+
}>;
|
|
6
|
+
//# sourceMappingURL=missing-x-ms-identifiers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"missing-x-ms-identifiers.d.ts","sourceRoot":"","sources":["../../../src/rules/missing-x-ms-identifiers.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,yBAAyB;;;;EAmFpC,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { createRule, getProperty, isArrayModelType, paramMessage, } from "@typespec/compiler";
|
|
2
|
+
import { getExtensions } from "@typespec/openapi";
|
|
3
|
+
import { isArmCommonType } from "../common-types.js";
|
|
4
|
+
export const missingXmsIdentifiersRule = createRule({
|
|
5
|
+
name: "missing-x-ms-identifiers",
|
|
6
|
+
description: "Azure services should not use enums.",
|
|
7
|
+
severity: "warning",
|
|
8
|
+
url: "https://azure.github.io/typespec-azure/docs/libraries/azure-resource-manager/rules/missing-x-ms-identifiers",
|
|
9
|
+
messages: {
|
|
10
|
+
default: `Missing identifying properties of objects in the array item, please add @extension("x-ms-identifiers", [<prop>]) to specify it. If there are no appropriate identifying properties, please add @extension("x-ms-identifiers",[]).`,
|
|
11
|
+
notArray: paramMessage `Value passed to @extension("x-ms-identifiers",...) was a "${"valueType"}". Pass an array of property name.`,
|
|
12
|
+
missingProperty: paramMessage `Property "${"propertyName"}" is not found in "${"targetModelName"}". Make sure value of x-ms-identifiers extension are valid property name of the array element.`,
|
|
13
|
+
},
|
|
14
|
+
create(context) {
|
|
15
|
+
return {
|
|
16
|
+
enum: (en) => {
|
|
17
|
+
context.reportDiagnostic({
|
|
18
|
+
format: { enumName: en.name },
|
|
19
|
+
target: en,
|
|
20
|
+
});
|
|
21
|
+
},
|
|
22
|
+
modelProperty: (property) => {
|
|
23
|
+
const type = property.type;
|
|
24
|
+
if (type.kind === "Model" && isArrayModelType(context.program, type)) {
|
|
25
|
+
if (isArrayMissingIdentifier(context.program, type, property)) {
|
|
26
|
+
context.reportDiagnostic({
|
|
27
|
+
target: property,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
function isArrayMissingIdentifier(program, array, property) {
|
|
34
|
+
const elementType = array.indexer.value;
|
|
35
|
+
if (elementType.kind !== "Model") {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
if (isArmCommonType(elementType)) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
if (getProperty(elementType, "id")) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
const xmsIdentifiers = getExtensions(program, property !== null && property !== void 0 ? property : array).get("x-ms-identifiers");
|
|
45
|
+
if (xmsIdentifiers === undefined) {
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
if (Array.isArray(xmsIdentifiers)) {
|
|
49
|
+
for (const prop of xmsIdentifiers) {
|
|
50
|
+
if (typeof prop === "string") {
|
|
51
|
+
if (!elementType.properties.has(prop)) {
|
|
52
|
+
context.reportDiagnostic({
|
|
53
|
+
messageId: "missingProperty",
|
|
54
|
+
format: { propertyName: prop, targetModelName: elementType.name },
|
|
55
|
+
target: property,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
context.reportDiagnostic({
|
|
61
|
+
messageId: "notArray",
|
|
62
|
+
format: { valueType: typeof prop },
|
|
63
|
+
target: property,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
context.reportDiagnostic({
|
|
70
|
+
messageId: "notArray",
|
|
71
|
+
format: { valueType: typeof xmsIdentifiers },
|
|
72
|
+
target: property,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
//# sourceMappingURL=missing-x-ms-identifiers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"missing-x-ms-identifiers.js","sourceRoot":"","sources":["../../../src/rules/missing-x-ms-identifiers.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,CAAC,MAAM,yBAAyB,GAAG,UAAU,CAAC;IAClD,IAAI,EAAE,0BAA0B;IACh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1
|
{
|
|
2
2
|
"name": "@azure-tools/typespec-azure-resource-manager",
|
|
3
|
-
"version": "0.40.0-dev.
|
|
3
|
+
"version": "0.40.0-dev.3",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
5
|
"description": "TypeSpec Azure Resource Manager library",
|
|
6
6
|
"homepage": "https://azure.github.io/typespec-azure",
|