Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
4 changes: 4 additions & 0 deletions tools/tsp-client/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release

## 2024-07-31 - 0.10.0

- Copy the package.json + package-lock.json directly under TempTypeSpecFiles/. (#8583)

## 2024-07-23 - 0.9.4

- Fixed issue where one additional directory entry is treated as a string instead of an array. (#8551)
Expand Down
4 changes: 2 additions & 2 deletions tools/tsp-client/package-lock.json

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

2 changes: 1 addition & 1 deletion 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.9.4",
"version": "0.10.0",
"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
6 changes: 3 additions & 3 deletions tools/tsp-client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,14 @@ async function syncTspFiles(outputDir: string, localSpecRepo?: string) {

try {
const emitterLockPath = joinPaths(repoRoot, "eng", "emitter-package-lock.json");
await cp(emitterLockPath, joinPaths(srcDir, "package-lock.json"), { recursive: true });
await cp(emitterLockPath, joinPaths(tempRoot, "package-lock.json"), { recursive: true });
} catch (err) {
Logger.debug(`Ran into the following error when looking for emitter-package-lock.json: ${err}`);
Logger.debug("Will attempt look for emitter-package.json...");
}
try {
const emitterPath = joinPaths(repoRoot, "eng", "emitter-package.json");
await cp(emitterPath, joinPaths(srcDir, "package.json"), { recursive: true });
await cp(emitterPath, joinPaths(tempRoot, "package.json"), { recursive: true });
} catch (err) {
throw new Error(`Ran into the following error: ${err}\nTo continue using tsp-client, please provide a valid emitter-package.json file in the eng/ directory of the repository.`);
}
Expand Down Expand Up @@ -213,7 +213,7 @@ async function generate({
const args: string[] = [];
try {
// Check if package-lock.json exists, if it does, we'll install dependencies through `npm ci`
await stat(joinPaths(srcDir, "package-lock.json"));
await stat(joinPaths(tempRoot, "package-lock.json"));
args.push("ci");
} catch (err) {
// If package-lock.json doesn't exist, we'll attempt to install dependencies through `npm install`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
directory: specification/contosowidgetmanager/Contoso.WidgetManager
commit: db63bea839f5648462c94e685d5cc96f8e8b38ba
repo: Azure/azure-rest-api-specs
additionalDirectories:
- specification/contosowidgetmanager/Contoso.WidgetManager.Shared/
additionalDirectories:
- specification/contosowidgetmanager/Contoso.WidgetManager.Shared/
35 changes: 35 additions & 0 deletions tools/tsp-client/test/examples/specification/convert/client.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import "./main.tsp";
import "@azure-tools/typespec-client-generator-core";

using Azure.ClientGenerator.Core;
using AzureSphereManagementClient;

#suppress "deprecated" "@flattenProperty decorator is not recommended to use."
@@flattenProperty(Catalog.properties);

#suppress "deprecated" "@flattenProperty decorator is not recommended to use."
@@flattenProperty(Certificate.properties);

#suppress "deprecated" "@flattenProperty decorator is not recommended to use."
@@flattenProperty(Image.properties);

#suppress "deprecated" "@flattenProperty decorator is not recommended to use."
@@flattenProperty(Deployment.properties);

#suppress "deprecated" "@flattenProperty decorator is not recommended to use."
@@flattenProperty(DeviceGroup.properties);

#suppress "deprecated" "@flattenProperty decorator is not recommended to use."
@@flattenProperty(Device.properties);

#suppress "deprecated" "@flattenProperty decorator is not recommended to use."
@@flattenProperty(Product.properties);

#suppress "deprecated" "@flattenProperty decorator is not recommended to use."
@@flattenProperty(ProductUpdate.properties);

#suppress "deprecated" "@flattenProperty decorator is not recommended to use."
@@flattenProperty(DeviceGroupUpdate.properties);

#suppress "deprecated" "@flattenProperty decorator is not recommended to use."
@@flattenProperty(DeviceUpdate.properties);
20 changes: 18 additions & 2 deletions tools/tsp-client/test/examples/specification/convert/main.tsp
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
/**
* PLEASE DO NOT REMOVE - USED FOR CONVERTER METRICS
* Generated by package: @autorest/openapi-to-typespec
* Version: 0.8.2
* Date: 2024-07-27T03:29:14.741Z
*/
import "@typespec/rest";
import "@typespec/http";
import "./routes.tsp";

using TypeSpec.Rest;
using TypeSpec.Http;
using TypeSpec.Versioning;
/**
* Azure Sphere resource management API.
*/
@useAuth(AadOauth2Auth<["user_impersonation"]>)
@service({
title: "AzureSphereManagementClient",
})
Expand All @@ -15,10 +26,15 @@ using TypeSpec.Http;
$host: string,
}
)
@doc("Azure Sphere resource management API.")
namespace AzureSphereManagementClient;

@doc("The available API versions.")
/**
* The available API versions.
*/
enum Versions {
/**
* The 2024-04-01 API version.
*/
@useDependency(Azure.Core.Versions.v1_0_Preview_1)
v2024_04_01: "2024-04-01",
}
Loading