Skip to content

Commit 0484a95

Browse files
authored
Update to the latest tsp toolset (#899)
Added new tests for the special-words test suite. Fixed handling of empty path when checking for query params (this was a change in the TypeSpec.Http lib).
1 parent fda50f4 commit 0484a95

17 files changed

Lines changed: 1035 additions & 211 deletions

File tree

packages/typespec-rust/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Release History
22

3-
## 0.37.0 (unreleased)
3+
## 0.37.0 (2026-03-11)
44

55
### Breaking Changes
66

packages/typespec-rust/package.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,20 @@
4949
"homepage": "https://github.com/Azure/typespec-rust#readme",
5050
"readme": "https://github.com/Azure/typespec-rust/blob/main/readme.md",
5151
"devDependencies": {
52-
"@azure-tools/azure-http-specs": "0.1.0-alpha.38-dev.6",
53-
"@azure-tools/typespec-azure-core": "~0.65.0",
54-
"@azure-tools/typespec-azure-resource-manager": "~0.65.0",
55-
"@azure-tools/typespec-client-generator-core": "~0.65.4",
52+
"@azure-tools/azure-http-specs": "0.1.0-alpha.38",
53+
"@azure-tools/typespec-azure-core": "~0.66.0",
54+
"@azure-tools/typespec-azure-resource-manager": "~0.66.0",
55+
"@azure-tools/typespec-client-generator-core": "~0.66.1",
5656
"@eslint/js": "^9.39.1",
5757
"@types/node": "^20.19.25",
58-
"@typespec/compiler": "^1.9.0",
59-
"@typespec/http": "^1.9.1",
60-
"@typespec/http-specs": "0.1.0-alpha.33-dev.3",
61-
"@typespec/openapi": "^1.9.0",
62-
"@typespec/rest": "~0.79.0",
63-
"@typespec/spector": "0.1.0-alpha.23",
64-
"@typespec/versioning": "~0.79.0",
65-
"@typespec/xml": "~0.79.0",
58+
"@typespec/compiler": "^1.10.0",
59+
"@typespec/http": "^1.10.0",
60+
"@typespec/http-specs": "0.1.0-alpha.34",
61+
"@typespec/openapi": "^1.10.0",
62+
"@typespec/rest": "~0.80.0",
63+
"@typespec/spector": "0.1.0-alpha.24",
64+
"@typespec/versioning": "~0.80.0",
65+
"@typespec/xml": "~0.80.0",
6666
"@vitest/coverage-v8": "^4.0.10",
6767
"@vitest/ui": "^4.0.10",
6868
"c8": "^10.1.3",
@@ -72,9 +72,9 @@
7272
"vitest": "^4.0.10"
7373
},
7474
"peerDependencies": {
75-
"@azure-tools/typespec-client-generator-core": ">=0.65.4 <1.0.0",
76-
"@typespec/compiler": "^1.9.0",
77-
"@typespec/http": "^1.9.1"
75+
"@azure-tools/typespec-client-generator-core": ">=0.66.1 <1.0.0",
76+
"@typespec/compiler": "^1.10.0",
77+
"@typespec/http": "^1.10.0"
7878
},
7979
"dependencies": {
8080
"@types/turndown": "^5.0.6",

packages/typespec-rust/pnpm-lock.yaml

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

packages/typespec-rust/src/codegen/clients.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -882,8 +882,8 @@ function constructUrl(indent: helpers.indentation, use: Use, method: ClientMetho
882882

883883
let body = '';
884884

885-
// if path is just "/" no need to set it again, we're already there
886-
if (pathChunks[0] !== '/') {
885+
// if path is just "/" or empty, no need to set it again, we're already there
886+
if (pathChunks[0] !== '/' && pathChunks[0] !== '') {
887887
use.add('azure_core::http', 'UrlExt');
888888
let path = `"${pathChunks[0]}"`;
889889
if (paramGroups.path.length === 0) {

packages/typespec-rust/test/other/serde_tests/src/generated/models/models.rs

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
//
4+
// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT.
5+
6+
mod special_words_extensible_strings_client;
7+
pub use special_words_extensible_strings_client::*;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
//
4+
// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT.
5+
6+
use crate::extensible_strings::generated::models::{
7+
ExtensibleString, SpecialWordsExtensibleStringsClientPutExtensibleStringValueOptions,
8+
};
9+
use azure_core::{
10+
error::CheckSuccessOptions,
11+
http::{Method, Pipeline, PipelineSendOptions, Request, RequestContent, Response, Url, UrlExt},
12+
tracing, Result,
13+
};
14+
15+
/// Verify enum member names that are special words.
16+
#[tracing::client]
17+
pub struct SpecialWordsExtensibleStringsClient {
18+
pub(crate) endpoint: Url,
19+
pub(crate) pipeline: Pipeline,
20+
}
21+
22+
impl SpecialWordsExtensibleStringsClient {
23+
/// Returns the Url associated with this client.
24+
pub fn endpoint(&self) -> &Url {
25+
&self.endpoint
26+
}
27+
28+
///
29+
/// # Arguments
30+
///
31+
/// * `options` - Optional parameters for the request.
32+
#[tracing::function("SpecialWords.ExtensibleStrings.putExtensibleStringValue")]
33+
pub async fn put_extensible_string_value(
34+
&self,
35+
body: RequestContent<ExtensibleString>,
36+
options: Option<SpecialWordsExtensibleStringsClientPutExtensibleStringValueOptions<'_>>,
37+
) -> Result<Response<ExtensibleString>> {
38+
let options = options.unwrap_or_default();
39+
let ctx = options.method_options.context.to_borrowed();
40+
let mut url = self.endpoint.clone();
41+
url.append_path("/special-words/extensible-strings/string");
42+
let mut request = Request::new(url, Method::Put);
43+
request.insert_header("accept", "application/json");
44+
request.insert_header("content-type", "application/json");
45+
request.set_body(body);
46+
let rsp = self
47+
.pipeline
48+
.send(
49+
&ctx,
50+
&mut request,
51+
Some(PipelineSendOptions {
52+
check_success: CheckSuccessOptions {
53+
success_codes: &[200],
54+
},
55+
..Default::default()
56+
}),
57+
)
58+
.await?;
59+
Ok(rsp.into())
60+
}
61+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
//
4+
// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT.
5+
6+
/// Clients used to communicate with the service.
7+
pub mod clients;
8+
/// Contains all the data structures and types used by the client library.
9+
pub mod models;
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
//
4+
// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT.
5+
6+
/// Verify enum member names that are special words using extensible enum (union).
7+
#[derive(Clone, Debug, Eq, PartialEq)]
8+
pub enum ExtensibleString {
9+
And,
10+
11+
As,
12+
13+
Assert,
14+
15+
Async,
16+
17+
Await,
18+
19+
Break,
20+
21+
Class,
22+
23+
Constructor,
24+
25+
Continue,
26+
27+
Def,
28+
29+
Del,
30+
31+
Elif,
32+
33+
Else,
34+
35+
Except,
36+
37+
Exec,
38+
39+
Finally,
40+
41+
For,
42+
43+
From,
44+
45+
Global,
46+
47+
If,
48+
49+
Import,
50+
51+
In,
52+
53+
Is,
54+
55+
Lambda,
56+
57+
Not,
58+
59+
Or,
60+
61+
Pass,
62+
63+
Raise,
64+
65+
Return,
66+
67+
Try,
68+
69+
While,
70+
71+
With,
72+
73+
Yield,
74+
75+
/// Any other value not defined in `ExtensibleString`.
76+
UnknownValue(String),
77+
}

0 commit comments

Comments
 (0)