Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose fullyCompatible parameter of converter #9238

Merged
merged 8 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions tools/tsp-client/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Release

## 2024-10-25 - 0.13.3

- Expose `fullyCompatible` argument for `@autorest/openapi-to-typespec`
pshao25 marked this conversation as resolved.
Show resolved Hide resolved
- 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`.
Expand Down
2 changes: 1 addition & 1 deletion tools/tsp-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
pshao25 marked this conversation as resolved.
Show resolved Hide resolved

### compare

Expand Down
12 changes: 6 additions & 6 deletions tools/tsp-client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions tools/tsp-client/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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",
Expand Down
5 changes: 5 additions & 0 deletions tools/tsp-client/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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...");
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 4 additions & 0 deletions tools/tsp-client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down