Skip to content
Draft
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
83 changes: 58 additions & 25 deletions eng/emitter-package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion eng/emitter-package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"main": "dist/src/index.js",
"dependencies": {
"@azure-tools/typespec-java": "0.45.10"
"@azure-tools/typespec-java": "0.45.11"
},
"devDependencies": {
"@azure-tools/typespec-autorest": "0.70.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

package com.azure.resourcemanager.containerserviceaimanager.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.containerserviceaimanager.models.AIManagerNamespaceProperties;
import java.util.HashMap;
import java.util.Map;
import org.junit.jupiter.api.Assertions;

public final class AIManagerNamespacePropertiesTests {
@org.junit.jupiter.api.Test
public void testDeserialize() throws Exception {
AIManagerNamespaceProperties model = BinaryData.fromString(
"{\"provisioningState\":\"Updating\",\"labels\":{\"zuvccfwnfnbacfio\":\"w\",\"bxetqgtzxdpn\":\"l\",\"eallnwsubisnj\":\"bqqwxrj\",\"hcbonqvpkvlr\":\"mpmngnzscxaqwoo\"},\"annotations\":{\"eipheoflokeyy\":\"ea\",\"jp\":\"enjbdlwtgrhp\"}}")
.toObject(AIManagerNamespaceProperties.class);
Assertions.assertEquals("w", model.labels().get("zuvccfwnfnbacfio"));
Assertions.assertEquals("fakeTokenPlaceholder", model.annotations().get("eipheoflokeyy"));
}

@org.junit.jupiter.api.Test
public void testSerialize() throws Exception {
AIManagerNamespaceProperties model = new AIManagerNamespaceProperties()
.withLabels(mapOf("zuvccfwnfnbacfio", "w", "bxetqgtzxdpn", "l", "eallnwsubisnj", "bqqwxrj", "hcbonqvpkvlr",
"mpmngnzscxaqwoo"))
.withAnnotations(mapOf("eipheoflokeyy", "fakeTokenPlaceholder", "jp", "enjbdlwtgrhp"));
model = BinaryData.fromObject(model).toObject(AIManagerNamespaceProperties.class);
Assertions.assertEquals("w", model.labels().get("zuvccfwnfnbacfio"));
Assertions.assertEquals("fakeTokenPlaceholder", model.annotations().get("eipheoflokeyy"));
}

// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ public interface DocumentTranslationClientService {
@UnexpectedResponseExceptionType(HttpResponseException.class)
Mono<Response<Void>> translation(@HostParam("endpoint") String endpoint,
@QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType,
@BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context);
@HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body,
RequestOptions requestOptions, Context context);

@Post("/document/batches")
@ExpectedResponses({ 202 })
Expand All @@ -189,7 +190,8 @@ Mono<Response<Void>> translation(@HostParam("endpoint") String endpoint,
@UnexpectedResponseExceptionType(HttpResponseException.class)
Response<Void> translationSync(@HostParam("endpoint") String endpoint,
@QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType,
@BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context);
@HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData body,
RequestOptions requestOptions, Context context);

@Get("/document/batches")
@ExpectedResponses({ 200 })
Expand Down Expand Up @@ -430,8 +432,9 @@ Response<BinaryData> listDocumentStatusesNextSync(
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Void>> translationWithResponseAsync(BinaryData body, RequestOptions requestOptions) {
final String contentType = "application/json";
final String accept = "application/json";
return FluxUtil.withContext(context -> service.translation(this.getEndpoint(),
this.getServiceVersion().getVersion(), contentType, body, requestOptions, context));
this.getServiceVersion().getVersion(), contentType, accept, body, requestOptions, context));
}

/**
Expand Down Expand Up @@ -510,8 +513,9 @@ private Mono<Response<Void>> translationWithResponseAsync(BinaryData body, Reque
@ServiceMethod(returns = ReturnType.SINGLE)
private Response<Void> translationWithResponse(BinaryData body, RequestOptions requestOptions) {
final String contentType = "application/json";
return service.translationSync(this.getEndpoint(), this.getServiceVersion().getVersion(), contentType, body,
requestOptions, Context.NONE);
final String accept = "application/json";
return service.translationSync(this.getEndpoint(), this.getServiceVersion().getVersion(), contentType, accept,
body, requestOptions, Context.NONE);
}

/**
Expand Down
Loading