From e9f947af8fb808418a837adc07d1cc56e8dc819c Mon Sep 17 00:00:00 2001 From: pshao25 <97225342+pshao25@users.noreply.github.com> Date: Wed, 23 Oct 2024 21:11:14 +0800 Subject: [PATCH 1/8] Expose fullyCompatible parameter of converter --- tools/tsp-client/src/commands.ts | 5 +++++ tools/tsp-client/src/index.ts | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/tools/tsp-client/src/commands.ts b/tools/tsp-client/src/commands.ts index 45a0fee9dfc..b7ed810741f 100644 --- a/tools/tsp-client/src/commands.ts +++ b/tools/tsp-client/src/commands.ts @@ -333,6 +333,7 @@ export async function convertCommand(argv: any): Promise { const outputDir = argv["output-dir"]; const swaggerReadme = argv["swagger-readme"]; const arm = argv["arm"]; + const fullyCompatible = argv["fullyCompatible"]; let rootUrl = resolvePath(outputDir); Logger.info("Converting swagger to typespec..."); @@ -368,6 +369,10 @@ export async function convertCommand(argv: any): Promise { if (arm) { args.push("--isArm"); } + + if (fullyCompatible) { + args.push("--isFullCompatible"); + } await nodeCommand(outputDir, args); if (arm) { diff --git a/tools/tsp-client/src/index.ts b/tools/tsp-client/src/index.ts index 54218240aa0..98cfbf1c1c2 100644 --- a/tools/tsp-client/src/index.ts +++ b/tools/tsp-client/src/index.ts @@ -199,6 +199,10 @@ const parser = yargs(hideBin(process.argv)) .option("arm", { type: "boolean", description: "Convert swagger to ARM TypeSpec", + }) + .option("fullyCompatible", { + type: "boolean", + description: "Convert swagger to fully compatible TypeSpec", }); }, async (argv: any) => { From fe9568e37055653692ba6bb56edebcab3b6d07fa Mon Sep 17 00:00:00 2001 From: pshao25 <97225342+pshao25@users.noreply.github.com> Date: Wed, 23 Oct 2024 21:14:05 +0800 Subject: [PATCH 2/8] update --- tools/tsp-client/CHANGELOG.md | 4 ++++ tools/tsp-client/package-lock.json | 4 ++-- tools/tsp-client/package.json | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/tsp-client/CHANGELOG.md b/tools/tsp-client/CHANGELOG.md index ad4898a8a3e..a1506c26563 100644 --- a/tools/tsp-client/CHANGELOG.md +++ b/tools/tsp-client/CHANGELOG.md @@ -1,5 +1,9 @@ # Release +## 2024-10-24 - 0.13.3 + +- Expose `fullyCompatible` argument for `@autorest/openapi-to-typespec` + ## 2024-10-21 - 0.13.2 - Bumped `@autorest/openapi-to-typespec` version to `0.10.2`. diff --git a/tools/tsp-client/package-lock.json b/tools/tsp-client/package-lock.json index 272f28371c2..947ae88c133 100644 --- a/tools/tsp-client/package-lock.json +++ b/tools/tsp-client/package-lock.json @@ -1,12 +1,12 @@ { "name": "@azure-tools/typespec-client-generator-cli", - "version": "0.13.2", + "version": "0.13.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@azure-tools/typespec-client-generator-cli", - "version": "0.13.2", + "version": "0.13.3", "license": "MIT", "dependencies": { "@autorest/core": "^3.10.2", diff --git a/tools/tsp-client/package.json b/tools/tsp-client/package.json index bd609f55e55..f1baa63009e 100644 --- a/tools/tsp-client/package.json +++ b/tools/tsp-client/package.json @@ -1,6 +1,6 @@ { "name": "@azure-tools/typespec-client-generator-cli", - "version": "0.13.2", + "version": "0.13.3", "description": "A tool to generate Azure SDKs from TypeSpec", "main": "dist/index.js", "homepage": "https://github.com/Azure/azure-sdk-tools/tree/main/tools/tsp-client#readme", From 966841cb8d460b569d98eafa41378a180c830a87 Mon Sep 17 00:00:00 2001 From: pshao25 <97225342+pshao25@users.noreply.github.com> Date: Fri, 25 Oct 2024 15:24:51 +0800 Subject: [PATCH 3/8] update --- tools/tsp-client/package-lock.json | 8 ++++---- tools/tsp-client/package.json | 2 +- tools/tsp-client/src/commands.ts | 2 +- tools/tsp-client/src/index.ts | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/tsp-client/package-lock.json b/tools/tsp-client/package-lock.json index 947ae88c133..42a7797cc7d 100644 --- a/tools/tsp-client/package-lock.json +++ b/tools/tsp-client/package-lock.json @@ -10,7 +10,7 @@ "license": "MIT", "dependencies": { "@autorest/core": "^3.10.2", - "@autorest/openapi-to-typespec": "0.10.2", + "@autorest/openapi-to-typespec": "0.10.3", "@azure-tools/rest-api-diff": ">=0.1.0 <1.0.0", "@azure-tools/typespec-autorest": ">=0.44.0 <1.0.0", "@azure/core-rest-pipeline": "^1.12.0", @@ -91,9 +91,9 @@ } }, "node_modules/@autorest/openapi-to-typespec": { - "version": "0.10.2", - "resolved": "https://registry.npmjs.org/@autorest/openapi-to-typespec/-/openapi-to-typespec-0.10.2.tgz", - "integrity": "sha512-N6O/7vND6i4HhU72N7lPuO4CbClhRfYVV5z+MD4M4aaRY/bPekoUV8nei7nR0sa1+cvcCCKvfkJleCSEBMmNyA==", + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/@autorest/openapi-to-typespec/-/openapi-to-typespec-0.10.3.tgz", + "integrity": "sha512-+NY2BpYZC5ZRZyZaOqzTCAfiLPlv0pPQSO7s7vHAcXKGs9mI09djaLvKYLqiULetLsq7HC8xUi4nIEKFQ7r4lw==", "dependencies": { "@autorest/codemodel": "~4.20.0", "@autorest/extension-base": "~3.6.0", diff --git a/tools/tsp-client/package.json b/tools/tsp-client/package.json index f1baa63009e..b08521da1fe 100644 --- a/tools/tsp-client/package.json +++ b/tools/tsp-client/package.json @@ -52,7 +52,7 @@ }, "dependencies": { "@autorest/core": "^3.10.2", - "@autorest/openapi-to-typespec": "0.10.2", + "@autorest/openapi-to-typespec": "0.10.3", "@azure-tools/typespec-autorest": ">=0.44.0 <1.0.0", "@azure/core-rest-pipeline": "^1.12.0", "@azure-tools/rest-api-diff": ">=0.1.0 <1.0.0", diff --git a/tools/tsp-client/src/commands.ts b/tools/tsp-client/src/commands.ts index b7ed810741f..2bbde0db37e 100644 --- a/tools/tsp-client/src/commands.ts +++ b/tools/tsp-client/src/commands.ts @@ -333,7 +333,7 @@ export async function convertCommand(argv: any): Promise { const outputDir = argv["output-dir"]; const swaggerReadme = argv["swagger-readme"]; const arm = argv["arm"]; - const fullyCompatible = argv["fullyCompatible"]; + const fullyCompatible = argv["fully-compatible"]; let rootUrl = resolvePath(outputDir); Logger.info("Converting swagger to typespec..."); diff --git a/tools/tsp-client/src/index.ts b/tools/tsp-client/src/index.ts index 98cfbf1c1c2..4765a0c6fbd 100644 --- a/tools/tsp-client/src/index.ts +++ b/tools/tsp-client/src/index.ts @@ -200,7 +200,7 @@ const parser = yargs(hideBin(process.argv)) type: "boolean", description: "Convert swagger to ARM TypeSpec", }) - .option("fullyCompatible", { + .option("fully-compatible", { type: "boolean", description: "Convert swagger to fully compatible TypeSpec", }); From 5387dfd6e8dd14a9db34288b3b733d258f063f46 Mon Sep 17 00:00:00 2001 From: pshao25 <97225342+pshao25@users.noreply.github.com> Date: Fri, 25 Oct 2024 15:26:33 +0800 Subject: [PATCH 4/8] update --- tools/tsp-client/CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/tsp-client/CHANGELOG.md b/tools/tsp-client/CHANGELOG.md index a1506c26563..44e3b38eff7 100644 --- a/tools/tsp-client/CHANGELOG.md +++ b/tools/tsp-client/CHANGELOG.md @@ -1,8 +1,9 @@ # Release -## 2024-10-24 - 0.13.3 +## 2024-10-25 - 0.13.3 - Expose `fullyCompatible` argument for `@autorest/openapi-to-typespec` +- Bumped `@autorest/openapi-to-typespec` version to `0.10.3`. ## 2024-10-21 - 0.13.2 From 0978aad606e128b32ec6ce254d726953c098130c Mon Sep 17 00:00:00 2001 From: pshao25 <97225342+pshao25@users.noreply.github.com> Date: Fri, 25 Oct 2024 16:12:26 +0800 Subject: [PATCH 5/8] update --- tools/tsp-client/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tsp-client/README.md b/tools/tsp-client/README.md index a8baed6b21e..69548140026 100644 --- a/tools/tsp-client/README.md +++ b/tools/tsp-client/README.md @@ -52,7 +52,7 @@ Generate a client library from a TypeSpec project. The `generate` command should ### convert -Convert an existing swagger specification to a TypeSpec project. This command should only be run once to get started working on a TypeSpec project. TypeSpec projects will need to be optimized manually and fully reviewed after conversion. When using this command a path or url to a swagger README file is required through the `--swagger-readme` flag. +Convert an existing swagger specification to a TypeSpec project. This command should only be run once to get started working on a TypeSpec project. TypeSpec projects will need to be optimized manually and fully reviewed after conversion. When using this command a path or url to a swagger README file is required through the `--swagger-readme` flag. Highly suggested to leverage TypeSpec built-in libraries with standarded patterns and templates, which will cause discrepancy between the generated TypeSpec and original swagger. If you really don't want this intended discrepancy, add `--fully-compatible` flag. ### compare From 7c6164dc66a62f68972c855f47b9ad87df3bebb5 Mon Sep 17 00:00:00 2001 From: Pan Shao <97225342+pshao25@users.noreply.github.com> Date: Sat, 26 Oct 2024 12:03:36 +0800 Subject: [PATCH 6/8] Update tools/tsp-client/CHANGELOG.md Co-authored-by: catalinaperalta --- tools/tsp-client/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tsp-client/CHANGELOG.md b/tools/tsp-client/CHANGELOG.md index 44e3b38eff7..ee6a2d59c89 100644 --- a/tools/tsp-client/CHANGELOG.md +++ b/tools/tsp-client/CHANGELOG.md @@ -2,7 +2,7 @@ ## 2024-10-25 - 0.13.3 -- Expose `fullyCompatible` argument for `@autorest/openapi-to-typespec` +- Expose `fully-compatible` flag for the `convert` command - Bumped `@autorest/openapi-to-typespec` version to `0.10.3`. ## 2024-10-21 - 0.13.2 From 537042b31d89ce49d27a44b9c58d20a7dad42a5c Mon Sep 17 00:00:00 2001 From: Pan Shao <97225342+pshao25@users.noreply.github.com> Date: Sat, 26 Oct 2024 12:03:45 +0800 Subject: [PATCH 7/8] Update tools/tsp-client/README.md Co-authored-by: catalinaperalta --- tools/tsp-client/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tsp-client/README.md b/tools/tsp-client/README.md index 69548140026..a589c32e517 100644 --- a/tools/tsp-client/README.md +++ b/tools/tsp-client/README.md @@ -52,7 +52,7 @@ Generate a client library from a TypeSpec project. The `generate` command should ### convert -Convert an existing swagger specification to a TypeSpec project. This command should only be run once to get started working on a TypeSpec project. TypeSpec projects will need to be optimized manually and fully reviewed after conversion. When using this command a path or url to a swagger README file is required through the `--swagger-readme` flag. Highly suggested to leverage TypeSpec built-in libraries with standarded patterns and templates, which will cause discrepancy between the generated TypeSpec and original swagger. If you really don't want this intended discrepancy, add `--fully-compatible` flag. +Convert an existing swagger specification to a TypeSpec project. This command should only be run once to get started working on a TypeSpec project. TypeSpec projects will need to be optimized manually and fully reviewed after conversion. When using this command a path or url to a swagger README file is required through the `--swagger-readme` flag. By default, the converted TypeSpec project will leverage TypeSpec built-in libraries with standard patterns and templates (highly recommended), which will cause discrepancies between the generated TypeSpec and original swagger. If you really don't want this intended discrepancy, add `--fully-compatible` flag to generate a TypeSpec project that is fully compatible with the swagger. ### compare From 7fbbd6045e3f830448cf8fca41cc36755b326987 Mon Sep 17 00:00:00 2001 From: pshao25 <97225342+pshao25@users.noreply.github.com> Date: Thu, 31 Oct 2024 13:07:49 +0800 Subject: [PATCH 8/8] update --- tools/tsp-client/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tsp-client/CHANGELOG.md b/tools/tsp-client/CHANGELOG.md index ee6a2d59c89..91f2cb678ad 100644 --- a/tools/tsp-client/CHANGELOG.md +++ b/tools/tsp-client/CHANGELOG.md @@ -1,6 +1,6 @@ # Release -## 2024-10-25 - 0.13.3 +## 2024-10-31 - 0.13.3 - Expose `fully-compatible` flag for the `convert` command - Bumped `@autorest/openapi-to-typespec` version to `0.10.3`.