@azure-tools/typespec-azure-core 0.46.0-dev.2 → 0.46.0

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
@@ -49,7 +49,7 @@ Available ruleSets:
49
49
  | `@azure-tools/typespec-azure-core/no-offsetdatetime` | Prefer using `utcDateTime` when representing a datetime unless an offset is necessary. |
50
50
  | `@azure-tools/typespec-azure-core/no-response-body` | Ensure that the body is set correctly for the response type. |
51
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-operation-id` | Operation ID is automatically generated by the OpenAPI emitters and should not normally be specified. |
52
+ | `@azure-tools/typespec-azure-core/no-openapi` | Azure specs should not be using decorators from @typespec/openapi or @azure-tools/typespec-autorest |
53
53
  | `@azure-tools/typespec-azure-core/prefer-csv-collection-format` | It is recommended to use "csv" for collection format of parameters. |
54
54
  | [`@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. |
55
55
  | `@azure-tools/typespec-azure-core/no-multiple-discriminator` | Classes should have at most one discriminator. |
@@ -16,7 +16,7 @@ import { noGenericNumericRule } from "./rules/no-generic-numeric.js";
16
16
  import { noMultipleDiscriminatorRule } from "./rules/no-multiple-discriminator.js";
17
17
  import { noNullableRule } from "./rules/no-nullable.js";
18
18
  import { noOffsetDateTimeRule } from "./rules/no-offsetdatetime.js";
19
- import { operationIdRule } from "./rules/no-operation-id.js";
19
+ import { noOpenAPIRule } from "./rules/no-openapi.js";
20
20
  import { noPrivateUsage } from "./rules/no-private-usage.js";
21
21
  import { noQueryExplodeRule } from "./rules/no-query-explode.js";
22
22
  import { noResponseBodyRule } from "./rules/no-response-body.js";
