@azure-tools/typespec-azure-core 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 CHANGED
@@ -25,6 +25,7 @@ linter:
25
25
  Available ruleSets:
26
26
 
27
27
  - [`@azure-tools/typespec-azure-core/all`](#@azure-tools/typespec-azure-core/all)
28
+ - [`@azure-tools/typespec-azure-core/canonical-versioning`](#@azure-tools/typespec-azure-core/canonical-versioning)
28
29
 
29
30
  ### Rules
30
31
 
@@ -32,37 +33,38 @@ Available ruleSets:
32
33
  | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
33
34
  | `@azure-tools/typespec-azure-core/operation-missing-api-version` | Operations need an api version parameter. |
34
35
  | `@azure-tools/typespec-azure-core/auth-required` | Enforce service authentication. |
35
- | `@azure-tools/typespec-azure-core/no-operation-id` | Operation ID is automatically generated by the OpenAPI emitters and should not normally be specified. |
36
36
  | `@azure-tools/typespec-azure-core/request-body-problem` | Request body should not be of raw array type. |
37
37
  | `@azure-tools/typespec-azure-core/byos` | Use the BYOS pattern recommended for Azure Services. |
38
38
  | `@azure-tools/typespec-azure-core/casing-style` | Ensure proper casing style. |
39
- | `@azure-tools/typespec-azure-core/spread-discriminated-model` | Check a model with a discriminator has not been used in composition. |
40
39
  | `@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`. |
41
- | `@azure-tools/typespec-azure-core/prefer-csv-collection-format` | It is recommended to use "csv" for collection format of parameters. |
42
40
  | `@azure-tools/typespec-azure-core/use-extensible-enum` | Enums should be extensible. |
43
41
  | `@azure-tools/typespec-azure-core/known-encoding` | Check for supported encodings. |
44
- | `@azure-tools/typespec-azure-core/use-standard-operations` | Operations should be defined using a signature from the Azure.Core namespace. |
42
+ | `@azure-tools/typespec-azure-core/long-running-polling-operation-required` | Long-running operations should have a linked polling operation. |
45
43
  | [`@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. |
46
44
  | [`@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. |
47
45
  | `@azure-tools/typespec-azure-core/no-error-status-codes` | Recommend using the error response defined by Azure REST API guidelines. |
46
+ | `@azure-tools/typespec-azure-core/no-explicit-routes-resource-ops` | The @route decorator should not be used on standard resource operation signatures. |
48
47
  | `@azure-tools/typespec-azure-core/no-fixed-enum-discriminator` | Discriminator shouldn't be a fixed enum. |
48
+ | [`@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. |
49
49
  | `@azure-tools/typespec-azure-core/no-nullable` | Use `?` for optional properties. |
50
50
  | `@azure-tools/typespec-azure-core/no-offsetdatetime` | Prefer using `utcDateTime` when representing a datetime unless an offset is necessary. |
51
- | `@azure-tools/typespec-azure-core/no-rpc-path-params` | Operations defined using RpcOperation should not have path parameters. |
52
- | `@azure-tools/typespec-azure-core/no-explicit-routes-resource-ops` | The @route decorator should not be used on standard resource operation signatures. |
53
51
  | `@azure-tools/typespec-azure-core/no-response-body` | Ensure that the body is set correctly for the response type. |
52
+ | `@azure-tools/typespec-azure-core/no-rpc-path-params` | Operations defined using RpcOperation should not have path parameters. |
53
+ | `@azure-tools/typespec-azure-core/no-operation-id` | Operation ID is automatically generated by the OpenAPI emitters and should not normally be specified. |
54
+ | `@azure-tools/typespec-azure-core/prefer-csv-collection-format` | It is recommended to use "csv" for collection format of parameters. |
54
55
  | `@azure-tools/typespec-azure-core/no-format` | Azure services should not use the `@format` decorator. |
55
56
  | `@azure-tools/typespec-azure-core/no-multiple-discriminator` | Classes should have at most one discriminator. |
56
57
  | `@azure-tools/typespec-azure-core/no-rest-library-interfaces` | Resource interfaces from the TypeSpec.Rest.Resource library are incompatible with Azure.Core. |
57
58
  | `@azure-tools/typespec-azure-core/no-unknown` | Azure services must not have properties of type `unknown`. |
58
- | `@azure-tools/typespec-azure-core/bad-record-type` | Identify bad record definitions. |
59
- | `@azure-tools/typespec-azure-core/response-schema-problem` | Warn about operations having multiple non-error response schemas. |
60
59
  | `@azure-tools/typespec-azure-core/property-name-conflict` | Avoid naming conflicts. |
61
- | `@azure-tools/typespec-azure-core/rpc-operation-request-body` | Warning for RPC body problems. |
60
+ | `@azure-tools/typespec-azure-core/bad-record-type` | Identify bad record definitions. |
62
61
  | `@azure-tools/typespec-azure-core/documentation-required` | Require documentation over enums, models, and operations. |
63
62
  | `@azure-tools/typespec-azure-core/key-visibility-required` | Key properties need to have an explicit visibility setting. |
64
- | `@azure-tools/typespec-azure-core/long-running-polling-operation-required` | Long-running operations should have a linked polling operation. |
63
+ | `@azure-tools/typespec-azure-core/response-schema-problem` | Warn about operations having multiple non-error response schemas. |
64
+ | `@azure-tools/typespec-azure-core/rpc-operation-request-body` | Warning for RPC body problems. |
65
+ | `@azure-tools/typespec-azure-core/spread-discriminated-model` | Check a model with a discriminator has not been used in composition. |
65
66
  | `@azure-tools/typespec-azure-core/use-standard-names` | Use recommended names for operations. |
67
+ | `@azure-tools/typespec-azure-core/use-standard-operations` | Operations should be defined using a signature from the Azure.Core namespace. |
66
68
 
67
69
  ## Decorators
68
70
 
@@ -1 +1 @@
1
- {"version":3,"file":"linter.d.ts","sourceRoot":"","sources":["../../src/linter.ts"],"names":[],"mappings":"AAoCA,eAAO,MAAM,OAAO,+CA6ElB,CAAC"}
1
+ {"version":3,"file":"linter.d.ts","sourceRoot":"","sources":["../../src/linter.ts"],"names":[],"mappings":"AA0EA,eAAO,MAAM,OAAO,+CAgDlB,CAAC"}
@@ -18,6 +18,7 @@ import { noOffsetDateTimeRule } from "./rules/no-offsetdatetime.js";
18
18
  import { operationIdRule } from "./rules/no-operation-id.js";
19
19
  import { noResponseBodyRule } from "./rules/no-response-body.js";
20
20
  import { noRpcPathParamsRule } from "./rules/no-rpc-path-params.js";
21
+ import { nonBreakingVersioningRule } from "./rules/non-breaking-versioning.js";
21
22
  import { preferCsvCollectionFormatRule } from "./rules/prefer-csv-collection-format.js";
22
23
  import { preventFormatUse } from "./rules/prevent-format.js";
23
24
  import { preventMultipleDiscriminator } from "./rules/prevent-multiple-discriminator.js";
@@ -33,42 +34,44 @@ import { rpcOperationRequestBodyRule } from "./rules/rpc-operation-request-body.
33
34
  import { spreadDiscriminatedModelRule } from "./rules/spread-discriminated-model.js";
34
35
  import { useStandardNames } from "./rules/use-standard-names.js";
35
36
  import { useStandardOperations } from "./rules/use-standard-ops.js";
37
+ const rules = [
38
+ apiVersionRule,
39
+ authRequiredRule,
40
+ bodyArrayRule,
41
+ byosRule,
42
+ casingRule,
43
+ compositionOverInheritanceRule,
44
+ extensibleEnumRule,
45
+ knownEncodingRule,
46
+ longRunningOperationsRequirePollingOperation,
47
+ noClosedLiteralUnionRule,
48
+ noEnumRule,
49
+ noErrorStatusCodesRule,
50
+ noExplicitRoutesResourceOps,
51
+ noFixedEnumDiscriminatorRule,
52
+ nonBreakingVersioningRule,
53
+ noNullableRule,
54
+ noOffsetDateTimeRule,
55
+ noResponseBodyRule,
56
+ noRpcPathParamsRule,
57
+ operationIdRule,
58
+ preferCsvCollectionFormatRule,
59
+ preventFormatUse,
60
+ preventMultipleDiscriminator,
61
+ preventRestLibraryInterfaces,
62
+ preventUnknownType,
63
+ propertyNameRule,
64
+ recordTypeRule,
65
+ requireDocumentation,
66
+ requireKeyVisibility,
67
+ responseSchemaMultiStatusCodeRule,
68
+ rpcOperationRequestBodyRule,
69
+ spreadDiscriminatedModelRule,
70
+ useStandardNames,
71
+ useStandardOperations,
72
+ ];
36
73
  export const $linter = defineLinter({
37
- rules: [
38
- apiVersionRule,
39
- authRequiredRule,
40
- operationIdRule,
41
- bodyArrayRule,
42
- byosRule,
43
- casingRule,
44
- spreadDiscriminatedModelRule,
45
- compositionOverInheritanceRule,
46
- preferCsvCollectionFormatRule,
47
- extensibleEnumRule,
48
- knownEncodingRule,
49
- useStandardOperations,
50
- noClosedLiteralUnionRule,
51
- noEnumRule,
52
- noErrorStatusCodesRule,
53
- noFixedEnumDiscriminatorRule,
54
- noNullableRule,
55
- noOffsetDateTimeRule,
56
- noRpcPathParamsRule,
57
- noExplicitRoutesResourceOps,
58
- noResponseBodyRule,
59
- preventFormatUse,
60
- preventMultipleDiscriminator,
61
- preventRestLibraryInterfaces,
62
- preventUnknownType,
63
- recordTypeRule,
64
- responseSchemaMultiStatusCodeRule,
65
- propertyNameRule,
66
- rpcOperationRequestBodyRule,
67
- requireDocumentation,
68
- requireKeyVisibility,
69
- longRunningOperationsRequirePollingOperation,
70
- useStandardNames,
71
- ],
74
+ rules,
72
75
  ruleSets: {
73
76
  all: {
74
77
  enable: {
@@ -108,6 +111,11 @@ export const $linter = defineLinter({
108
111
  },
109
112
  extends: ["@typespec/http/all"],
110
113
  },
114
+ "canonical-versioning": {
115
+ enable: {
116
+ [`@azure-tools/typespec-azure-core/${nonBreakingVersioningRule.name}`]: false,
117
+ },
118
+ },
111
119
  },
112
120
  });
113
121
  //# sourceMappingURL=linter.js.map
@@ -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,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,8BAA8B,EAAE,MAAM,yCAAyC,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B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BACnE,CAAC,oCAAoC,2BAA2B,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI;gBAC9E,CAAC,oCAAoC,oBAAoB,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI;gBACvE,CAAC,oCAAoC,oBAAoB,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI;gBACvE,CAAC,oCAAoC,4CAA4C,CAAC,IAAI,EAAE,CAAC,EACvF,IAAI;gBACN,CAAC,oCAAoC,gBAAgB,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI;gBACnE,CAAC,oCAAoC,gBAAgB,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI;gBACnE,CAAC,oCAAoC,UAAU,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK;aAC/D;YACD,OAAO,EAAE,CAAC,oBAAoB,CAAC;SAChC;QACD,sBAAsB,EAAE;YACtB,MAAM,EAAE;gBACN,CAAC,oCAAoC,yBAAyB,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK;aAC9E;SACF;KACF;CACF,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare const nonBreakingVersioningRule: import("@typespec/compiler").LinterRuleDefinition<"non-breaking-versioning", {
2
+ readonly default: import("@typespec/compiler").CallableMessage<[string]>;
3
+ readonly addedRequired: "Adding required property is a breaking change.";
4
+ readonly optionalNoDefault: "Property made optional should have a default value.";
5
+ }>;
6
+ //# sourceMappingURL=non-breaking-versioning.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"non-breaking-versioning.d.ts","sourceRoot":"","sources":["../../../src/rules/non-breaking-versioning.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,yBAAyB;;;;EAyDpC,CAAC"}
@@ -0,0 +1,52 @@
1
+ import { createRule, paramMessage } from "@typespec/compiler";
2
+ import { getAddedOnVersions, getMadeOptionalOn, getRemovedOnVersions, getRenamedFromVersions, } from "@typespec/versioning";
3
+ export const nonBreakingVersioningRule = createRule({
4
+ name: "non-breaking-versioning",
5
+ description: "Check that only backward compatible versioning change are done to a service.",
6
+ severity: "warning",
7
+ url: "https://azure.github.io/typespec-azure/docs/libraries/azure-core/rules/non-breaking-versioning",
8
+ messages: {
9
+ default: paramMessage `Using ${"action"} is not backward compatible.`,
10
+ addedRequired: "Adding required property is a breaking change.",
11
+ optionalNoDefault: "Property made optional should have a default value.",
12
+ },
13
+ create(context) {
14
+ return {
15
+ model: checkBadVersioningPattern,
16
+ modelProperty: checkBadVersioningPatternForProperty,
17
+ operation: checkBadVersioningPattern,
18
+ };
19
+ function checkBadVersioningPattern(type) {
20
+ if (getRemovedOnVersions(context.program, type) !== undefined) {
21
+ reportBreakingVersioning("@removed", type);
22
+ }
23
+ if (getRenamedFromVersions(context.program, type) !== undefined) {
24
+ reportBreakingVersioning("@renamedFrom", type);
25
+ }
26
+ }
27
+ function checkBadVersioningPatternForProperty(modelProperty) {
28
+ checkBadVersioningPattern(modelProperty);
29
+ if (getAddedOnVersions(context.program, modelProperty) !== undefined &&
30
+ !modelProperty.optional) {
31
+ context.reportDiagnostic({
32
+ messageId: "addedRequired",
33
+ target: modelProperty,
34
+ });
35
+ }
36
+ if (getMadeOptionalOn(context.program, modelProperty) !== undefined &&
37
+ modelProperty.default === undefined) {
38
+ context.reportDiagnostic({
39
+ messageId: "optionalNoDefault",
40
+ target: modelProperty,
41
+ });
42
+ }
43
+ }
44
+ function reportBreakingVersioning(action, target) {
45
+ context.reportDiagnostic({
46
+ format: { action },
47
+ target,
48
+ });
49
+ }
50
+ },
51
+ });
52
+ //# sourceMappingURL=non-breaking-versioning.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"non-breaking-versioning.js","sourceRoot":"","sources":["../../../src/rules/non-breaking-versioning.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,UAAU,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACnF,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;A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S,EAAE,mBAAmB;oBAC9B,MAAM,EAAE,aAAa;iBACtB,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,SAAS,wBAAwB,CAAC,MAAc,EAAE,MAAY;YAC5D,OAAO,CAAC,gBAAgB,CAAC;gBACvB,MAAM,EAAE,EAAE,MAAM,EAAE;gBAClB,MAAM;aACP,CAAC,CAAC;QACL,CAAC;IACH,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.40.0-dev.2",
3
+ "version": "0.40.0-dev.3",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "TypeSpec Azure Core library",
6
6
  "homepage": "https://azure.github.io/typespec-azure",