Expose fullyCompatible parameter of converter (#9238)

* Expose fullyCompatible parameter of converter

* update

* update

* update

* update

* Update tools/tsp-client/CHANGELOG.md

Co-authored-by: catalinaperalta <catalinaperaltah@hotmail.com>

* Update tools/tsp-client/README.md

Co-authored-by: catalinaperalta <catalinaperaltah@hotmail.com>

* update

---------

Co-authored-by: catalinaperalta <catalinaperaltah@hotmail.com>
This commit is contained in:
Pan Shao 2024-10-31 13:24:14 +08:00 коммит произвёл GitHub
Родитель bf2e0b6bf7
Коммит 9b3e202a41
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
6 изменённых файлов: 23 добавлений и 9 удалений

Просмотреть файл

@ -1,5 +1,10 @@
# Release
## 2024-10-31 - 0.13.3
- Expose `fully-compatible` flag for the `convert` command
- Bumped `@autorest/openapi-to-typespec` version to `0.10.3`.
## 2024-10-21 - 0.13.2
- Bumped `@autorest/openapi-to-typespec` version to `0.10.2`.

Просмотреть файл

@ -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. 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

12
tools/tsp-client/package-lock.json сгенерированный
Просмотреть файл

@ -1,16 +1,16 @@
{
"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",
"@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",

Просмотреть файл

@ -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",
@ -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",

Просмотреть файл

@ -333,6 +333,7 @@ export async function convertCommand(argv: any): Promise<void> {
const outputDir = argv["output-dir"];
const swaggerReadme = argv["swagger-readme"];
const arm = argv["arm"];
const fullyCompatible = argv["fully-compatible"];
let rootUrl = resolvePath(outputDir);
Logger.info("Converting swagger to typespec...");
@ -368,6 +369,10 @@ export async function convertCommand(argv: any): Promise<void> {
if (arm) {
args.push("--isArm");
}
if (fullyCompatible) {
args.push("--isFullCompatible");
}
await nodeCommand(outputDir, args);
if (arm) {

Просмотреть файл

@ -199,6 +199,10 @@ const parser = yargs(hideBin(process.argv))
.option("arm", {
type: "boolean",
description: "Convert swagger to ARM TypeSpec",
})
.option("fully-compatible", {
type: "boolean",
description: "Convert swagger to fully compatible TypeSpec",
});
},
async (argv: any) => {