@azure-tools/typespec-autorest 0.57.1 → 0.58.0-dev.1

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.
@@ -25,11 +25,6 @@ export declare function shouldInline(program: Program, type: Type): boolean;
25
25
  /**
26
26
  * Resolve the OpenAPI operation ID for the given operation using the following logic:
27
27
  * - If @operationId was specified use that value
28
- * - If @clientLocation was specified:
29
- * - If the target is a string, use the string value as the prefix of the operation ID
30
- * - If the target is an Interface, use the interface name as the prefix
31
- * - If the target is a Namespace and it's not the service namespace or global namespace, use the namespace name as the prefix
32
- * - If the target is the service namespace or global namespace, use the operation name as the operation ID
33
28
  * - If operation is defined at the root or under the service namespace return `<operation.name>`
34
29
  * - Otherwise(operation is under another namespace or interface) return `<namespace/interface.name>_<operation.name>`
35
30
  *
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,WAAW,EACjB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAOL,aAAa,EACb,SAAS,EACT,OAAO,EACP,OAAO,EACP,IAAI,EACL,MAAM,oBAAoB,CAAC;AAI5B,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC;IACrC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,sBAAsB,EAAE,IAAI,EAAE,IAAI,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,UAG3F;AACD;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAelE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,sBAAsB,EAAE,SAAS,EAAE,SAAS,UA2CvF;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,WAU3E"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,WAAW,EACjB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAOL,aAAa,EACb,SAAS,EACT,OAAO,EACP,OAAO,EACP,IAAI,EACL,MAAM,oBAAoB,CAAC;AAI5B,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC;IACrC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,sBAAsB,EAAE,IAAI,EAAE,IAAI,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,UAG3F;AACD;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAelE;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,sBAAsB,EAAE,SAAS,EAAE,SAAS,UAuBvF;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,WAU3E"}
package/dist/src/utils.js CHANGED
@@ -1,4 +1,4 @@
1
- import { getClientLocation, getClientNameOverride, } from "@azure-tools/typespec-client-generator-core";
1
+ import { getClientNameOverride, } from "@azure-tools/typespec-client-generator-core";
2
2
  import { getFriendlyName, getLifecycleVisibilityEnum, getVisibilityForClass, isGlobalNamespace, isService, isTemplateInstance, } from "@typespec/compiler";
3
3
  import { getOperationId } from "@typespec/openapi";
4
4
  import { pascalCase } from "change-case";
@@ -36,11 +36,6 @@ export function shouldInline(program, type) {
36
36
  /**
37
37
  * Resolve the OpenAPI operation ID for the given operation using the following logic:
38
38
  * - If @operationId was specified use that value
39
- * - If @clientLocation was specified:
40
- * - If the target is a string, use the string value as the prefix of the operation ID
41
- * - If the target is an Interface, use the interface name as the prefix
42
- * - If the target is a Namespace and it's not the service namespace or global namespace, use the namespace name as the prefix
43
- * - If the target is the service namespace or global namespace, use the operation name as the operation ID
44
39
  * - If operation is defined at the root or under the service namespace return `<operation.name>`
45
40
  * - Otherwise(operation is under another namespace or interface) return `<namespace/interface.name>_<operation.name>`
46
41
  *
@@ -55,22 +50,6 @@ export function resolveOperationId(context, operation) {
55
50
  return explicitOperationId;
56
51
  }
57
52
  const operationName = getClientName(context, operation);
58
- // Check for `@clientLocation` decorator
59
- const clientLocation = getClientLocation(context.tcgcSdkContext, operation);
60
- if (clientLocation) {
61
- if (typeof clientLocation === "string") {
62
- return pascalCaseForOperationId(`${clientLocation}_${operationName}`);
63
- }
64
- if (clientLocation.kind === "Interface") {
65
- return pascalCaseForOperationId(`${getClientName(context, clientLocation)}_${operationName}`);
66
- }
67
- if (clientLocation.kind === "Namespace") {
68
- if (isGlobalNamespace(program, clientLocation) || isService(program, clientLocation)) {
69
- return pascalCase(operationName);
70
- }
71
- return pascalCaseForOperationId(`${getClientName(context, clientLocation)}_${operationName}`);
72
- }
73
- }
74
53
  if (operation.interface) {
75
54
  return pascalCaseForOperationId(`${getClientName(context, operation.interface)}_${operationName}`);
76
55
  }
@@ -80,7 +59,7 @@ export function resolveOperationId(context, operation) {
80
59
  isService(program, namespace)) {
81
60
  return pascalCase(operationName);
82
61
  }
83
- return pascalCaseForOperationId(`${getClientName(context, namespace)}_${operationName}`);
62
+ return pascalCaseForOperationId(`${namespace.name}_${operationName}`);
84
63
  }
85
64
  /**
86
65
  * Determines if a property is read-only, which is defined as having only the
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,qBAAqB,GAEtB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EACL,eAAe,EACf,0BAA0B,EAC1B,qBAAqB,EACrB,iBAAiB,EACjB,SAAS,EACT,kBAAkB,GAMnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAUzC,MAAM,UAAU,aAAa,CAAC,OAA+B,EAAE,IAA6B;IAC1F,MAAM,UAAU,GAAG,qBAAqB,CAAC,OAAO,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;IACvE,OAAO,UAAU,IAAI,IAAI,CAAC,IAAI,CAAC;AACjC,CAAC;AACD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,YAAY,CAAC,OAAgB,EAAE,IAAU;IACvD,IAAI,eAAe,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC;QACnC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,KAAK,OAAO;YACV,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAC;QAChD,KAAK,QAAQ;YACX,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAC;QACrE,KAAK,MAAM,CAAC;QACZ,KAAK,OAAO;YACV,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;QACpB;YACE,OAAO,IAAI,CAAC;IAChB,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;GAcG;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EAAE,SAAS,CAAC,SAAS,CAAC,IAAI,aAAa,EAAE,CAClE,CAAC;IACJ,CAAC;IACD,MAAM,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC;IACtC,IACE,SAAS,KAAK,SAAS;QACvB,iBAAiB,CAAC,OAAO,EAAE,SAAS,CAAC;QACrC,SAAS,CAAC,OAAO,EAAE,SAAS,CAAC,EAC7B,CAAC;QACD,OAAO,UAAU,CAAC,aAAa,CAAC,CAAC;IACnC,CAAC;IAED,OAAO,wBAAwB,CAAC,GAAG,SAAS,CAAC,IAAI,IAAI,aAAa,EAAE,CAAC,CAAC;AACxE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAgB,EAAE,QAAuB;IAC1E,MAAM,SAAS,GAAG,0BAA0B,CAAC,OAAO,CAAC,CAAC;IAEtD,MAAM,IAAI,GAAG,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAE,CAAC;IAE5C,MAAM,UAAU,GAAG,qBAAqB,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;IAEvE,sEAAsE;IACtE,8CAA8C;IAC9C,OAAO,UAAU,CAAC,IAAI,KAAK,CAAC,IAAI,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACvD,CAAC;AAED,SAAS,wBAAwB,CAAC,IAAY;IAC5C,OAAO,IAAI;SACR,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;SACzB,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure-tools/typespec-autorest",
3
- "version": "0.57.1",
3
+ "version": "0.58.0-dev.1",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "TypeSpec library for emitting openapi from the TypeSpec REST protocol binding",
6
6
  "homepage": "https://azure.github.io/typespec-azure",
@@ -41,36 +41,37 @@
41
41
  "!dist/test/**"
42
42
  ],
43
43
  "peerDependencies": {
44
- "@azure-tools/typespec-azure-resource-manager": "^0.57.1",
45
- "@azure-tools/typespec-azure-core": "^0.57.0",
46
- "@azure-tools/typespec-client-generator-core": "^0.57.2",
44
+ "@azure-tools/typespec-azure-core": "^0.57.0 || >=0.58.0-dev <0.58.0",
45
+ "@azure-tools/typespec-azure-resource-manager": "^0.57.0 || >=0.58.0-dev <0.58.0",
46
+ "@azure-tools/typespec-client-generator-core": "^0.57.1 || >=0.58.0-dev <0.58.0",
47
47
  "@typespec/compiler": "^1.1.0",
48
- "@typespec/openapi": "^1.1.0",
49
- "@typespec/rest": "^0.71.0",
50
48
  "@typespec/http": "^1.1.0",
51
- "@typespec/versioning": "^0.71.0"
49
+ "@typespec/openapi": "^1.1.0",
50
+ "@typespec/rest": "^0.71.0 || >=0.72.0-dev <0.72.0",
51
+ "@typespec/versioning": "^0.71.0 || >=0.72.0-dev <0.72.0"
52
52
  },
53
53
  "devDependencies": {
54
- "@types/node": "~22.13.11",
54
+ "@azure-tools/typespec-azure-core": "^0.57.0 || >=0.58.0-dev <0.58.0",
55
+ "@azure-tools/typespec-azure-resource-manager": "^0.57.0 || >=0.58.0-dev <0.58.0",
56
+ "@azure-tools/typespec-client-generator-core": "^0.57.1 || >=0.58.0-dev <0.58.0",
57
+ "@types/node": "~24.0.3",
58
+ "@typespec/compiler": "^1.1.0",
59
+ "@typespec/http": "^1.1.0",
60
+ "@typespec/json-schema": "^1.1.0",
61
+ "@typespec/library-linter": "^0.71.0 || >=0.72.0-dev <0.72.0",
62
+ "@typespec/openapi": "^1.1.0",
63
+ "@typespec/rest": "^0.71.0 || >=0.72.0-dev <0.72.0",
64
+ "@typespec/tspd": "^0.71.0 || >=0.72.0-dev <0.72.0",
65
+ "@typespec/versioning": "^0.71.0 || >=0.72.0-dev <0.72.0",
55
66
  "@vitest/coverage-v8": "^3.1.2",
56
67
  "@vitest/ui": "^3.1.2",
57
68
  "c8": "^10.1.3",
58
69
  "change-case": "~5.4.4",
59
70
  "rimraf": "~6.0.1",
60
71
  "typescript": "~5.8.2",
61
- "vitest": "^3.1.2",
62
- "@azure-tools/typespec-azure-core": "^0.57.0",
63
- "@azure-tools/typespec-azure-resource-manager": "^0.57.1",
64
- "@typespec/compiler": "^1.1.0",
65
- "@azure-tools/typespec-client-generator-core": "^0.57.2",
66
- "@typespec/http": "^1.1.0",
67
- "@typespec/json-schema": "^1.1.0",
68
- "@typespec/library-linter": "^0.71.0",
69
- "@typespec/openapi": "^1.1.0",
70
- "@typespec/rest": "^0.71.0",
71
- "@typespec/tspd": "^0.71.0",
72
- "@typespec/versioning": "^0.71.0"
72
+ "vitest": "^3.1.2"
73
73
  },
74
+ "dependencies": {},
74
75
  "scripts": {
75
76
  "clean": "rimraf ./dist ./temp",
76
77
  "build": "npm run gen-extern-signature && npm run regen-autorest-openapi-schema && tsc -p . && npm run lint-typespec-library",