Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: fix
packages:
- "@azure-tools/typespec-java"
---

Fix per-client `ServiceVersion` regression after migrating from js-yaml and lodash.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: dependencies
packages:
- "@azure-tools/typespec-java"
---

Remove `@azure-tools/typespec-liftr-base` and `@azure-tools/openai-typespec` from the peer and dev dependencies.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: feature
packages:
- "@azure-tools/typespec-java"
---

Support `clientApiVersions`.
2 changes: 1 addition & 1 deletion packages/typespec-java/core-commit.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "sha": "42927da57e230b59a93e3a36d787c4ede5e50051" }
{ "sha": "8cef6d928a2ac3237d5eacb69b4ac671a54bcf92" }
9 changes: 5 additions & 4 deletions packages/typespec-java/emitter-tests/SyncTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,14 @@ finally {

# Point the local @azure-tools/typespec-java dependency at the .tgz produced by
# this repo's emitter (Build-TypeSpec.ps1 runs `npm pack`, which names the file
# azure-tools-typespec-java-<version>.tgz). Keep that version in sync with
# packages/typespec-java/package.json so a version bump there propagates here.
# This depends only on the local repo, not on core, so it runs outside the
# core-commit checkout as its own read-modify-write.
# azure-tools-typespec-java-<version>.tgz). Keep both this test project's own
# version and that dependency in sync with packages/typespec-java/package.json so
# a version bump there propagates here. This depends only on the local repo, not
# on core, so it runs outside the core-commit checkout as its own read-modify-write.
$localPackageJsonPath = Join-Path $scriptRoot "package.json"
$emitterVersion = (Get-Content (Join-Path $packageRoot "package.json") -Raw | ConvertFrom-Json).version
$localPackage = Get-Content $localPackageJsonPath -Raw | ConvertFrom-Json
$localPackage.version = $emitterVersion
Comment thread
XiaofeiCao marked this conversation as resolved.
if ($localPackage.dependencies.PSObject.Properties.Name -contains "@azure-tools/typespec-java") {
$localPackage.dependencies.'@azure-tools/typespec-java' = "file:../azure-tools-typespec-java-$emitterVersion.tgz"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import "@typespec/rest";
import "@typespec/http";
import "@typespec/versioning";
import "@azure-tools/typespec-client-generator-core";

using TypeSpec.Http;
using TypeSpec.Versioning;
using Azure.ClientGenerator.Core;

// A single versioned service that is split into two clients (AlphaClient, BetaClient). Both
// clients therefore share the same set of api-versions. In this case the emitter must generate a
// SINGLE shared `MultipleClientsSameVersionServiceVersion` enum (named after the service), NOT a
// separate `<ClientName>ServiceVersion` per client.
//
// Regression test for the api-version comparison in code-model-builder.ts (getServiceVersion
// postprocess): comparing ApiVersion object references (with `===`) instead of the version
// strings incorrectly produced one ServiceVersion enum per client here, because each client
// builds its own ApiVersion instances.
@service(#{ title: "MultipleClientsSameVersion" })
@versioned(ServiceApiVersions)
namespace TspTest.MultipleClientsSameVersion;

enum ServiceApiVersions {
v2023_01_01: "2023-01-01",
v2023_06_01: "2023-06-01",
}

model Resource {
@visibility(Lifecycle.Read)
id: string;

name: string;
}

@client({
service: TspTest.MultipleClientsSameVersion,
name: "AlphaClient",
})
@route("/alpha")
interface AlphaClient {
@get
getAlpha(@path id: string): Resource;
}

@client({
service: TspTest.MultipleClientsSameVersion,
name: "BetaClient",
})
@route("/beta")
interface BetaClient {
@get
getBeta(@path id: string): Resource;
}
4 changes: 0 additions & 4 deletions packages/typespec-java/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@
"@azure-tools/typespec-azure-resource-manager": "workspace:^",
"@azure-tools/typespec-azure-rulesets": "workspace:^",
"@azure-tools/typespec-client-generator-core": "workspace:^",
"@azure-tools/typespec-liftr-base": "catalog:",
"@azure-tools/openai-typespec": "catalog:",
"@typespec/compiler": "workspace:^",
"@typespec/events": "workspace:^",
"@typespec/http": "workspace:^",
Expand All @@ -72,8 +70,6 @@
"@azure-tools/typespec-azure-resource-manager": "workspace:^",
"@azure-tools/typespec-azure-rulesets": "workspace:^",
"@azure-tools/typespec-client-generator-core": "workspace:^",
"@azure-tools/typespec-liftr-base": "catalog:",
"@azure-tools/openai-typespec": "catalog:",
"@types/node": "catalog:",
"@typespec/compiler": "workspace:^",
"@typespec/events": "workspace:^",
Expand Down
28 changes: 0 additions & 28 deletions pnpm-lock.yaml

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

Loading