@@ -56,7 +56,7 @@ const rules = [
56
56
  noOffsetDateTimeRule,
57
57
  noResponseBodyRule,
58
58
  noRpcPathParamsRule,
59
- operationIdRule,
59
+ noOpenAPIRule,
60
60
  preferCsvCollectionFormatRule,
61
61
  preventFormatRule,
62
62
  noMultipleDiscriminatorRule,
@@ -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,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,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,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,4CAA4C,EAAE,MAAM,kCAAkC,CAAC;AAChG,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,2BAA2B,EAAE,MAAM,4CAA4C,CAAC;AACzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,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A8C,CAAC;AACjG,OAAO,EAAE,2BAA2B,EAAE,MAAM,uCAAuC,CAAC;AACpF,OAAO,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAE3E,MAAM,KAAK,GAAG;IACZ,cAAc;IACd,gBAAgB;IAChB,aAAa;IACb,QAAQ;IACR,UAAU;IACV,8BAA8B;IAC9B,iBAAiB;IACjB,4CAA4C;IAC5C,wBAAwB;IACxB,UAAU;IACV,sBAAsB;IACtB,2BAA2B;IAC3B,yBAAyB;IACzB,oBAAoB;IACpB,cAAc;IACd,oBAAoB;IACpB,kBAAkB;IAClB,mBAAmB;IACnB,aAAa;IACb,6BAA6B;IAC7B,iBAAiB;IACjB,2BAA2B;IAC3B,4BAA4B;IAC5B,kBAAkB;IAClB,gBAAgB;IAChB,iBAAiB;IACjB,oBAAoB;IACpB,oBAAoB;IACpB,iCAAiC;IACjC,2BAA2B;IAC3B,4BAA4B;IAC5B,gBAAgB;IAChB,qBAAqB;IACrB,yBAAyB;IACzB,oBAAoB;IACpB,gBAAgB;IAChB,cAAc;IACd,kBAAkB;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"}
@@ -0,0 +1,7 @@
1
+ export declare const noOpenAPIRule: import("@typespec/compiler").LinterRuleDefinition<"no-openapi", {
2
+ readonly default: import("@typespec/compiler").CallableMessage<["name"]>;
3
+ readonly operationId: "Operation ID is automatically generated by the OpenAPI emitters and should not normally be specified.";
4
+ readonly useRef: "Using @useRef should never be used in Azure specs.";
5
+ readonly example: "Using @example decorator explicitly is not allowed. See https://azure.github.io/typespec-azure/docs/next/migrate-swagger/faq/x-ms-examples";
6
+ }>;
7
+ //# sourceMappingURL=no-openapi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-openapi.d.ts","sourceRoot":"","sources":["../../../src/rules/no-openapi.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,aAAa;;;;;EA2CxB,CAAC"}
@@ -0,0 +1,57 @@
1
+ import { createRule, getTypeName, paramMessage, } from "@typespec/compiler";
2
+ export const noOpenAPIRule = createRule({
3
+ name: "no-openapi",
4
+ description: "Azure specs should not be using decorators from @typespec/openapi or @azure-tools/typespec-autorest",
5
+ severity: "warning",
6
+ messages: {
7
+ default: paramMessage `Azure specs should not be using decorator "${"name"}" from @typespec/openapi or @azure-tools/typespec-autorest. They will not apply to other emitter.`,
8
+ operationId: "Operation ID is automatically generated by the OpenAPI emitters and should not normally be specified.",
9
+ useRef: "Using @useRef should never be used in Azure specs.",
10
+ example: "Using @example decorator explicitly is not allowed. See https://azure.github.io/typespec-azure/docs/next/migrate-swagger/faq/x-ms-examples",
11
+ },
12
+ create(context) {
13
+ function checkDecorators(type) {
14
+ for (const dec of type.decorators) {
15
+ if (dec.definition) {
16
+ const id = getTypeName(dec.definition.namespace);
17
+ if ((id === "TypeSpec.OpenAPI" || id === "Autorest") &&
18
+ !isException(dec.definition, dec)) {
19
+ context.reportDiagnostic({
20
+ target: dec.node ?? type,
21
+ format: { name: dec.decorator.name },
22
+ messageId: getMessageId(dec.definition),
23
+ });
24
+ }
25
+ }
26
+ }
27
+ }
28
+ return {
29
+ model: checkDecorators,
30
+ modelProperty: checkDecorators,
31
+ enum: checkDecorators,
32
+ union: checkDecorators,
33
+ operation: checkDecorators,
34
+ enumMember: checkDecorators,
35
+ unionVariant: checkDecorators,
36
+ interface: checkDecorators,
37
+ namespace: checkDecorators,
38
+ };
39
+ },
40
+ });
41
+ // https://github.com/Azure/typespec-azure/issues/687 no alternative for x-ms-identifiers for now
42
+ function isException(dec, application) {
43
+ return dec.name === "@extension" && application.args[0].jsValue === "x-ms-identifiers";
44
+ }
45
+ function getMessageId(dec) {
46
+ switch (dec.name) {
47
+ case "@operationId":
48
+ return "operationId";
49
+ case "@useRef":
50
+ return "useRef";
51
+ case "@example":
52
+ return "example";
53
+ default:
54
+ return "default";
55
+ }
56
+ }
57
+ //# sourceMappingURL=no-openapi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-openapi.js","sourceRoot":"","sources":["../../../src/rules/no-openapi.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,UAAU,EACV,WAAW,EACX,YAAY,GACb,MAAM,oBAAoB,CAAC;AAE5B,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CAAC;IACtC,IAAI,EAAE,YAAY;IAClB,WAAW,EACT,qGAAqG;IACvG,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE;QACR,OAAO,EAAE,YAAY,CAAA,8CAA8C,MAAM,mGAAmG;QAC5K,WAAW,EACT,uGAAuG;QACzG,MAAM,EAAE,oDAAoD;QAC5D,OAAO,EACL,4IAA4I;KAC/I;IACD,MAAM,CAAC,OAAO;QACZ,SAAS,eAAe,CAAC,IAA0B;YACjD,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;gBAClC,IAAI,GAAG,CAAC,UAAU,EAAE,CAAC;oBACnB,MAAM,EAAE,GAAG,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;oBACjD,IACE,CAAC,EAAE,KAAK,kBAAkB,IAAI,EAAE,KAAK,UAAU,CAAC;wBAChD,CAAC,WAAW,CAAC,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,EACjC,CAAC;wBACD,OAAO,CAAC,gBAAgB,CAAC;4BACvB,MAAM,EAAE,GAAG,CAAC,IAAI,IAAI,IAAI;4BACxB,MAAM,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE;4BACpC,SAAS,EAAE,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC;yBACxC,CAAC,CAAC;oBACL,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO;YACL,KAAK,EAAE,eAAe;YACtB,aAAa,EAAE,eAAe;YAC9B,IAAI,EAAE,eAAe;YACrB,KAAK,EAAE,eAAe;YACtB,SAAS,EAAE,eAAe;YAC1B,UAAU,EAAE,eAAe;YAC3B,YAAY,EAAE,eAAe;YAC7B,SAAS,EAAE,eAAe;YAC1B,SAAS,EAAE,eAAe;SAC3B,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAEH,iGAAiG;AACjG,SAAS,WAAW,CAAC,GAAc,EAAE,WAAiC;IACpE,OAAO,GAAG,CAAC,IAAI,KAAK,YAAY,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,KAAK,kBAAkB,CAAC;AACzF,CAAC;AAED,SAAS,YAAY,CAAC,GAAc;IAClC,QAAQ,GAAG,CAAC,IAAI,EAAE,CAAC;QACjB,KAAK,cAAc;YACjB,OAAO,aAAa,CAAC;QACvB,KAAK,SAAS;YACZ,OAAO,QAAQ,CAAC;QAClB,KAAK,UAAU;YACb,OAAO,SAAS,CAAC;QACnB;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure-tools/typespec-azure-core",
3
- "version": "0.46.0-dev.2",
3
+ "version": "0.46.0",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "TypeSpec Azure Core library",
6
6
  "homepage": "https://azure.github.io/typespec-azure",
@@ -39,27 +39,26 @@
39
39
  "!dist/test/**"
40
40
  ],
