Skip to content

Commit 4412f33

Browse files
Merge branch 'main' into eng_add-suppress-from-typespec
2 parents b6e9dab + 67801a3 commit 4412f33

File tree

70 files changed

+409
-413
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+409
-413
lines changed

core

Submodule core updated 67 files

fluentgen/readme.md

+1
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,5 @@ client-flattened-annotation-target: none
7777
null-byte-array-maps-to-empty-array: true
7878
graal-vm-config: true
7979
stream-style-serialization: true
80+
use-object-for-unknown: true
8081
```

fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/TestUtils.java

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public static class MockFluentGen extends FluentGen {
5555
DEFAULT_SETTINGS.put("generate-samples", true);
5656
DEFAULT_SETTINGS.put("generate-tests", true);
5757
DEFAULT_SETTINGS.put("client-flattened-annotation-target", "NONE");
58+
DEFAULT_SETTINGS.put("use-object-for-unknown", true);
5859
}
5960

6061
private Javagen javagen;

javagen/data-plane.md

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ enable-sync-stack: true
1414
required-fields-as-ctor-args: true
1515
enable-page-size: true
1616
use-key-credential: true
17+
use-object-for-unknown: true
1718

1819
use-default-http-status-code-to-exception-type-mapping: true
1920
polling: {}

javagen/readme.md

+2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ modelerfour:
4848
flatten-models: true
4949
flatten-payloads: true
5050
group-parameters: true
51+
52+
use-object-for-unknown: true
5153
```
5254
5355
```yaml $(data-plane)

javagen/src/main/resources/data-plane.md

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ enable-sync-stack: true
1414
required-fields-as-ctor-args: true
1515
enable-page-size: true
1616
use-key-credential: true
17+
use-object-for-unknown: true
1718

1819
use-default-http-status-code-to-exception-type-mapping: true
1920
polling: {}

typespec-extension/changelog.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Release History
22

3+
## 0.23.0 (2024-11-07)
4+
5+
Compatible with compiler 0.61.
6+
7+
- Changed to use Java class `BinaryData` for TypeSpec `unknown`.
8+
39
## 0.22.1 (2024-10-21)
410

511
Compatible with compiler 0.61.

typespec-extension/package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

typespec-extension/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@azure-tools/typespec-java",
3-
"version": "0.22.1",
3+
"version": "0.23.0",
44
"description": "TypeSpec library for emitting Java client from the TypeSpec REST protocol binding",
55
"keywords": [
66
"TypeSpec"

typespec-tests/Generate.ps1

+4
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ $generateScript = {
5858
$tspOptions += " --option ""@azure-tools/typespec-java.api-version=2022-09-01"""
5959
# exclude preview from service versions
6060
$tspOptions += " --option ""@azure-tools/typespec-java.service-version-exclude-preview=true"""
61+
} elseif ($tspFile -match "type[\\/]array" -or $tspFile -match "type[\\/]dictionary") {
62+
# TODO https://github.com/Azure/autorest.java/issues/2964
63+
# also serve as a test for "use-object-for-unknown" emitter option
64+
$tspOptions += " --option ""@azure-tools/typespec-java.use-object-for-unknown=true"""
6165
} elseif ($tspFile -match "arm.tsp") {
6266
# for mgmt, do not generate tests due to random mock values
6367
$tspOptions += " --option ""@azure-tools/typespec-java.generate-tests=false"""

typespec-tests/Setup.ps1

+11-10
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,23 @@ param (
33
[switch] $RebuildJar = $false
44
)
55

6+
Set-Location $PSScriptRoot
7+
68
if ($RebuildJar) {
7-
mvn clean install -f ../pom.xml -P local,tsp -DskipTests "-Djacoco.skip"
9+
Set-Location ../
10+
./Build-TypeSpec.ps1
11+
} else {
12+
Set-Location ../typespec-extension/
13+
# re-build typespec-java
14+
npm ci
15+
npm run build
16+
npm run lint
17+
npm pack
818
if ($LASTEXITCODE -ne 0) {
919
exit $LASTEXITCODE
1020
}
1121
}
1222

13-
# re-build typespec-java
14-
Set-Location ../typespec-extension/
15-
# Remove-Item node_modules -Recurse -Force
16-
# Remove-Item package-lock.json
17-
npm ci
18-
npm run build
19-
npm run lint
20-
npm pack
21-
2223
# re-install
2324
Set-Location ../typespec-tests/
2425
if (Test-Path node_modules) {

typespec-tests/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
"dependencies": {
1212
"@azure-tools/cadl-ranch-specs": "0.38.0",
13-
"@azure-tools/typespec-java": "file:/../typespec-extension/azure-tools-typespec-java-0.22.1.tgz"
13+
"@azure-tools/typespec-java": "file:/../typespec-extension/azure-tools-typespec-java-0.23.0.tgz"
1414
},
1515
"devDependencies": {
1616
"@typespec/prettier-plugin-typespec": "~0.61.0",

typespec-tests/src/main/java/com/type/model/inheritance/enumnesteddiscriminator/EnumNestedDiscriminatorClientBuilder.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -218,16 +218,16 @@ public EnumNestedDiscriminatorClientBuilder retryPolicy(RetryPolicy retryPolicy)
218218
private EnumNestedDiscriminatorClientImpl buildInnerClient() {
219219
this.validateClient();
220220
HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline();
221-
String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000";
222221
EnumNestedDiscriminatorClientImpl client = new EnumNestedDiscriminatorClientImpl(localPipeline,
223-
JacksonAdapter.createDefaultSerializerAdapter(), localEndpoint);
222+
JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint);
224223
return client;
225224
}
226225

227226
@Generated
228227
private void validateClient() {
229228
// This method is invoked from 'buildInnerClient'/'buildClient' method.
230229
// Developer can customize this method, to validate that the necessary conditions are met for the new client.
230+
Objects.requireNonNull(endpoint, "'endpoint' cannot be null.");
231231
}
232232

233233
@Generated

typespec-tests/src/main/java/com/type/property/additionalproperties/ExtendsUnknownAsyncClient.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public final class ExtendsUnknownAsyncClient {
4747
* {
4848
* name: String (Required)
4949
* (Optional): {
50-
* String: Object (Required)
50+
* String: BinaryData (Required)
5151
* }
5252
* }
5353
* }
@@ -75,7 +75,7 @@ public Mono<Response<BinaryData>> getWithResponse(RequestOptions requestOptions)
7575
* {
7676
* name: String (Required)
7777
* (Optional): {
78-
* String: Object (Required)
78+
* String: BinaryData (Required)
7979
* }
8080
* }
8181
* }

typespec-tests/src/main/java/com/type/property/additionalproperties/ExtendsUnknownClient.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public final class ExtendsUnknownClient {
4545
* {
4646
* name: String (Required)
4747
* (Optional): {
48-
* String: Object (Required)
48+
* String: BinaryData (Required)
4949
* }
5050
* }
5151
* }
@@ -73,7 +73,7 @@ public Response<BinaryData> getWithResponse(RequestOptions requestOptions) {
7373
* {
7474
* name: String (Required)
7575
* (Optional): {
76-
* String: Object (Required)
76+
* String: BinaryData (Required)
7777
* }
7878
* }
7979
* }

typespec-tests/src/main/java/com/type/property/additionalproperties/ExtendsUnknownDerivedAsyncClient.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public final class ExtendsUnknownDerivedAsyncClient {
4747
* {
4848
* name: String (Required)
4949
* (Optional): {
50-
* String: Object (Required)
50+
* String: BinaryData (Required)
5151
* }
5252
* index: int (Required)
5353
* age: Double (Optional)
@@ -77,7 +77,7 @@ public Mono<Response<BinaryData>> getWithResponse(RequestOptions requestOptions)
7777
* {
7878
* name: String (Required)
7979
* (Optional): {
80-
* String: Object (Required)
80+
* String: BinaryData (Required)
8181
* }
8282
* index: int (Required)
8383
* age: Double (Optional)

typespec-tests/src/main/java/com/type/property/additionalproperties/ExtendsUnknownDerivedClient.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public final class ExtendsUnknownDerivedClient {
4545
* {
4646
* name: String (Required)
4747
* (Optional): {
48-
* String: Object (Required)
48+
* String: BinaryData (Required)
4949
* }
5050
* index: int (Required)
5151
* age: Double (Optional)
@@ -75,7 +75,7 @@ public Response<BinaryData> getWithResponse(RequestOptions requestOptions) {
7575
* {
7676
* name: String (Required)
7777
* (Optional): {
78-
* String: Object (Required)
78+
* String: BinaryData (Required)
7979
* }
8080
* index: int (Required)
8181
* age: Double (Optional)

typespec-tests/src/main/java/com/type/property/additionalproperties/ExtendsUnknownDiscriminatedAsyncClient.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public final class ExtendsUnknownDiscriminatedAsyncClient {
4848
* kind: String (Required)
4949
* name: String (Required)
5050
* (Optional): {
51-
* String: Object (Required)
51+
* String: BinaryData (Required)
5252
* }
5353
* }
5454
* }
@@ -77,7 +77,7 @@ public Mono<Response<BinaryData>> getWithResponse(RequestOptions requestOptions)
7777
* kind: String (Required)
7878
* name: String (Required)
7979
* (Optional): {
80-
* String: Object (Required)
80+
* String: BinaryData (Required)
8181
* }
8282
* }
8383
* }

typespec-tests/src/main/java/com/type/property/additionalproperties/ExtendsUnknownDiscriminatedClient.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public final class ExtendsUnknownDiscriminatedClient {
4646
* kind: String (Required)
4747
* name: String (Required)
4848
* (Optional): {
49-
* String: Object (Required)
49+
* String: BinaryData (Required)
5050
* }
5151
* }
5252
* }
@@ -75,7 +75,7 @@ public Response<BinaryData> getWithResponse(RequestOptions requestOptions) {
7575
* kind: String (Required)
7676
* name: String (Required)
7777
* (Optional): {
78-
* String: Object (Required)
78+
* String: BinaryData (Required)
7979
* }
8080
* }
8181
* }

typespec-tests/src/main/java/com/type/property/additionalproperties/IsUnknownAsyncClient.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public final class IsUnknownAsyncClient {
4747
* {
4848
* name: String (Required)
4949
* (Optional): {
50-
* String: Object (Required)
50+
* String: BinaryData (Required)
5151
* }
5252
* }
5353
* }
@@ -75,7 +75,7 @@ public Mono<Response<BinaryData>> getWithResponse(RequestOptions requestOptions)
7575
* {
7676
* name: String (Required)
7777
* (Optional): {
78-
* String: Object (Required)
78+
* String: BinaryData (Required)
7979
* }
8080
* }
8181
* }

typespec-tests/src/main/java/com/type/property/additionalproperties/IsUnknownClient.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public final class IsUnknownClient {
4545
* {
4646
* name: String (Required)
4747
* (Optional): {
48-
* String: Object (Required)
48+
* String: BinaryData (Required)
4949
* }
5050
* }
5151
* }
@@ -73,7 +73,7 @@ public Response<BinaryData> getWithResponse(RequestOptions requestOptions) {
7373
* {
7474
* name: String (Required)
7575
* (Optional): {
76-
* String: Object (Required)
76+
* String: BinaryData (Required)
7777
* }
7878
* }
7979
* }

typespec-tests/src/main/java/com/type/property/additionalproperties/IsUnknownDerivedAsyncClient.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public final class IsUnknownDerivedAsyncClient {
4747
* {
4848
* name: String (Required)
4949
* (Optional): {
50-
* String: Object (Required)
50+
* String: BinaryData (Required)
5151
* }
5252
* index: int (Required)
5353
* age: Double (Optional)
@@ -77,7 +77,7 @@ public Mono<Response<BinaryData>> getWithResponse(RequestOptions requestOptions)
7777
* {
7878
* name: String (Required)
7979
* (Optional): {
80-
* String: Object (Required)
80+
* String: BinaryData (Required)
8181
* }
8282
* index: int (Required)
8383
* age: Double (Optional)

typespec-tests/src/main/java/com/type/property/additionalproperties/IsUnknownDerivedClient.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public final class IsUnknownDerivedClient {
4545
* {
4646
* name: String (Required)
4747
* (Optional): {
48-
* String: Object (Required)
48+
* String: BinaryData (Required)
4949
* }
5050
* index: int (Required)
5151
* age: Double (Optional)
@@ -75,7 +75,7 @@ public Response<BinaryData> getWithResponse(RequestOptions requestOptions) {
7575
* {
7676
* name: String (Required)
7777
* (Optional): {
78-
* String: Object (Required)
78+
* String: BinaryData (Required)
7979
* }
8080
* index: int (Required)
8181
* age: Double (Optional)

typespec-tests/src/main/java/com/type/property/additionalproperties/IsUnknownDiscriminatedAsyncClient.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public final class IsUnknownDiscriminatedAsyncClient {
4848
* kind: String (Required)
4949
* name: String (Required)
5050
* (Optional): {
51-
* String: Object (Required)
51+
* String: BinaryData (Required)
5252
* }
5353
* }
5454
* }
@@ -77,7 +77,7 @@ public Mono<Response<BinaryData>> getWithResponse(RequestOptions requestOptions)
7777
* kind: String (Required)
7878
* name: String (Required)
7979
* (Optional): {
80-
* String: Object (Required)
80+
* String: BinaryData (Required)
8181
* }
8282
* }
8383
* }

typespec-tests/src/main/java/com/type/property/additionalproperties/IsUnknownDiscriminatedClient.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public final class IsUnknownDiscriminatedClient {
4646
* kind: String (Required)
4747
* name: String (Required)
4848
* (Optional): {
49-
* String: Object (Required)
49+
* String: BinaryData (Required)
5050
* }
5151
* }
5252
* }
@@ -75,7 +75,7 @@ public Response<BinaryData> getWithResponse(RequestOptions requestOptions) {
7575
* kind: String (Required)
7676
* name: String (Required)
7777
* (Optional): {
78-
* String: Object (Required)
78+
* String: BinaryData (Required)
7979
* }
8080
* }
8181
* }

0 commit comments

Comments
 (0)