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
2 changes: 1 addition & 1 deletion core
Submodule core updated 255 files
7 changes: 7 additions & 0 deletions typespec-extension/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Release History

## 0.37.4 (2025-12-18)

Compatible with compiler 1.7.1.

- Updated TypeSpec dependencies (compiler 1.7.1) and refreshed dev dependencies.
- Supported ArrayEncoding on array properties in the HTTP client emitter.

## 0.37.3 (2025-12-12)

Compatible with compiler 1.7.0.
Expand Down
694 changes: 347 additions & 347 deletions typespec-extension/package-lock.json

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions typespec-extension/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@azure-tools/typespec-java",
"version": "0.37.3",
"version": "0.37.4",
"description": "TypeSpec library for emitting Java client from the TypeSpec REST protocol binding",
"keywords": [
"TypeSpec"
Expand Down Expand Up @@ -53,7 +53,7 @@
"@azure-tools/typespec-azure-rulesets": ">=0.63.0 <1.0.0",
"@azure-tools/typespec-client-generator-core": ">=0.63.0 <1.0.0",
"@azure-tools/typespec-liftr-base": ">=0.11.0 <1.0.0",
"@typespec/compiler": "^1.7.0",
"@typespec/compiler": "^1.7.1",
"@typespec/http": "^1.7.0",
"@typespec/openapi": "^1.7.0",
"@typespec/rest": ">=0.77.0 <1.0.0",
Expand All @@ -75,10 +75,10 @@
"@microsoft/api-extractor": "^7.55.2",
"@types/js-yaml": "~4.0.9",
"@types/lodash": "~4.17.21",
"@types/node": "~25.0.1",
"@typescript-eslint/eslint-plugin": "~8.49.0",
"@typescript-eslint/parser": "~8.49.0",
"@typespec/compiler": "1.7.0",
"@types/node": "~25.0.3",
"@typescript-eslint/eslint-plugin": "~8.50.0",
"@typescript-eslint/parser": "~8.50.0",
"@typespec/compiler": "1.7.1",
"@typespec/events": "0.77.0",
"@typespec/http": "1.7.0",
"@typespec/openapi": "1.7.0",
Expand All @@ -88,22 +88,22 @@
"@typespec/tspd": "0.73.2",
"@typespec/versioning": "0.77.0",
"@typespec/xml": "0.77.0",
"@vitest/coverage-v8": "^4.0.15",
"@vitest/ui": "^4.0.15",
"@vitest/coverage-v8": "^4.0.16",
"@vitest/ui": "^4.0.16",
"c8": "~10.1.3",
"eslint": "~9.39.1",
"eslint": "~9.39.2",
"eslint-plugin-deprecation": "~3.0.0",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-unicorn": "^62.0.0",
"prettier": "~3.7.4",
"rimraf": "~6.1.2",
"typescript": "~5.9.3",
"typescript-eslint": "^8.49.0",
"vitest": "^4.0.15"
"typescript-eslint": "^8.50.0",
"vitest": "^4.0.16"
},
"overrides": {
"eslint": "~9.39.1",
"@typescript-eslint/eslint-plugin": "~8.49.0",
"@typescript-eslint/parser": "~8.49.0"
"eslint": "~9.39.2",
"@typescript-eslint/eslint-plugin": "~8.50.0",
"@typescript-eslint/parser": "~8.50.0"
}
}
7 changes: 7 additions & 0 deletions typespec-extension/src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ export const EmitterOptionsSchema: JSONSchemaType<EmitterOptions> = {
nullable: true,
default: false,
},
"client-side-validations": {
type: "boolean",
description:
"When set to `true`, the model classes would be generated with a `validate()` API for validating required properties, during REST API invocation. Default value is `false`. This option is for backward-compatibility.",
nullable: true,
default: false,
},
"float32-as-double": {
type: "boolean",
description:
Expand Down
4 changes: 2 additions & 2 deletions typespec-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
"@typespec/spector": "0.1.0-alpha.21",
"@typespec/http-specs": "0.1.0-alpha.29",
"@azure-tools/azure-http-specs": "0.1.0-alpha.33",
"@azure-tools/typespec-java": "file:/../typespec-extension/azure-tools-typespec-java-0.37.3.tgz"
"@azure-tools/typespec-java": "file:/../typespec-extension/azure-tools-typespec-java-0.37.4.tgz"
},
"devDependencies": {
"@typespec/prettier-plugin-typespec": "^1.7.0",
"prettier-plugin-organize-imports": "^4.3.0",
"prettier": "^3.7.4"
},
"overrides": {
"@typespec/compiler": "1.7.0",
"@typespec/compiler": "1.7.1",
"@typespec/http": "1.7.0",
"@typespec/rest": "0.77.0",
"@typespec/versioning": "0.77.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;

/**
* The CommaDelimitedArrayProperty model.
Expand Down Expand Up @@ -51,7 +54,10 @@ public List<String> getValue() {
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeString(element));
if (this.value != null) {
jsonWriter.writeStringField("value",
this.value.stream().map(element -> element == null ? "" : element).collect(Collectors.joining(",")));
}
return jsonWriter.writeEndObject();
}

Expand All @@ -73,7 +79,12 @@ public static CommaDelimitedArrayProperty fromJson(JsonReader jsonReader) throws
reader.nextToken();

if ("value".equals(fieldName)) {
value = reader.readArray(reader1 -> reader1.getString());
String valueEncodedAsString = reader.getString();
value = valueEncodedAsString == null
? null
: valueEncodedAsString.isEmpty()
? new LinkedList<>()
: new LinkedList<>(Arrays.asList(valueEncodedAsString.split(",", -1)));
} else {
reader.skipChildren();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;

/**
* The NewlineDelimitedArrayProperty model.
Expand Down Expand Up @@ -51,7 +54,10 @@ public List<String> getValue() {
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeString(element));
if (this.value != null) {
jsonWriter.writeStringField("value",
this.value.stream().map(element -> element == null ? "" : element).collect(Collectors.joining("\n")));
}
return jsonWriter.writeEndObject();
}

Expand All @@ -73,7 +79,12 @@ public static NewlineDelimitedArrayProperty fromJson(JsonReader jsonReader) thro
reader.nextToken();

if ("value".equals(fieldName)) {
value = reader.readArray(reader1 -> reader1.getString());
String valueEncodedAsString = reader.getString();
value = valueEncodedAsString == null
? null
: valueEncodedAsString.isEmpty()
? new LinkedList<>()
: new LinkedList<>(Arrays.asList(valueEncodedAsString.split("\n", -1)));
} else {
reader.skipChildren();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;

/**
* The PipeDelimitedArrayProperty model.
Expand Down Expand Up @@ -51,7 +54,10 @@ public List<String> getValue() {
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeString(element));
if (this.value != null) {
jsonWriter.writeStringField("value",
this.value.stream().map(element -> element == null ? "" : element).collect(Collectors.joining("|")));
}
return jsonWriter.writeEndObject();
}

Expand All @@ -73,7 +79,12 @@ public static PipeDelimitedArrayProperty fromJson(JsonReader jsonReader) throws
reader.nextToken();

if ("value".equals(fieldName)) {
value = reader.readArray(reader1 -> reader1.getString());
String valueEncodedAsString = reader.getString();
value = valueEncodedAsString == null
? null
: valueEncodedAsString.isEmpty()
? new LinkedList<>()
: new LinkedList<>(Arrays.asList(valueEncodedAsString.split("\\|", -1)));
} else {
reader.skipChildren();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;

/**
* The SpaceDelimitedArrayProperty model.
Expand Down Expand Up @@ -51,7 +54,10 @@ public List<String> getValue() {
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeString(element));
if (this.value != null) {
jsonWriter.writeStringField("value",
this.value.stream().map(element -> element == null ? "" : element).collect(Collectors.joining(" ")));
}
return jsonWriter.writeEndObject();
}

Expand All @@ -73,7 +79,12 @@ public static SpaceDelimitedArrayProperty fromJson(JsonReader jsonReader) throws
reader.nextToken();

if ("value".equals(fieldName)) {
value = reader.readArray(reader1 -> reader1.getString());
String valueEncodedAsString = reader.getString();
value = valueEncodedAsString == null
? null
: valueEncodedAsString.isEmpty()
? new LinkedList<>()
: new LinkedList<>(Arrays.asList(valueEncodedAsString.split(" ", -1)));
} else {
reader.skipChildren();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ public final class BuiltinAsyncClient {
* unknownDurationFormat: String (Optional)
* unknownDateTimeFormat: String (Optional)
* unknownBytes: String (Optional)
* commaDeliminatedArray (Optional): [
* String (Optional)
* ]
* }
* uuid: String (Required)
* }
Expand Down Expand Up @@ -159,6 +162,9 @@ public Mono<Response<BinaryData>> readWithResponse(String queryParam, String que
* unknownDurationFormat: String (Optional)
* unknownDateTimeFormat: String (Optional)
* unknownBytes: String (Optional)
* commaDeliminatedArray (Optional): [
* String (Optional)
* ]
* }
* uuid: String (Required)
* }
Expand Down Expand Up @@ -239,4 +245,24 @@ public Mono<Builtin> read(String queryParam, String queryParamEncoded) {
return readWithResponse(queryParam, queryParamEncoded, requestOptions).flatMap(FluxUtil::toMono)
.map(protocolMethodData -> protocolMethodData.toObject(Builtin.class));
}

/**
* The write operation.
*
* @param body The body parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> write(Builtin body) {
// Generated convenience method for writeWithResponse
RequestOptions requestOptions = new RequestOptions();
return writeWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono);
}
}
25 changes: 25 additions & 0 deletions typespec-tests/src/main/java/tsptest/builtin/BuiltinClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ public final class BuiltinClient {
* unknownDurationFormat: String (Optional)
* unknownDateTimeFormat: String (Optional)
* unknownBytes: String (Optional)
* commaDeliminatedArray (Optional): [
* String (Optional)
* ]
* }
* uuid: String (Required)
* }
Expand Down Expand Up @@ -157,6 +160,9 @@ public Response<BinaryData> readWithResponse(String queryParam, String queryPara
* unknownDurationFormat: String (Optional)
* unknownDateTimeFormat: String (Optional)
* unknownBytes: String (Optional)
* commaDeliminatedArray (Optional): [
* String (Optional)
* ]
* }
* uuid: String (Required)
* }
Expand Down Expand Up @@ -235,4 +241,23 @@ public Builtin read(String queryParam, String queryParamEncoded) {
RequestOptions requestOptions = new RequestOptions();
return readWithResponse(queryParam, queryParamEncoded, requestOptions).getValue().toObject(Builtin.class);
}

/**
* The write operation.
*
* @param body The body parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
public void write(Builtin body) {
// Generated convenience method for writeWithResponse
RequestOptions requestOptions = new RequestOptions();
writeWithResponse(BinaryData.fromObject(body), requestOptions).getValue();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ Response<Void> writeSync(@HostParam("endpoint") String endpoint,
* unknownDurationFormat: String (Optional)
* unknownDateTimeFormat: String (Optional)
* unknownBytes: String (Optional)
* commaDeliminatedArray (Optional): [
* String (Optional)
* ]
* }
* uuid: String (Required)
* }
Expand Down Expand Up @@ -236,6 +239,9 @@ public Mono<Response<BinaryData>> readWithResponseAsync(String queryParam, Strin
* unknownDurationFormat: String (Optional)
* unknownDateTimeFormat: String (Optional)
* unknownBytes: String (Optional)
* commaDeliminatedArray (Optional): [
* String (Optional)
* ]
* }
* uuid: String (Required)
* }
Expand Down Expand Up @@ -299,6 +305,9 @@ public Response<BinaryData> readWithResponse(String queryParam, String queryPara
* unknownDurationFormat: String (Optional)
* unknownDateTimeFormat: String (Optional)
* unknownBytes: String (Optional)
* commaDeliminatedArray (Optional): [
* String (Optional)
* ]
* }
* uuid: String (Required)
* }
Expand Down Expand Up @@ -360,6 +369,9 @@ public Mono<Response<Void>> writeWithResponseAsync(BinaryData body, RequestOptio
* unknownDurationFormat: String (Optional)
* unknownDateTimeFormat: String (Optional)
* unknownBytes: String (Optional)
* commaDeliminatedArray (Optional): [
* String (Optional)
* ]
* }
* uuid: String (Required)
* }
Expand Down
Loading