41
41
  "peerDependencies": {
42
- "@typespec/compiler": "~0.59.1 || >=0.60.0-dev <0.60.0",
43
- "@typespec/http": "~0.59.1 || >=0.60.0-dev <0.60.0",
44
- "@typespec/rest": "~0.59.1 || >=0.60.0-dev <0.60.0"
42
+ "@typespec/compiler": "~0.60.0",
43
+ "@typespec/http": "~0.60.0",
44
+ "@typespec/rest": "~0.60.0"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/node": "~18.11.19",
48
- "@typespec/compiler": "~0.59.1 || >=0.60.0-dev <0.60.0",
49
- "@typespec/http": "~0.59.1 || >=0.60.0-dev <0.60.0",
50
- "@typespec/library-linter": "~0.59.0 || >=0.60.0-dev <0.60.0",
51
- "@typespec/openapi": "~0.59.0 || >=0.60.0-dev <0.60.0",
52
- "@typespec/rest": "~0.59.1 || >=0.60.0-dev <0.60.0",
53
- "@typespec/versioning": "~0.59.0 || >=0.60.0-dev <0.60.0",
54
48
  "@vitest/coverage-v8": "^2.0.4",
55
49
  "@vitest/ui": "^2.0.4",
56
50
  "c8": "^10.1.2",
57
51
  "rimraf": "~6.0.1",
58
52
  "typescript": "~5.5.4",
59
53
  "vitest": "^2.0.4",
60
- "@typespec/tspd": "~0.46.0"
54
+ "@typespec/compiler": "~0.60.0",
55
+ "@typespec/openapi": "~0.60.0",
56
+ "@typespec/http": "~0.60.0",
57
+ "@typespec/library-linter": "~0.60.0",
58
+ "@typespec/rest": "~0.60.0",
59
+ "@typespec/tspd": "~0.46.0",
60
+ "@typespec/versioning": "~0.60.0"
61
61
  },
62
- "dependencies": {},
63
62
  "scripts": {
64
63
  "clean": "rimraf ./dist ./temp",
65
64
  "build": "npm run gen-extern-signature && tsc -p . && npm run lint-typespec-library",
@@ -1,4 +0,0 @@
1
- export declare const operationIdRule: import("@typespec/compiler").LinterRuleDefinition<"no-operation-id", {
2
- readonly default: "Operation ID is automatically generated by the OpenAPI emitters and should not normally be specified.";
3
- }>;
4
- //# sourceMappingURL=no-operation-id.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"no-operation-id.d.ts","sourceRoot":"","sources":["../../../src/rules/no-operation-id.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe;;EAyB1B,CAAC"}
@@ -1,28 +0,0 @@
1
- import { createRule } from "@typespec/compiler";
2
- import { isExcludedCoreType } from "./utils.js";
3
- export const operationIdRule = createRule({
4
- name: "no-operation-id",
5
- description: "Operation ID is automatically generated by the OpenAPI emitters and should not normally be specified.",
6
- severity: "warning",
7
- messages: {
8
- default: "Operation ID is automatically generated by the OpenAPI emitters and should not normally be specified.",
9
- },
10
- create(context) {
11
- return {
12
- operation: (operation) => {
13
- if (isExcludedCoreType(context.program, operation))
14
- return;
15
- for (const dec of operation.decorators) {
16
- // See issue https://github.com/microsoft/typespec/issues/1943 for more precise
17
- if (dec.decorator.name === "$operationId") {
18
- context.reportDiagnostic({
19
- format: { operationId: operation.name },
20
- target: operation,
21
- });
22
- }
23
- }
24
- },
25
- };
26
- },
27
- });
28
- //# sourceMappingURL=no-operation-id.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"no-operation-id.js","sourceRoot":"","sources":["../../../src/rules/no-operation-id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,CAAC,MAAM,eAAe,GAAG,UAAU,CAAC;IACxC,IAAI,EAAE,iBAAiB;IACvB,WAAW,EACT,uGAAuG;IACzG,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE;QACR,OAAO,EACL,uGAAuG;KAC1G;IACD,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,SAAS,EAAE,CAAC,SAAoB,EAAE,EAAE;gBAClC,IAAI,kBAAkB,CAAC,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC;oBAAE,OAAO;gBAC3D,KAAK,MAAM,GAAG,IAAI,SAAS,CAAC,UAAU,EAAE,CAAC;oBACvC,+EAA+E;oBAC/E,IAAI,GAAG,CAAC,SAAS,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;wBAC1C,OAAO,CAAC,gBAAgB,CAAC;4BACvB,MAAM,EAAE,EAAE,WAAW,EAAE,SAAS,CAAC,IAAI,EAAE;4BACvC,MAAM,EAAE,SAAS;yBAClB,CAAC,CAAC;oBACL,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}