Skip to content

Commit 28c9cfc

Browse files
Removed create_enum and create_extensible_enum macros (Azure#3056)
Fixes Azure#1846 Also update to the 0.23.2 emitter which removes the requirement for those macros. Also: Added a convenience script to regenerate the generated clients for all packages which have a `tsp-location.yaml` file.
1 parent 03c85e7 commit 28c9cfc

File tree

32 files changed

+5516
-1446
lines changed

32 files changed

+5516
-1446
lines changed

Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# cspell:ignore rustdoc
2+
13
[workspace]
24
resolver = "2"
35
members = [
@@ -156,3 +158,6 @@ uninlined_format_args = "allow"
156158

157159
[workspace.lints.rust]
158160
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(docsrs)'] }
161+
162+
[workspace.lints.rustdoc]
163+
bare_urls = "allow"

eng/emitter-package-lock.json

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

eng/emitter-package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
{
22
"main": "dist/src/index.js",
33
"dependencies": {
4-
"@azure-tools/typespec-rust": "0.23.1"
4+
"@azure-tools/typespec-rust": "0.23.2"
55
},
66
"devDependencies": {
7-
"@azure-tools/typespec-azure-core": "0.60.0",
8-
"@azure-tools/typespec-azure-rulesets": "0.60.0",
9-
"@azure-tools/typespec-client-generator-core": "0.60.1",
7+
"@azure-tools/typespec-azure-core": "0.60",
8+
"@azure-tools/typespec-azure-rulesets": "0.60",
9+
"@azure-tools/typespec-client-generator-core": ">=0.60.1",
1010
"@typespec/compiler": "1.4",
1111
"@typespec/http": "1.4",
1212
"@typespec/openapi": "1.4",
1313
"@typespec/rest": "0.74",
1414
"@typespec/versioning": "0.74",
1515
"@typespec/xml": "0.74"
1616
}
17-
}
17+
}

eng/scripts/Update-TspClients.ps1

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#!/usr/bin/env pwsh
2+
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License.
5+
6+
<#
7+
.SYNOPSIS
8+
Runs 'tsp-client update' on every directory containing a tsp-location.yml file.
9+
10+
.DESCRIPTION
11+
This script searches recursively for all tsp-location.yml files and runs
12+
'tsp-client update' in each directory that contains one.
13+
14+
.PARAMETER Path
15+
The root path to search for tsp-location.yml files. Defaults to current directory.
16+
17+
.EXAMPLE
18+
.\Update-TspClients.ps1
19+
Runs tsp-client update in all directories with tsp-location.yml files under the current directory.
20+
21+
.EXAMPLE
22+
.\Update-TspClients.ps1 -Path "C:\my-project"
23+
Runs tsp-client update in all directories with tsp-location.yml files under C:\my-project.
24+
#>
25+
26+
param(
27+
[Parameter(Mandatory = $false)]
28+
[string]$Path = (Join-Path $PSScriptRoot "../../sdk" | Resolve-Path)
29+
)
30+
31+
Write-Host "Searching for tsp-location.yaml files in: $Path" -ForegroundColor Green
32+
33+
$tspFiles = Get-ChildItem -Path $Path -Recurse -Name "tsp-location.yaml"
34+
35+
if ($tspFiles.Count -eq 0) {
36+
Write-Host "No tsp-location.yaml files found." -ForegroundColor Yellow
37+
exit 0
38+
}
39+
40+
Write-Host "Found $($tspFiles.Count) tsp-location.yaml file(s)" -ForegroundColor Green
41+
foreach ($file in $tspFiles) {
42+
$dir = Split-Path $file -Parent
43+
if ([string]::IsNullOrEmpty($dir)) {
44+
$dir = "."
45+
}
46+
47+
Write-Host "`nRunning tsp-client update in: $dir" -ForegroundColor Cyan
48+
49+
try {
50+
Push-Location $dir
51+
tsp-client update
52+
53+
if ($LASTEXITCODE -ne 0) {
54+
Write-Warning "tsp-client update failed in directory: $dir (exit code: $LASTEXITCODE)"
55+
}
56+
else {
57+
Write-Host "Successfully updated: $dir" -ForegroundColor Green
58+
}
59+
}
60+
catch {
61+
Write-Error "Error running tsp-client update in directory: $dir - $_"
62+
}
63+
finally {
64+
Pop-Location
65+
}
66+
}
67+
68+
Write-Host "`nCompleted updating all TypeSpec clients." -ForegroundColor Green

sdk/core/azure_core/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
- Renamed `ResultExt::map_kind()` to `ResultExt::with_kind()`.
2525
- Renamed `ResultExt::with_context()` to `ResultExt::with_context_fn()`.
2626
- Renamed `ResultExt::context()` to `ResultExt::with_context()`.
27+
- Removed `create_extensible_enum` and `create_enum` macros.
2728

2829
### Bugs Fixed
2930

sdk/core/azure_core/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ pub use constants::*;
2222

2323
// Re-export modules in typespec_client_core such that azure_core-based crates don't need to reference it directly.
2424
pub use typespec_client_core::{
25-
async_runtime, base64, create_enum, create_extensible_enum, fmt, json, sleep, stream, time,
26-
Bytes, Error, Result, Uuid,
25+
async_runtime, base64, fmt, json, sleep, stream, time, Bytes, Error, Result, Uuid,
2726
};
2827

2928
/// Abstractions for distributed tracing and telemetry.

0 commit comments

Comments
 (0)