Skip to content

Commit 4d3c26f

Browse files
allow clientName on header in response (#3201)
1 parent 9559e38 commit 4d3c26f

File tree

12 files changed

+132
-35
lines changed

12 files changed

+132
-35
lines changed

core

Submodule core updated 23 files

typespec-extension/changelog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Release History
22

3+
## 0.33.3 (2025-09-17)
4+
5+
Compatible with compiler 1.4.0.
6+
7+
- Patch release: bump package version and small fixes.
8+
39
## 0.33.2 (2025-09-16)
410

511
Compatible with compiler 1.4.0.

typespec-extension/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.

typespec-extension/package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@azure-tools/typespec-java",
3-
"version": "0.33.2",
3+
"version": "0.33.3",
44
"description": "TypeSpec library for emitting Java client from the TypeSpec REST protocol binding",
55
"keywords": [
66
"TypeSpec"
@@ -51,7 +51,7 @@
5151
"@azure-tools/typespec-azure-core": ">=0.60.0 <1.0.0",
5252
"@azure-tools/typespec-azure-resource-manager": ">=0.60.0 <1.0.0",
5353
"@azure-tools/typespec-azure-rulesets": ">=0.60.0 <1.0.0",
54-
"@azure-tools/typespec-client-generator-core": ">=0.60.0 <1.0.0",
54+
"@azure-tools/typespec-client-generator-core": ">=0.60.1 <1.0.0",
5555
"@azure-tools/typespec-liftr-base": ">=0.8.0 <1.0.0",
5656
"@typespec/compiler": "^1.4.0",
5757
"@typespec/http": "^1.4.0",
@@ -70,24 +70,24 @@
7070
"@azure-tools/typespec-azure-core": "0.60.0",
7171
"@azure-tools/typespec-azure-resource-manager": "0.60.0",
7272
"@azure-tools/typespec-azure-rulesets": "0.60.0",
73-
"@azure-tools/typespec-client-generator-core": "0.60.0",
73+
"@azure-tools/typespec-client-generator-core": "0.60.1",
7474
"@azure-tools/typespec-liftr-base": "0.8.0",
75+
"@microsoft/api-extractor": "^7.52.13",
7576
"@types/js-yaml": "~4.0.9",
7677
"@types/lodash": "~4.17.20",
77-
"@types/node": "~24.5.0",
78+
"@types/node": "~24.5.1",
7879
"@typescript-eslint/eslint-plugin": "~8.44.0",
7980
"@typescript-eslint/parser": "~8.44.0",
8081
"@typespec/compiler": "1.4.0",
82+
"@typespec/events": "0.74.0",
8183
"@typespec/http": "1.4.0",
8284
"@typespec/openapi": "1.4.0",
8385
"@typespec/rest": "0.74.0",
84-
"@typespec/versioning": "0.74.0",
85-
"@typespec/xml": "0.74.0",
86-
"@typespec/events": "0.74.0",
8786
"@typespec/sse": "0.74.0",
8887
"@typespec/streams": "0.74.0",
8988
"@typespec/tspd": "0.73.0",
90-
"@microsoft/api-extractor": "^7.52.13",
89+
"@typespec/versioning": "0.74.0",
90+
"@typespec/xml": "0.74.0",
9191
"@vitest/coverage-v8": "^3.2.4",
9292
"@vitest/ui": "^3.2.4",
9393
"c8": "~10.1.3",

typespec-tests/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"@typespec/spector": "0.1.0-alpha.18",
1414
"@typespec/http-specs": "0.1.0-alpha.26",
1515
"@azure-tools/azure-http-specs": "0.1.0-alpha.29",
16-
"@azure-tools/typespec-java": "file:/../typespec-extension/azure-tools-typespec-java-0.33.2.tgz"
16+
"@azure-tools/typespec-java": "file:/../typespec-extension/azure-tools-typespec-java-0.33.3.tgz"
1717
},
1818
"devDependencies": {
1919
"@typespec/prettier-plugin-typespec": "^1.4.0",
@@ -31,7 +31,7 @@
3131
"@typespec/sse": "0.74.0",
3232
"@typespec/streams": "0.74.0",
3333
"@azure-tools/typespec-azure-core": "0.60.0",
34-
"@azure-tools/typespec-client-generator-core": "0.60.0",
34+
"@azure-tools/typespec-client-generator-core": "0.60.1",
3535
"@azure-tools/typespec-azure-resource-manager": "0.60.0",
3636
"@azure-tools/typespec-autorest": "0.60.0"
3737
},

typespec-tests/src/main/java/tsptest/armstreamstyleserialization/fluent/FunctionsClient.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
import com.azure.core.annotation.ReturnType;
88
import com.azure.core.annotation.ServiceMethod;
9-
import com.azure.core.http.rest.Response;
109
import com.azure.core.util.Context;
1110
import tsptest.armstreamstyleserialization.fluent.models.FunctionInner;
11+
import tsptest.armstreamstyleserialization.models.FunctionsCreateFunctionResponse;
1212

1313
/**
1414
* An instance of this class provides access to all the operations defined in FunctionsClient.
@@ -22,10 +22,10 @@ public interface FunctionsClient {
2222
* @throws IllegalArgumentException thrown if parameters fail the validation.
2323
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
2424
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
25-
* @return the response body along with {@link Response}.
25+
* @return the response.
2626
*/
2727
@ServiceMethod(returns = ReturnType.SINGLE)
28-
Response<FunctionInner> createFunctionWithResponse(FunctionInner function, Context context);
28+
FunctionsCreateFunctionResponse createFunctionWithResponse(FunctionInner function, Context context);
2929

3030
/**
3131
* The createFunction operation.

typespec-tests/src/main/java/tsptest/armstreamstyleserialization/implementation/FunctionsClientImpl.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import com.azure.core.annotation.ServiceInterface;
1515
import com.azure.core.annotation.ServiceMethod;
1616
import com.azure.core.annotation.UnexpectedResponseExceptionType;
17-
import com.azure.core.http.rest.Response;
1817
import com.azure.core.http.rest.RestProxy;
1918
import com.azure.core.management.exception.ManagementException;
2019
import com.azure.core.util.Context;
@@ -23,6 +22,7 @@
2322
import reactor.core.publisher.Mono;
2423
import tsptest.armstreamstyleserialization.fluent.FunctionsClient;
2524
import tsptest.armstreamstyleserialization.fluent.models.FunctionInner;
25+
import tsptest.armstreamstyleserialization.models.FunctionsCreateFunctionResponse;
2626

2727
/**
2828
* An instance of this class provides access to all the operations defined in FunctionsClient.
@@ -59,14 +59,14 @@ public interface FunctionsService {
5959
@Put("/function")
6060
@ExpectedResponses({ 200 })
6161
@UnexpectedResponseExceptionType(ManagementException.class)
62-
Mono<Response<FunctionInner>> createFunction(@HostParam("endpoint") String endpoint,
62+
Mono<FunctionsCreateFunctionResponse> createFunction(@HostParam("endpoint") String endpoint,
6363
@HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept,
6464
@BodyParam("application/json") FunctionInner function, Context context);
6565

6666
@Put("/function")
6767
@ExpectedResponses({ 200 })
6868
@UnexpectedResponseExceptionType(ManagementException.class)
69-
Response<FunctionInner> createFunctionSync(@HostParam("endpoint") String endpoint,
69+
FunctionsCreateFunctionResponse createFunctionSync(@HostParam("endpoint") String endpoint,
7070
@HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept,
7171
@BodyParam("application/json") FunctionInner function, Context context);
7272
}
@@ -78,10 +78,10 @@ Response<FunctionInner> createFunctionSync(@HostParam("endpoint") String endpoin
7878
* @throws IllegalArgumentException thrown if parameters fail the validation.
7979
* @throws ManagementException thrown if the request is rejected by server.
8080
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
81-
* @return the response body along with {@link Response} on successful completion of {@link Mono}.
81+
* @return the response body on successful completion of {@link Mono}.
8282
*/
8383
@ServiceMethod(returns = ReturnType.SINGLE)
84-
private Mono<Response<FunctionInner>> createFunctionWithResponseAsync(FunctionInner function) {
84+
private Mono<FunctionsCreateFunctionResponse> createFunctionWithResponseAsync(FunctionInner function) {
8585
if (this.client.getEndpoint() == null) {
8686
return Mono.error(
8787
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
@@ -121,10 +121,10 @@ private Mono<FunctionInner> createFunctionAsync(FunctionInner function) {
121121
* @throws IllegalArgumentException thrown if parameters fail the validation.
122122
* @throws ManagementException thrown if the request is rejected by server.
123123
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
124-
* @return the response body along with {@link Response}.
124+
* @return the response.
125125
*/
126126
@ServiceMethod(returns = ReturnType.SINGLE)
127-
public Response<FunctionInner> createFunctionWithResponse(FunctionInner function, Context context) {
127+
public FunctionsCreateFunctionResponse createFunctionWithResponse(FunctionInner function, Context context) {
128128
if (this.client.getEndpoint() == null) {
129129
throw LOGGER.atError()
130130
.log(new IllegalArgumentException(

typespec-tests/src/main/java/tsptest/armstreamstyleserialization/implementation/FunctionsImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import tsptest.armstreamstyleserialization.fluent.models.FunctionInner;
1313
import tsptest.armstreamstyleserialization.models.Function;
1414
import tsptest.armstreamstyleserialization.models.Functions;
15+
import tsptest.armstreamstyleserialization.models.FunctionsCreateFunctionResponse;
1516

1617
public final class FunctionsImpl implements Functions {
1718
private static final ClientLogger LOGGER = new ClientLogger(FunctionsImpl.class);
@@ -27,7 +28,7 @@ public FunctionsImpl(FunctionsClient innerClient,
2728
}
2829

2930
public Response<Function> createFunctionWithResponse(FunctionInner function, Context context) {
30-
Response<FunctionInner> inner = this.serviceClient().createFunctionWithResponse(function, context);
31+
FunctionsCreateFunctionResponse inner = this.serviceClient().createFunctionWithResponse(function, context);
3132
if (inner != null) {
3233
return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
3334
new FunctionImpl(inner.getValue(), this.manager()));

typespec-tests/src/main/java/tsptest/armstreamstyleserialization/models/Functions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public interface Functions {
2020
* @throws IllegalArgumentException thrown if parameters fail the validation.
2121
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
2222
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
23-
* @return the response body along with {@link Response}.
23+
* @return the response.
2424
*/
2525
Response<Function> createFunctionWithResponse(FunctionInner function, Context context);
2626

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
// Code generated by Microsoft (R) TypeSpec Code Generator.
4+
5+
package tsptest.armstreamstyleserialization.models;
6+
7+
import com.azure.core.annotation.Immutable;
8+
import com.azure.core.http.HttpHeaderName;
9+
import com.azure.core.http.HttpHeaders;
10+
11+
/**
12+
* The FunctionsCreateFunctionHeaders model.
13+
*/
14+
@Immutable
15+
public final class FunctionsCreateFunctionHeaders {
16+
/*
17+
* The ETag property.
18+
*/
19+
private final String etag;
20+
21+
// HttpHeaders containing the raw property values.
22+
/**
23+
* Creates an instance of FunctionsCreateFunctionHeaders class.
24+
*
25+
* @param rawHeaders The raw HttpHeaders that will be used to create the property values.
26+
*/
27+
public FunctionsCreateFunctionHeaders(HttpHeaders rawHeaders) {
28+
this.etag = rawHeaders.getValue(HttpHeaderName.ETAG);
29+
}
30+
31+
/**
32+
* Get the etag property: The ETag property.
33+
*
34+
* @return the etag value.
35+
*/
36+
public String etag() {
37+
return this.etag;
38+
}
39+
40+
/**
41+
* Validates the instance.
42+
*
43+
* @throws IllegalArgumentException thrown if the instance is not valid.
44+
*/
45+
public void validate() {
46+
}
47+
}

0 commit comments

Comments
 (0)