@azure-tools/typespec-azure-core 0.48.0-dev.1 → 0.48.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 +44 -46
- package/dist/src/linter.js +2 -2
- package/dist/src/linter.js.map +1 -1
- package/dist/src/rules/auth-required.d.ts.map +1 -1
- package/dist/src/rules/auth-required.js +1 -5
- package/dist/src/rules/auth-required.js.map +1 -1
- package/dist/src/rules/{casing.d.ts → casing-style.d.ts} +1 -1
- package/dist/src/rules/casing-style.d.ts.map +1 -0
- package/dist/src/rules/{casing.js → casing-style.js} +3 -12
- package/dist/src/rules/casing-style.js.map +1 -0
- package/dist/src/rules/{api-version-parameter.d.ts → operation-missing-api-version.d.ts} +1 -1
- package/dist/src/rules/operation-missing-api-version.d.ts.map +1 -0
- package/dist/src/rules/operation-missing-api-version.js +30 -0
- package/dist/src/rules/operation-missing-api-version.js.map +1 -0
- package/dist/src/rules/use-standard-names.d.ts.map +1 -1
- package/dist/src/rules/use-standard-names.js +0 -29
- package/dist/src/rules/use-standard-names.js.map +1 -1
- package/package.json +4 -4
- package/dist/src/rules/api-version-parameter.d.ts.map +0 -1
- package/dist/src/rules/api-version-parameter.js +0 -49
- package/dist/src/rules/api-version-parameter.js.map +0 -1
- package/dist/src/rules/casing.d.ts.map +0 -1
- package/dist/src/rules/casing.js.map +0 -1
package/README.md
CHANGED
|
@@ -8,9 +8,7 @@ TypeSpec Azure Core library
|
|
|
8
8
|
npm install @azure-tools/typespec-azure-core
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
##
|
|
12
|
-
|
|
13
|
-
### Usage
|
|
11
|
+
## Usage
|
|
14
12
|
|
|
15
13
|
Add the following in `tspconfig.yaml`:
|
|
16
14
|
|
|
@@ -20,55 +18,55 @@ linter:
|
|
|
20
18
|
- "@azure-tools/typespec-azure-core/all"
|
|
21
19
|
```
|
|
22
20
|
|
|
23
|
-
|
|
21
|
+
## RuleSets
|
|
24
22
|
|
|
25
23
|
Available ruleSets:
|
|
26
24
|
|
|
27
25
|
- `@azure-tools/typespec-azure-core/all`
|
|
28
26
|
- `@azure-tools/typespec-azure-core/canonical-versioning`
|
|
29
27
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
| Name
|
|
33
|
-
|
|
|
34
|
-
| `@azure-tools/typespec-azure-core/operation-missing-api-version`
|
|
35
|
-
| `@azure-tools/typespec-azure-core/auth-required`
|
|
36
|
-
| `@azure-tools/typespec-azure-core/request-body-problem`
|
|
37
|
-
| `@azure-tools/typespec-azure-core/byos`
|
|
38
|
-
| `@azure-tools/typespec-azure-core/casing-style`
|
|
39
|
-
| `@azure-tools/typespec-azure-core/composition-over-inheritance`
|
|
40
|
-
| `@azure-tools/typespec-azure-core/known-encoding`
|
|
41
|
-
| `@azure-tools/typespec-azure-core/long-running-polling-operation-required`
|
|
42
|
-
| [`@azure-tools/typespec-azure-core/no-closed-literal-union`](https://azure.github.io/typespec-azure/docs/libraries/azure-core/rules/no-closed-literal-union)
|
|
43
|
-
| [`@azure-tools/typespec-azure-core/no-enum`](https://azure.github.io/typespec-azure/docs/libraries/azure-core/rules/no-enum)
|
|
44
|
-
| `@azure-tools/typespec-azure-core/no-error-status-codes`
|
|
45
|
-
| `@azure-tools/typespec-azure-core/no-explicit-routes-resource-ops`
|
|
46
|
-
| [`@azure-tools/typespec-azure-core/non-breaking-versioning`](https://azure.github.io/typespec-azure/docs/libraries/azure-core/rules/non-breaking-versioning)
|
|
47
|
-
| [`@azure-tools/typespec-azure-core/no-generic-numeric`](https://azure.github.io/typespec-azure/docs/libraries/azure-core/rules/no-generic-numeric)
|
|
48
|
-
| [`@azure-tools/typespec-azure-core/no-nullable`](https://azure.github.io/typespec-azure/docs/libraries/azure-core/rules/no-nullable)
|
|
49
|
-
| `@azure-tools/typespec-azure-core/no-offsetdatetime`
|
|
50
|
-
| `@azure-tools/typespec-azure-core/no-response-body`
|
|
51
|
-
| `@azure-tools/typespec-azure-core/no-rpc-path-params`
|
|
52
|
-
| `@azure-tools/typespec-azure-core/no-openapi`
|
|
53
|
-
| `@azure-tools/typespec-azure-core/prefer-csv-collection-format`
|
|
54
|
-
| [`@azure-tools/typespec-azure-core/no-format`](https://azure.github.io/typespec-azure/docs/libraries/azure-core/rules/prevent-format)
|
|
55
|
-
| `@azure-tools/typespec-azure-core/no-multiple-discriminator`
|
|
56
|
-
| `@azure-tools/typespec-azure-core/no-rest-library-interfaces`
|
|
57
|
-
| `@azure-tools/typespec-azure-core/no-unknown`
|
|
58
|
-
| `@azure-tools/typespec-azure-core/property-name-conflict`
|
|
59
|
-
| [`@azure-tools/typespec-azure-core/bad-record-type`](https://azure.github.io/typespec-azure/docs/libraries/azure-core/rules/bad-record-type)
|
|
60
|
-
| `@azure-tools/typespec-azure-core/documentation-required`
|
|
61
|
-
| `@azure-tools/typespec-azure-core/key-visibility-required`
|
|
62
|
-
| `@azure-tools/typespec-azure-core/response-schema-problem`
|
|
63
|
-
| `@azure-tools/typespec-azure-core/rpc-operation-request-body`
|
|
64
|
-
| [`@azure-tools/typespec-azure-core/spread-discriminated-model`](https://azure.github.io/typespec-azure/docs/libraries/azure-core/rules/spread-discriminated-model)
|
|
65
|
-
| `@azure-tools/typespec-azure-core/use-standard-names`
|
|
66
|
-
| [`@azure-tools/typespec-azure-core/use-standard-operations`](https://azure.github.io/typespec-azure/docs/libraries/azure-core/rules/use-standard-operations)
|
|
67
|
-
| [`@azure-tools/typespec-azure-core/no-string-discriminator`](https://azure.github.io/typespec-azure/docs/libraries/azure-core/rules/no-string-discriminator)
|
|
68
|
-
| [`@azure-tools/typespec-azure-core/require-versioned`](https://azure.github.io/typespec-azure/docs/libraries/azure-core/rules/require-versioned)
|
|
69
|
-
| `@azure-tools/typespec-azure-core/friendly-name`
|
|
70
|
-
| [`@azure-tools/typespec-azure-core/no-private-usage`](https://azure.github.io/typespec-azure/docs/libraries/azure-core/rules/no-private-usage)
|
|
71
|
-
| [`@azure-tools/typespec-azure-core/no-query-explode`](https://azure.github.io/typespec-azure/docs/libraries/azure-core/rules/no-query-explode)
|
|
28
|
+
## Rules
|
|
29
|
+
|
|
30
|
+
| Name | Description |
|
|
31
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
32
|
+
| [`@azure-tools/typespec-azure-core/operation-missing-api-version`](https://azure.github.io/typespec-azure/docs/libraries/azure-core/rules/operation-missing-api-version) | Operations need an api version parameter. |
|
|
33
|
+
| [`@azure-tools/typespec-azure-core/auth-required`](https://azure.github.io/typespec-azure/docs/libraries/azure-core/rules/auth-required) | Enforce service authentication. |
|
|
34
|
+
| `@azure-tools/typespec-azure-core/request-body-problem` | Request body should not be of raw array type. |
|
|
35
|
+
| `@azure-tools/typespec-azure-core/byos` | Use the BYOS pattern recommended for Azure Services. |
|
|
36
|
+
| [`@azure-tools/typespec-azure-core/casing-style`](https://azure.github.io/typespec-azure/docs/libraries/azure-core/rules/casing-style) | Ensure proper casing style. |
|
|
37
|
+
| `@azure-tools/typespec-azure-core/composition-over-inheritance` | Check that if a model is used in an operation and has derived models that it has a discriminator or recommend to use composition via spread or `is`. |
|
|
38
|
+
| `@azure-tools/typespec-azure-core/known-encoding` | Check for supported encodings. |
|
|
39
|
+
| `@azure-tools/typespec-azure-core/long-running-polling-operation-required` | Long-running operations should have a linked polling operation. |
|
|
40
|
+
| [`@azure-tools/typespec-azure-core/no-closed-literal-union`](https://azure.github.io/typespec-azure/docs/libraries/azure-core/rules/no-closed-literal-union) | Unions of literals should include the base scalar type to mark them as open enum. |
|
|
41
|
+
| [`@azure-tools/typespec-azure-core/no-enum`](https://azure.github.io/typespec-azure/docs/libraries/azure-core/rules/no-enum) | Azure services should not use enums. |
|
|
42
|
+
| `@azure-tools/typespec-azure-core/no-error-status-codes` | Recommend using the error response defined by Azure REST API guidelines. |
|
|
43
|
+
| `@azure-tools/typespec-azure-core/no-explicit-routes-resource-ops` | The @route decorator should not be used on standard resource operation signatures. |
|
|
44
|
+
| [`@azure-tools/typespec-azure-core/non-breaking-versioning`](https://azure.github.io/typespec-azure/docs/libraries/azure-core/rules/non-breaking-versioning) | Check that only backward compatible versioning change are done to a service. |
|
|
45
|
+
| [`@azure-tools/typespec-azure-core/no-generic-numeric`](https://azure.github.io/typespec-azure/docs/libraries/azure-core/rules/no-generic-numeric) | Don't use generic types. Use more specific types instead. |
|
|
46
|
+
| [`@azure-tools/typespec-azure-core/no-nullable`](https://azure.github.io/typespec-azure/docs/libraries/azure-core/rules/no-nullable) | Use `?` for optional properties. |
|
|
47
|
+
| `@azure-tools/typespec-azure-core/no-offsetdatetime` | Prefer using `utcDateTime` when representing a datetime unless an offset is necessary. |
|
|
48
|
+
| `@azure-tools/typespec-azure-core/no-response-body` | Ensure that the body is set correctly for the response type. |
|
|
49
|
+
| `@azure-tools/typespec-azure-core/no-rpc-path-params` | Operations defined using RpcOperation should not have path parameters. |
|
|
50
|
+
| `@azure-tools/typespec-azure-core/no-openapi` | Azure specs should not be using decorators from @typespec/openapi or @azure-tools/typespec-autorest |
|
|
51
|
+
| `@azure-tools/typespec-azure-core/prefer-csv-collection-format` | It is recommended to use "csv" for collection format of parameters. |
|
|
52
|
+
| [`@azure-tools/typespec-azure-core/no-format`](https://azure.github.io/typespec-azure/docs/libraries/azure-core/rules/prevent-format) | Azure services should not use the `@format` decorator. |
|
|
53
|
+
| `@azure-tools/typespec-azure-core/no-multiple-discriminator` | Classes should have at most one discriminator. |
|
|
54
|
+
| `@azure-tools/typespec-azure-core/no-rest-library-interfaces` | Resource interfaces from the TypeSpec.Rest.Resource library are incompatible with Azure.Core. |
|
|
55
|
+
| `@azure-tools/typespec-azure-core/no-unknown` | Azure services must not have properties of type `unknown`. |
|
|
56
|
+
| `@azure-tools/typespec-azure-core/property-name-conflict` | Avoid naming conflicts between a property and a model of the same name. |
|
|
57
|
+
| [`@azure-tools/typespec-azure-core/bad-record-type`](https://azure.github.io/typespec-azure/docs/libraries/azure-core/rules/bad-record-type) | Identify bad record definitions. |
|
|
58
|
+
| `@azure-tools/typespec-azure-core/documentation-required` | Require documentation over enums, models, and operations. |
|
|
59
|
+
| `@azure-tools/typespec-azure-core/key-visibility-required` | Key properties need to have an explicit visibility setting. |
|
|
60
|
+
| `@azure-tools/typespec-azure-core/response-schema-problem` | Warn about operations having multiple non-error response schemas. |
|
|
61
|
+
| `@azure-tools/typespec-azure-core/rpc-operation-request-body` | Warning for RPC body problems. |
|
|
62
|
+
| [`@azure-tools/typespec-azure-core/spread-discriminated-model`](https://azure.github.io/typespec-azure/docs/libraries/azure-core/rules/spread-discriminated-model) | Check a model with a discriminator has not been used in composition. |
|
|
63
|
+
| `@azure-tools/typespec-azure-core/use-standard-names` | Use recommended names for operations. |
|
|
64
|
+
| [`@azure-tools/typespec-azure-core/use-standard-operations`](https://azure.github.io/typespec-azure/docs/libraries/azure-core/rules/use-standard-operations) | Operations should be defined using a signature from the Azure.Core namespace. |
|
|
65
|
+
| [`@azure-tools/typespec-azure-core/no-string-discriminator`](https://azure.github.io/typespec-azure/docs/libraries/azure-core/rules/no-string-discriminator) | Azure services discriminated models should define the discriminated property as an extensible union. |
|
|
66
|
+
| [`@azure-tools/typespec-azure-core/require-versioned`](https://azure.github.io/typespec-azure/docs/libraries/azure-core/rules/require-versioned) | Azure services should use the versioning library. |
|
|
67
|
+
| `@azure-tools/typespec-azure-core/friendly-name` | Ensures that @friendlyName is used as intended. |
|
|
68
|
+
| [`@azure-tools/typespec-azure-core/no-private-usage`](https://azure.github.io/typespec-azure/docs/libraries/azure-core/rules/no-private-usage) | Verify that elements inside Private namespace are not referenced. |
|
|
69
|
+
| [`@azure-tools/typespec-azure-core/no-query-explode`](https://azure.github.io/typespec-azure/docs/libraries/azure-core/rules/no-query-explode) | It is recommended to serialize query parameter without explode: true |
|
|
72
70
|
|
|
73
71
|
## Decorators
|
|
74
72
|
|
package/dist/src/linter.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { defineLinter } from "@typespec/compiler";
|
|
2
|
-
import { apiVersionRule } from "./rules/api-version-parameter.js";
|
|
3
2
|
import { authRequiredRule } from "./rules/auth-required.js";
|
|
4
3
|
import { badRecordTypeRule } from "./rules/bad-record-type.js";
|
|
5
4
|
import { byosRule } from "./rules/byos.js";
|
|
6
|
-
import { casingRule } from "./rules/casing.js";
|
|
5
|
+
import { casingRule } from "./rules/casing-style.js";
|
|
7
6
|
import { compositionOverInheritanceRule } from "./rules/composition-over-inheritance.js";
|
|
8
7
|
import { friendlyNameRule } from "./rules/friendly-name.js";
|
|
9
8
|
import { knownEncodingRule } from "./rules/known-encoding.js";
|
|
@@ -23,6 +22,7 @@ import { noResponseBodyRule } from "./rules/no-response-body.js";
|
|
|
23
22
|
import { noRpcPathParamsRule } from "./rules/no-rpc-path-params.js";
|
|
24
23
|
import { noStringDiscriminatorRule } from "./rules/no-string-discriminator.js";
|
|
25
24
|
import { nonBreakingVersioningRule } from "./rules/non-breaking-versioning.js";
|
|
25
|
+
import { apiVersionRule } from "./rules/operation-missing-api-version.js";
|
|
26
26
|
import { preferCsvCollectionFormatRule } from "./rules/prefer-csv-collection-format.js";
|
|
27
27
|
import { preventFormatRule } from "./rules/prevent-format.js";
|
|
28
28
|
import { preventRestLibraryInterfaces } from "./rules/prevent-rest-library.js";
|
package/dist/src/linter.js.map
CHANGED
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"linter.js","sourceRoot":"","sources":["../../src/linter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CA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;CACnB,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,YAAY,CAAC;IAClC,KAAK;IACL,QAAQ,EAAE;QACR,sBAAsB,EAAE;YACtB,MAAM,EAAE;gBACN,CAAC,oCAAoC,yBAAyB,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI;aAC7E;SACF;KACF;CACF,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-required.d.ts","sourceRoot":"","sources":["../../../src/rules/auth-required.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth-required.d.ts","sourceRoot":"","sources":["../../../src/rules/auth-required.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB;;EAwB3B,CAAC"}
|
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
import { createRule, getService } from "@typespec/compiler";
|
|
2
2
|
import { getAuthentication } from "@typespec/http";
|
|
3
|
-
import { isAzureSubNamespace, isExcludedCoreType } from "./utils.js";
|
|
4
3
|
export const authRequiredRule = createRule({
|
|
5
4
|
name: "auth-required",
|
|
6
5
|
description: "Enforce service authentication.",
|
|
7
6
|
severity: "warning",
|
|
7
|
+
url: "https://azure.github.io/typespec-azure/docs/libraries/azure-core/rules/auth-required",
|
|
8
8
|
messages: {
|
|
9
9
|
default: "Provide an authentication scheme using the `@useAuth` decorator. See: https://azure.github.io/typespec-azure/docs/reference/azure-style-guide#security-definitions",
|
|
10
10
|
},
|
|
11
11
|
create(context) {
|
|
12
12
|
return {
|
|
13
13
|
namespace: (namespace) => {
|
|
14
|
-
if (isExcludedCoreType(context.program, namespace))
|
|
15
|
-
return;
|
|
16
|
-
if (!isAzureSubNamespace(context.program, namespace))
|
|
17
|
-
return;
|
|
18
14
|
const service = getService(context.program, namespace);
|
|
19
15
|
if (!service)
|
|
20
16
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-required.js","sourceRoot":"","sources":["../../../src/rules/auth-required.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"auth-required.js","sourceRoot":"","sources":["../../../src/rules/auth-required.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAU,CAAC;IACzC,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,iCAAiC;IAC9C,QAAQ,EAAE,SAAS;IACnB,GAAG,EAAE,sFAAsF;IAC3F,QAAQ,EAAE;QACR,OAAO,EACL,oKAAoK;KACvK;IACD,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,SAAS,EAAE,CAAC,SAAoB,EAAE,EAAE;gBAClC,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;gBACvD,IAAI,CAAC,OAAO;oBAAE,OAAO;gBAErB,MAAM,IAAI,GAAG,iBAAiB,CAAC,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;gBAC3D,IAAI,CAAC,IAAI,EAAE,CAAC;oBACV,OAAO,CAAC,gBAAgB,CAAC;wBACvB,MAAM,EAAE,SAAS;qBAClB,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const casingRule: import("@typespec/compiler").LinterRuleDefinition<"casing-style", {
|
|
2
2
|
readonly default: import("@typespec/compiler").CallableMessage<["type", "casing"]>;
|
|
3
3
|
}>;
|
|
4
|
-
//# sourceMappingURL=casing.d.ts.map
|
|
4
|
+
//# sourceMappingURL=casing-style.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"casing-style.d.ts","sourceRoot":"","sources":["../../../src/rules/casing-style.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,UAAU;;EA4DrB,CAAC"}
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { createRule, isTemplateDeclarationOrInstance, paramMessage, } from "@typespec/compiler";
|
|
2
|
-
import { isCamelCaseNoAcronyms,
|
|
2
|
+
import { isCamelCaseNoAcronyms, isPascalCaseNoAcronyms } from "./utils.js";
|
|
3
3
|
export const casingRule = createRule({
|
|
4
4
|
name: "casing-style",
|
|
5
5
|
description: "Ensure proper casing style.",
|
|
6
6
|
severity: "warning",
|
|
7
|
+
url: "https://azure.github.io/typespec-azure/docs/libraries/azure-core/rules/casing-style",
|
|
7
8
|
messages: {
|
|
8
9
|
default: paramMessage `The names of ${"type"} types must use ${"casing"}`,
|
|
9
10
|
},
|
|
10
11
|
create(context) {
|
|
11
12
|
return {
|
|
12
13
|
model: (model) => {
|
|
13
|
-
if (isExcludedCoreType(context.program, model))
|
|
14
|
-
return;
|
|
15
14
|
if (!isPascalCaseNoAcronyms(model.name)) {
|
|
16
15
|
context.reportDiagnostic({
|
|
17
16
|
format: { type: "Model", casing: "PascalCase" },
|
|
@@ -22,8 +21,6 @@ export const casingRule = createRule({
|
|
|
22
21
|
modelProperty: (property) => {
|
|
23
22
|
if (property.name === "_")
|
|
24
23
|
return;
|
|
25
|
-
if (isExcludedCoreType(context.program, property))
|
|
26
|
-
return;
|
|
27
24
|
if (!isCamelCaseNoAcronyms(property.name)) {
|
|
28
25
|
context.reportDiagnostic({
|
|
29
26
|
format: { type: "Property", casing: "camelCase" },
|
|
@@ -32,8 +29,6 @@ export const casingRule = createRule({
|
|
|
32
29
|
}
|
|
33
30
|
},
|
|
34
31
|
operation: (operation) => {
|
|
35
|
-
if (isExcludedCoreType(context.program, operation))
|
|
36
|
-
return;
|
|
37
32
|
if (isTemplateDeclarationOrInstance(operation)) {
|
|
38
33
|
if (!isPascalCaseNoAcronyms(operation.name)) {
|
|
39
34
|
context.reportDiagnostic({
|
|
@@ -50,8 +45,6 @@ export const casingRule = createRule({
|
|
|
50
45
|
}
|
|
51
46
|
},
|
|
52
47
|
interface: (operationGroup) => {
|
|
53
|
-
if (isExcludedCoreType(context.program, operationGroup))
|
|
54
|
-
return;
|
|
55
48
|
if (!isPascalCaseNoAcronyms(operationGroup.name)) {
|
|
56
49
|
context.reportDiagnostic({
|
|
57
50
|
format: { type: "Interface", casing: "PascalCase" },
|
|
@@ -60,8 +53,6 @@ export const casingRule = createRule({
|
|
|
60
53
|
}
|
|
61
54
|
},
|
|
62
55
|
namespace: (namespace) => {
|
|
63
|
-
if (isExcludedCoreType(context.program, namespace))
|
|
64
|
-
return;
|
|
65
56
|
if (!isPascalCaseNoAcronyms(namespace.name)) {
|
|
66
57
|
context.reportDiagnostic({
|
|
67
58
|
format: { type: "Namespace", casing: "PascalCase" },
|
|
@@ -72,4 +63,4 @@ export const casingRule = createRule({
|
|
|
72
63
|
};
|
|
73
64
|
},
|
|
74
65
|
});
|
|
75
|
-
//# sourceMappingURL=casing.js.map
|
|
66
|
+
//# sourceMappingURL=casing-style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"casing-style.js","sourceRoot":"","sources":["../../../src/rules/casing-style.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,UAAU,EACV,+BAA+B,EAC/B,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAE3E,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CAAC;IACnC,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,6BAA6B;IAC1C,QAAQ,EAAE,SAAS;IACnB,GAAG,EAAE,qFAAqF;IAC1F,QAAQ,EAAE;QACR,OAAO,EAAE,YAAY,CAAA,gBAAgB,MAAM,mBAAmB,QAAQ,EAAE;KACzE;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C;gBACL,CAAC;YACH,CAAC;YACD,SAAS,EAAE,CAAC,cAAyB,EAAE,EAAE;gBACvC,IAAI,CAAC,sBAAsB,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC;oBACjD,OAAO,CAAC,gBAAgB,CAAC;wBACvB,MAAM,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE;wBACnD,MAAM,EAAE,cAAc;qBACvB,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;YACD,SAAS,EAAE,CAAC,SAAoB,EAAE,EAAE;gBAClC,IAAI,CAAC,sBAAsB,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;oBAC5C,OAAO,CAAC,gBAAgB,CAAC;wBACvB,MAAM,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE;wBACnD,MAAM,EAAE,SAAS;qBAClB,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const apiVersionRule: import("@typespec/compiler").LinterRuleDefinition<"operation-missing-api-version", {
|
|
2
2
|
readonly default: "Operation is missing an api version parameter.";
|
|
3
3
|
}>;
|
|
4
|
-
//# sourceMappingURL=api-version
|
|
4
|
+
//# sourceMappingURL=operation-missing-api-version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation-missing-api-version.d.ts","sourceRoot":"","sources":["../../../src/rules/operation-missing-api-version.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,cAAc;;EAqBzB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createRule } from "@typespec/compiler";
|
|
2
|
+
import { getVersions } from "@typespec/versioning";
|
|
3
|
+
function isApiVersionParam(prop) {
|
|
4
|
+
return prop.name === "apiVersion" && prop.type.kind === "Scalar" && prop.type.name === "string";
|
|
5
|
+
}
|
|
6
|
+
export const apiVersionRule = createRule({
|
|
7
|
+
name: "operation-missing-api-version",
|
|
8
|
+
description: "Operations need an api version parameter.",
|
|
9
|
+
severity: "warning",
|
|
10
|
+
url: "https://azure.github.io/typespec-azure/docs/libraries/azure-core/rules/operation-missing-api-version",
|
|
11
|
+
messages: {
|
|
12
|
+
default: `Operation is missing an api version parameter.`,
|
|
13
|
+
},
|
|
14
|
+
create(context) {
|
|
15
|
+
return {
|
|
16
|
+
operation: (op) => {
|
|
17
|
+
if (getVersions(context.program, op)[1] === undefined)
|
|
18
|
+
return;
|
|
19
|
+
for (const param of op.parameters.properties.values()) {
|
|
20
|
+
if (isApiVersionParam(param))
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
context.reportDiagnostic({
|
|
24
|
+
target: op,
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=operation-missing-api-version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation-missing-api-version.js","sourceRoot":"","sources":["../../../src/rules/operation-missing-api-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,SAAS,iBAAiB,CAAC,IAAmB;IAC5C,OAAO,IAAI,CAAC,IAAI,KAAK,YAAY,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC;AAClG,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;IACvC,IAAI,EAAE,+BAA+B;IACrC,WAAW,EAAE,2CAA2C;IACxD,QAAQ,EAAE,SAAS;IACnB,GAAG,EAAE,sGAAsG;IAC3G,QAAQ,EAAE;QACR,OAAO,EAAE,gDAAgD;KAC1D;IACD,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,SAAS,EAAE,CAAC,EAAa,EAAE,EAAE;gBAC3B,IAAI,WAAW,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,SAAS;oBAAE,OAAO;gBAC9D,KAAK,MAAM,KAAK,IAAI,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,CAAC;oBACtD,IAAI,iBAAiB,CAAC,KAAK,CAAC;wBAAE,OAAO;gBACvC,CAAC;gBACD,OAAO,CAAC,gBAAgB,CAAC;oBACvB,MAAM,EAAE,EAAE;iBACX,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-standard-names.d.ts","sourceRoot":"","sources":["../../../src/rules/use-standard-names.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-standard-names.d.ts","sourceRoot":"","sources":["../../../src/rules/use-standard-names.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,gBAAgB;;;;;;;;EAmF3B,CAAC"}
|
|
@@ -2,27 +2,6 @@ import { createRule, ignoreDiagnostics, isTemplateDeclarationOrInstance, } from
|
|
|
2
2
|
import { getHttpOperation } from "@typespec/http";
|
|
3
3
|
import { isListOperation } from "@typespec/rest";
|
|
4
4
|
import { getPagedResult } from "../decorators.js";
|
|
5
|
-
import { isAzureSubNamespace, isExcludedCoreType } from "./utils.js";
|
|
6
|
-
function isArmProviderNamespace(ns) {
|
|
7
|
-
if (!ns)
|
|
8
|
-
return false;
|
|
9
|
-
for (const dec of ns.decorators) {
|
|
10
|
-
if (dec.decorator.name === "$armProviderNamespace") {
|
|
11
|
-
return true;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
function isArmResourceOperations(inter) {
|
|
17
|
-
if (!inter)
|
|
18
|
-
return false;
|
|
19
|
-
for (const dec of inter.decorators) {
|
|
20
|
-
if (dec.decorator.name === "$armResourceOperations") {
|
|
21
|
-
return true;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
5
|
export const useStandardNames = createRule({
|
|
27
6
|
name: "use-standard-names",
|
|
28
7
|
description: "Use recommended names for operations.",
|
|
@@ -39,16 +18,8 @@ export const useStandardNames = createRule({
|
|
|
39
18
|
create(context) {
|
|
40
19
|
return {
|
|
41
20
|
operation: (op) => {
|
|
42
|
-
if (isArmProviderNamespace(op.namespace))
|
|
43
|
-
return;
|
|
44
|
-
if (isArmResourceOperations(op.interface))
|
|
45
|
-
return;
|
|
46
21
|
if (isTemplateDeclarationOrInstance(op))
|
|
47
22
|
return;
|
|
48
|
-
if (isExcludedCoreType(context.program, op))
|
|
49
|
-
return;
|
|
50
|
-
if (!isAzureSubNamespace(context.program, op.namespace))
|
|
51
|
-
return;
|
|
52
23
|
const httpOp = ignoreDiagnostics(getHttpOperation(context.program, op));
|
|
53
24
|
const verb = httpOp.verb;
|
|
54
25
|
const name = op.name;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-standard-names.js","sourceRoot":"","sources":["../../../src/rules/use-standard-names.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"use-standard-names.js","sourceRoot":"","sources":["../../../src/rules/use-standard-names.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,iBAAiB,EACjB,+BAA+B,GAChC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAU,CAAC;IACzC,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE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CAAC;wBACD,MAAM;gBACV,CAAC;gBACD,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;oBAC/B,OAAO,CAAC,gBAAgB,CAAC;wBACvB,SAAS,EAAE,YAAY;wBACvB,MAAM,EAAE,EAAE;qBACX,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure-tools/typespec-azure-core",
|
|
3
|
-
"version": "0.48.0-dev.
|
|
3
|
+
"version": "0.48.0-dev.3",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
5
|
"description": "TypeSpec Azure Core library",
|
|
6
6
|
"homepage": "https://azure.github.io/typespec-azure",
|
|
@@ -39,13 +39,13 @@
|
|
|
39
39
|
"!dist/test/**"
|
|
40
40
|
],
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@typespec/compiler": "~0.61.
|
|
42
|
+
"@typespec/compiler": "~0.61.2 || >=0.62.0-dev <0.62.0",
|
|
43
43
|
"@typespec/http": "~0.61.0 || >=0.62.0-dev <0.62.0",
|
|
44
44
|
"@typespec/rest": "~0.61.0 || >=0.62.0-dev <0.62.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/node": "~22.7.5",
|
|
48
|
-
"@typespec/compiler": "~0.61.
|
|
48
|
+
"@typespec/compiler": "~0.61.2 || >=0.62.0-dev <0.62.0",
|
|
49
49
|
"@typespec/http": "~0.61.0 || >=0.62.0-dev <0.62.0",
|
|
50
50
|
"@typespec/library-linter": "~0.61.0 || >=0.62.0-dev <0.62.0",
|
|
51
51
|
"@typespec/openapi": "~0.61.0 || >=0.62.0-dev <0.62.0",
|
|
@@ -72,6 +72,6 @@
|
|
|
72
72
|
"test:ci": "vitest run --coverage --reporter=junit --reporter=default",
|
|
73
73
|
"lint": "eslint . --max-warnings=0",
|
|
74
74
|
"lint:fix": "eslint . --fix ",
|
|
75
|
-
"regen-docs": "tspd doc . --enable-experimental --output-dir ../../docs/libraries/azure-core/reference"
|
|
75
|
+
"regen-docs": "tspd doc . --enable-experimental --output-dir ../../website/src/content/docs/docs/libraries/azure-core/reference"
|
|
76
76
|
}
|
|
77
77
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api-version-parameter.d.ts","sourceRoot":"","sources":["../../../src/rules/api-version-parameter.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,cAAc;;EA0BzB,CAAC"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { createRule } from "@typespec/compiler";
|
|
2
|
-
import { getVersion } from "@typespec/versioning";
|
|
3
|
-
import { isExcludedCoreType } from "./utils.js";
|
|
4
|
-
function isApiVersionParam(prop) {
|
|
5
|
-
return prop.name === "apiVersion" && prop.type.kind === "Scalar" && prop.type.name === "string";
|
|
6
|
-
}
|
|
7
|
-
// TODO: Remove this function once we have a mechanism for overriding or disabling linter rules
|
|
8
|
-
// See: https://github.com/microsoft/typespec/issues/1785
|
|
9
|
-
function isArmProviderNamespace(ns) {
|
|
10
|
-
for (const dec of ns.decorators) {
|
|
11
|
-
if (dec.decorator.name === "$armProviderNamespace") {
|
|
12
|
-
return true;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
export const apiVersionRule = createRule({
|
|
18
|
-
name: "operation-missing-api-version",
|
|
19
|
-
description: "Operations need an api version parameter.",
|
|
20
|
-
severity: "warning",
|
|
21
|
-
messages: {
|
|
22
|
-
default: `Operation is missing an api version parameter.`,
|
|
23
|
-
},
|
|
24
|
-
create(context) {
|
|
25
|
-
return {
|
|
26
|
-
operation: (op) => {
|
|
27
|
-
if (isExcludedCoreType(context.program, op))
|
|
28
|
-
return;
|
|
29
|
-
if (!op.namespace)
|
|
30
|
-
return;
|
|
31
|
-
// ignore ARM namespaces. They have their own rule
|
|
32
|
-
if (isArmProviderNamespace(op.namespace))
|
|
33
|
-
return;
|
|
34
|
-
const versionMap = getVersion(context.program, op.namespace);
|
|
35
|
-
// rule only applies to versioned Azure operations
|
|
36
|
-
if (!versionMap)
|
|
37
|
-
return;
|
|
38
|
-
for (const param of op.parameters.properties.values()) {
|
|
39
|
-
if (isApiVersionParam(param))
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
context.reportDiagnostic({
|
|
43
|
-
target: op,
|
|
44
|
-
});
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
},
|
|
48
|
-
});
|
|
49
|
-
//# sourceMappingURL=api-version-parameter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api-version-parameter.js","sourceRoot":"","sources":["../../../src/rules/api-version-parameter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuC,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrF,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,SAAS,iBAAiB,CAAC,IAAmB;IAC5C,OAAO,IAAI,CAAC,IAAI,KAAK,YAAY,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC;AAClG,CAAC;AAED,+FAA+F;AAC/F,yDAAyD;AACzD,SAAS,sBAAsB,CAAC,EAAa;IAC3C,KAAK,MAAM,GAAG,IAAI,EAAE,CAAC,UAAU,EAAE,CAAC;QAChC,IAAI,GAAG,CAAC,SAAS,CAAC,IAAI,KAAK,uBAAuB,EAAE,CAAC;YACnD,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;IACvC,IAAI,EAAE,+BAA+B;IACrC,WAAW,EAAE,2CAA2C;IACxD,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE;QACR,OAAO,EAAE,gDAAgD;KAC1D;IACD,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,SAAS,EAAE,CAAC,EAAa,EAAE,EAAE;gBAC3B,IAAI,kBAAkB,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;oBAAE,OAAO;gBACpD,IAAI,CAAC,EAAE,CAAC,SAAS;oBAAE,OAAO;gBAC1B,kDAAkD;gBAClD,IAAI,sBAAsB,CAAC,EAAE,CAAC,SAAS,CAAC;oBAAE,OAAO;gBACjD,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC;gBAC7D,kDAAkD;gBAClD,IAAI,CAAC,UAAU;oBAAE,OAAO;gBACxB,KAAK,MAAM,KAAK,IAAI,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,CAAC;oBACtD,IAAI,iBAAiB,CAAC,KAAK,CAAC;wBAAE,OAAO;gBACvC,CAAC;gBACD,OAAO,CAAC,gBAAgB,CAAC;oBACvB,MAAM,EAAE,EAAE;iBACX,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"casing.d.ts","sourceRoot":"","sources":["../../../src/rules/casing.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,UAAU;;EAgErB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"casing.js","sourceRoot":"","sources":["../../../src/rules/casing.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,UAAU,EACV,+BAA+B,EAC/B,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAE/F,MAAM,CAAC,MAAM,UAAU,GA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