diff --git a/.chronus/changes/http-client-java-fix-xml-serializer-bytes-2026-7-22-0-21-49.md b/.chronus/changes/http-client-java-fix-xml-serializer-bytes-2026-7-22-0-21-49.md new file mode 100644 index 00000000000..3a5675d2799 --- /dev/null +++ b/.chronus/changes/http-client-java-fix-xml-serializer-bytes-2026-7-22-0-21-49.md @@ -0,0 +1,7 @@ +--- +changeKind: fix +packages: + - "@typespec/http-client-java" +--- + +Fix XML serialization to only apply for `azure-v1` data-plane clients, and to skip the XML `ObjectSerializer` for raw `byte[]`/`BinaryData` payloads that are not structured XML models. This avoids emitting a reference to a non-generated `XmlSerializerProviders` helper (which caused a build break) for operations that return raw XML bytes. diff --git a/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/template/ConvenienceAsyncMethodTemplate.java b/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/template/ConvenienceAsyncMethodTemplate.java index d570ae7e08e..5cdce809348 100644 --- a/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/template/ConvenienceAsyncMethodTemplate.java +++ b/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/template/ConvenienceAsyncMethodTemplate.java @@ -66,8 +66,8 @@ protected void writeInvocationAndConversion(ClientMethod convenienceMethod, Clie ClientMethodType methodType = protocolMethod.getType(); - IType responseBodyType = getResponseBodyType(convenienceMethod); - IType protocolResponseBodyType = getResponseBodyType(protocolMethod); + IType responseBodyType = getConvenienceResponseBodyType(convenienceMethod); + IType protocolResponseBodyType = getConvenienceResponseBodyType(protocolMethod); IType rawResponseBodyType = convenienceMethod.getProxyMethod().getRawResponseBodyType(); if (methodType == ClientMethodType.PagingAsync) { @@ -120,17 +120,6 @@ protected void writeThrowException(ClientMethodType methodType, String exception } } - private IType getResponseBodyType(ClientMethod method) { - // no need to care about LRO - // Mono / PagedFlux - IType type = ((GenericType) method.getReturnValue().getType()).getTypeArguments()[0]; - if (type instanceof GenericType && ClassType.RESPONSE.getName().equals(((GenericType) type).getName())) { - // Mono> - type = ((GenericType) type).getTypeArguments()[0]; - } - return type; - } - private String expressionConvertFromBinaryData(IType responseBodyType, IType rawType, Set mediaTypes, Set typeReferenceStaticClasses) { String expressionMapFromBinaryData @@ -146,7 +135,7 @@ private String expressionConvertFromBinaryData(IType responseBodyType, IType raw private String expressionMapFromBinaryData(IType responseBodyType, IType rawType, Set mediaTypes, Set typeReferenceStaticClasses) { SupportedMimeType mimeType = SupportedMimeType.getResponseKnownMimeType(mediaTypes); - String serializerArgument = xmlSerializerArgument(mimeType); + String serializerArgument = xmlSerializerArgument(mimeType, responseBodyType); switch (mimeType) { case TEXT: String baseHandling = "protocolMethodData.toString()"; diff --git a/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/template/ConvenienceMethodTemplateBase.java b/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/template/ConvenienceMethodTemplateBase.java index 4190388e18a..763883cb83a 100644 --- a/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/template/ConvenienceMethodTemplateBase.java +++ b/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/template/ConvenienceMethodTemplateBase.java @@ -14,6 +14,7 @@ import com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.RequestParameterLocation; import com.microsoft.typespec.http.client.generator.core.extension.plugin.JavaSettings; import com.microsoft.typespec.http.client.generator.core.model.clientmodel.Annotation; +import com.microsoft.typespec.http.client.generator.core.model.clientmodel.ArrayType; import com.microsoft.typespec.http.client.generator.core.model.clientmodel.ClassType; import com.microsoft.typespec.http.client.generator.core.model.clientmodel.ClientMethod; import com.microsoft.typespec.http.client.generator.core.model.clientmodel.ClientMethodParameter; @@ -32,6 +33,7 @@ import com.microsoft.typespec.http.client.generator.core.model.clientmodel.ParameterTransformation; import com.microsoft.typespec.http.client.generator.core.model.clientmodel.ParameterTransformations; import com.microsoft.typespec.http.client.generator.core.model.clientmodel.PrimitiveType; +import com.microsoft.typespec.http.client.generator.core.model.clientmodel.ProxyMethod; import com.microsoft.typespec.http.client.generator.core.model.clientmodel.ProxyMethodParameter; import com.microsoft.typespec.http.client.generator.core.model.javamodel.JavaBlock; import com.microsoft.typespec.http.client.generator.core.model.javamodel.JavaClass; @@ -63,20 +65,51 @@ abstract class ConvenienceMethodTemplateBase { // Name of the static ObjectSerializer member used for XML serialization on the convenience client. - static final String XML_SERIALIZER_MEMBER_NAME = "SERIALIZER"; + static final String XML_SERIALIZER_MEMBER_NAME = "XML_SERIALIZER"; protected ConvenienceMethodTemplateBase() { } + /** + * Whether XML serialization via an explicit {@link com.azure.core.util.serializer.ObjectSerializer} is supported. + * It is only required for the azure-core (v1) data-plane flavor; management (Fluent) and vanilla clients, as well + * as + * the azure-core v2 / clientcore flavor, are excluded. + * + * @return whether XML serialization via an explicit serializer is supported. + */ + static boolean isXmlSerializationSupported() { + JavaSettings settings = JavaSettings.getInstance(); + return settings.isAzureV1() && settings.isDataPlaneClient(); + } + + /** + * Whether the given payload type is serialized/deserialized as a model when the payload is XML. Raw binary payloads + * ({@code byte[]}, {@code Base64Url}, {@link com.azure.core.util.BinaryData}) are passed through as-is and do not + * involve model serialization, so the XML {@link com.azure.core.util.serializer.ObjectSerializer} must not be used + * for them. + * + * @param type the payload (request body or response body) type. + * @return whether the type is serialized as a model. + */ + static boolean isXmlSerializableType(IType type) { + return type != null + && type != ClassType.BINARY_DATA + && type != ArrayType.BYTE_ARRAY + && type != ClassType.BASE_64_URL; + } + /** * Whether the XML {@link com.azure.core.util.serializer.ObjectSerializer} overload should be used for the given - * MIME type. XML serialization via an explicit serializer is only required for the azure-core (v1) flavor. + * MIME type and payload type. XML serialization via an explicit serializer is only required for the azure-core (v1) + * data-plane flavor, and only when the payload is an actual model (not a raw binary payload). * * @param mimeType the MIME type. + * @param type the payload (request body or response body) type. * @return whether to use the XML serializer overload of {@code toObject}/{@code fromObject}. */ - static boolean useXmlObjectSerializer(SupportedMimeType mimeType) { - return mimeType == SupportedMimeType.XML && JavaSettings.getInstance().isAzureV1(); + static boolean useXmlObjectSerializer(SupportedMimeType mimeType, IType type) { + return mimeType == SupportedMimeType.XML && isXmlSerializationSupported() && isXmlSerializableType(type); } /** @@ -84,44 +117,103 @@ static boolean useXmlObjectSerializer(SupportedMimeType mimeType) { * the XML serializer overload should be used, or an empty string otherwise. * * @param mimeType the MIME type. + * @param type the payload (request body or response body) type. * @return the serializer argument, possibly empty. */ - static String xmlSerializerArgument(SupportedMimeType mimeType) { - return useXmlObjectSerializer(mimeType) ? ", " + XML_SERIALIZER_MEMBER_NAME : ""; + static String xmlSerializerArgument(SupportedMimeType mimeType, IType type) { + return useXmlObjectSerializer(mimeType, type) ? ", " + XML_SERIALIZER_MEMBER_NAME : ""; } /** * Whether any of the convenience methods requires XML serialization (request or response). Used to decide whether - * the convenience client needs a static XML serializer member. Only applicable to the azure-core (v1) flavor. + * the convenience client needs a static XML serializer member. Only applicable to the azure-core (v1) data-plane + * flavor. * * @param convenienceMethods the convenience methods on the client. * @return whether a static XML serializer member is required. */ public boolean useXmlSerializerMember(Collection convenienceMethods) { - if (!JavaSettings.getInstance().isAzureV1() || convenienceMethods == null) { + if (!isXmlSerializationSupported() || convenienceMethods == null) { return false; } for (ConvenienceMethod convenienceMethod : convenienceMethods) { if (!isMethodIncluded(convenienceMethod)) { continue; } + ProxyMethod proxyMethod = convenienceMethod.getProtocolMethod().getProxyMethod(); // getResponseKnownMimeType simply parses a MIME string, so it is reused here for the request content type. - String requestContentType = convenienceMethod.getProtocolMethod().getProxyMethod().getRequestContentType(); - if (requestContentType != null - && SupportedMimeType.getResponseKnownMimeType(List.of(requestContentType)) == SupportedMimeType.XML) { - return true; - } - Set responseContentTypes - = convenienceMethod.getProtocolMethod().getProxyMethod().getResponseContentTypes(); - if (responseContentTypes != null + String requestContentType = proxyMethod.getRequestContentType(); + boolean xmlRequest = requestContentType != null + && SupportedMimeType.getResponseKnownMimeType(List.of(requestContentType)) == SupportedMimeType.XML; + Set responseContentTypes = proxyMethod.getResponseContentTypes(); + boolean xmlResponse = responseContentTypes != null && !responseContentTypes.isEmpty() - && SupportedMimeType.getResponseKnownMimeType(responseContentTypes) == SupportedMimeType.XML) { - return true; + && SupportedMimeType.getResponseKnownMimeType(responseContentTypes) == SupportedMimeType.XML; + if (!xmlRequest && !xmlResponse) { + continue; + } + // Inspect the convenience method body types (models), not the protocol method (which uses BinaryData). The + // XML serializer is only needed when an actual model is serialized/deserialized as XML. + for (ClientMethod method : convenienceMethod.getConvenienceMethods()) { + if (!isMethodIncluded(method)) { + continue; + } + if (xmlResponse && isXmlSerializableType(getConvenienceResponseBodyType(method))) { + return true; + } + if (xmlRequest && isXmlSerializableType(getConvenienceRequestBodyType(method))) { + return true; + } } } return false; } + /** + * Gets the (unwrapped) response body type of a convenience method, peeling reactive and response wrappers such as + * {@code Mono}, {@code Response}, {@code ResponseBase}, {@code PagedIterable} and {@code PagedFlux}. + * + * @param method the convenience method. + * @return the response body type. + */ + protected static IType getConvenienceResponseBodyType(ClientMethod method) { + IType type = method.getReturnValue().getType(); + while (type instanceof GenericType) { + GenericType genericType = (GenericType) type; + String name = genericType.getName(); + IType[] typeArguments = genericType.getTypeArguments(); + if ((ClassType.MONO.getName().equals(name) + || ClassType.FLUX.getName().equals(name) + || ClassType.RESPONSE.getName().equals(name) + || ClassType.PAGED_ITERABLE.getName().equals(name) + || ClassType.PAGED_FLUX.getName().equals(name)) && typeArguments.length >= 1) { + type = typeArguments[0]; + } else if ((ClassType.RESPONSE_BASE.getName().equals(name) + || ClassType.PAGED_RESPONSE_BASE.getName().equals(name)) && typeArguments.length >= 2) { + type = typeArguments[1]; + } else { + break; + } + } + return type; + } + + /** + * Gets the client type of the request body (BODY location) parameter of a convenience method, or {@code null} if + * the method has no request body. + * + * @param method the convenience method. + * @return the request body type, or {@code null}. + */ + private static IType getConvenienceRequestBodyType(ClientMethod method) { + return method.getMethodParameters() + .stream() + .filter(p -> p.getRequestParameterLocation() == RequestParameterLocation.BODY) + .map(ClientMethodParameter::getClientType) + .findFirst() + .orElse(null); + } + public void write(ConvenienceMethod convenienceMethodObj, JavaClass classBlock, Set typeReferenceStaticClasses) { if (!isMethodIncluded(convenienceMethodObj)) { @@ -627,7 +719,7 @@ private static String expressionConvertToBinaryData(String name, IType type, Str default: // JSON, XML etc. - String serializerArgument = xmlSerializerArgument(mimeType); + String serializerArgument = xmlSerializerArgument(mimeType, type); if (type == ClassType.BINARY_DATA) { return name; } else { diff --git a/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/template/ConvenienceSyncMethodTemplate.java b/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/template/ConvenienceSyncMethodTemplate.java index 31077ede545..9dfbf18d472 100644 --- a/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/template/ConvenienceSyncMethodTemplate.java +++ b/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/template/ConvenienceSyncMethodTemplate.java @@ -86,8 +86,8 @@ protected void writeMethodImplementation(ClientMethod protocolMethod, ClientMeth protected void writeInvocationAndConversion(ClientMethod convenienceMethod, ClientMethod protocolMethod, String invocationExpression, JavaBlock methodBlock, Set typeReferenceStaticClasses) { - IType responseBodyType = getResponseBodyType(convenienceMethod); - IType protocolResponseBodyType = getResponseBodyType(protocolMethod); + IType responseBodyType = getConvenienceResponseBodyType(convenienceMethod); + IType protocolResponseBodyType = getConvenienceResponseBodyType(protocolMethod); IType rawResponseBodyType = convenienceMethod.getProxyMethod().getRawResponseBodyType(); String convertFromResponse @@ -184,20 +184,6 @@ private String getProtocolMethodResponseStatement(ClientMethod protocolMethod, S statement); } - private IType getResponseBodyType(ClientMethod method) { - // no need to care about LRO - IType type = method.getReturnValue().getType(); - if (type instanceof GenericType - && (ClassType.RESPONSE.getName().equals(((GenericType) type).getName()) - || (ClassType.PAGED_ITERABLE.getName().equals(((GenericType) type).getName())))) { - type = ((GenericType) type).getTypeArguments()[0]; - } else if (isResponseBase(type)) { - // TODO: ResponseBase is not in use, hence it may have bug - type = ((GenericType) type).getTypeArguments()[1]; - } - return type; - } - private boolean isResponseBase(IType type) { return type instanceof GenericType && ClassType.RESPONSE_BASE.getName().equals(((GenericType) type).getName()); } @@ -205,7 +191,7 @@ private boolean isResponseBase(IType type) { private String expressionConvertFromBinaryData(IType responseBodyType, IType rawType, String invocationExpression, Set mediaTypes, Set typeReferenceStaticClasses) { SupportedMimeType mimeType = SupportedMimeType.getResponseKnownMimeType(mediaTypes); - String serializerArgument = xmlSerializerArgument(mimeType); + String serializerArgument = xmlSerializerArgument(mimeType, responseBodyType); switch (mimeType) { case TEXT: String basicText = invocationExpression + ".toString()"; diff --git a/packages/http-client-java/generator/http-client-generator-core/src/test/java/com/microsoft/typespec/http/client/generator/core/template/ConvenienceMethodTemplateBaseTests.java b/packages/http-client-java/generator/http-client-generator-core/src/test/java/com/microsoft/typespec/http/client/generator/core/template/ConvenienceMethodTemplateBaseTests.java new file mode 100644 index 00000000000..dc43e9f71ec --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-core/src/test/java/com/microsoft/typespec/http/client/generator/core/template/ConvenienceMethodTemplateBaseTests.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.typespec.http.client.generator.core.template; + +import com.microsoft.typespec.http.client.generator.core.model.clientmodel.ArrayType; +import com.microsoft.typespec.http.client.generator.core.model.clientmodel.ClassType; +import com.microsoft.typespec.http.client.generator.core.model.clientmodel.ClientMethod; +import com.microsoft.typespec.http.client.generator.core.model.clientmodel.GenericType; +import com.microsoft.typespec.http.client.generator.core.model.clientmodel.IType; +import com.microsoft.typespec.http.client.generator.core.model.clientmodel.ReturnValue; +import java.util.List; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class ConvenienceMethodTemplateBaseTests { + + @Test + public void unwrapsMonoResponse() { + IType leaf = ClassType.STRING; + IType returnType = GenericType.mono(GenericType.response(leaf)); + + IType result = ConvenienceMethodTemplateBase.getConvenienceResponseBodyType(methodWithReturnType(returnType)); + + Assertions.assertSame(leaf, result); + } + + @Test + public void unwrapsPagedFlux() { + IType leaf = ClassType.BINARY_DATA; + IType returnType = GenericType.pagedFlux(leaf); + + IType result = ConvenienceMethodTemplateBase.getConvenienceResponseBodyType(methodWithReturnType(returnType)); + + Assertions.assertSame(leaf, result); + } + + @Test + public void unwrapsResponseBaseSecondTypeArgument() { + IType leaf = ClassType.INTEGER; + IType returnType = GenericType.restResponse(ClassType.BINARY_DATA, leaf); + + IType result = ConvenienceMethodTemplateBase.getConvenienceResponseBodyType(methodWithReturnType(returnType)); + + Assertions.assertSame(leaf, result); + } + + @Test + public void unwrapsNestedMonoPagedResponseBase() { + IType leaf = ArrayType.BYTE_ARRAY; + IType pagedResponseBase = new GenericType(ClassType.PAGED_RESPONSE_BASE.getPackage(), + ClassType.PAGED_RESPONSE_BASE.getName(), ClassType.STRING, leaf); + IType returnType = GenericType.mono(pagedResponseBase); + + IType result = ConvenienceMethodTemplateBase.getConvenienceResponseBodyType(methodWithReturnType(returnType)); + + Assertions.assertSame(leaf, result); + } + + @Test + public void keepsNonGenericTypeUnchanged() { + IType returnType = ClassType.BASE_64_URL; + + IType result = ConvenienceMethodTemplateBase.getConvenienceResponseBodyType(methodWithReturnType(returnType)); + + Assertions.assertSame(returnType, result); + } + + private static ClientMethod methodWithReturnType(IType returnType) { + return new ClientMethod.Builder().name("test") + .description("test") + .parameters(List.of()) + .returnValue(new ReturnValue("test", returnType)) + .build(); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithArrayOfModelValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithArrayOfModelValueAsyncClient.java index 81c19204a4e..babb0ce6830 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithArrayOfModelValueAsyncClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithArrayOfModelValueAsyncClient.java @@ -28,7 +28,7 @@ @ServiceClient(builder = XmlClientBuilder.class, isAsync = true) public final class ModelWithArrayOfModelValueAsyncClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithArrayOfModelValuesImpl serviceClient; @@ -120,7 +120,7 @@ public Mono get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ModelWithArrayOfModel.class, SERIALIZER)); + .map(protocolMethodData -> protocolMethodData.toObject(ModelWithArrayOfModel.class, XML_SERIALIZER)); } /** @@ -140,6 +140,6 @@ public Mono get() { public Mono put(ModelWithArrayOfModel input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); + return putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithArrayOfModelValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithArrayOfModelValueClient.java index 0ea9f55070e..3744c0aab86 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithArrayOfModelValueClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithArrayOfModelValueClient.java @@ -26,7 +26,7 @@ @ServiceClient(builder = XmlClientBuilder.class) public final class ModelWithArrayOfModelValueClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithArrayOfModelValuesImpl serviceClient; @@ -117,7 +117,7 @@ public Response putWithResponse(BinaryData input, RequestOptions requestOp public ModelWithArrayOfModel get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(ModelWithArrayOfModel.class, SERIALIZER); + return getWithResponse(requestOptions).getValue().toObject(ModelWithArrayOfModel.class, XML_SERIALIZER); } /** @@ -136,6 +136,6 @@ public ModelWithArrayOfModel get() { public void put(ModelWithArrayOfModel input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).getValue(); + putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).getValue(); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithAttributesValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithAttributesValueAsyncClient.java index e2ba4a411e0..84e4b7e049b 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithAttributesValueAsyncClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithAttributesValueAsyncClient.java @@ -28,7 +28,7 @@ @ServiceClient(builder = XmlClientBuilder.class, isAsync = true) public final class ModelWithAttributesValueAsyncClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithAttributesValuesImpl serviceClient; @@ -115,7 +115,7 @@ public Mono get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ModelWithAttributes.class, SERIALIZER)); + .map(protocolMethodData -> protocolMethodData.toObject(ModelWithAttributes.class, XML_SERIALIZER)); } /** @@ -135,6 +135,6 @@ public Mono get() { public Mono put(ModelWithAttributes input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); + return putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithAttributesValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithAttributesValueClient.java index d471399405a..7f4bbf0ead3 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithAttributesValueClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithAttributesValueClient.java @@ -26,7 +26,7 @@ @ServiceClient(builder = XmlClientBuilder.class) public final class ModelWithAttributesValueClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithAttributesValuesImpl serviceClient; @@ -111,7 +111,7 @@ public Response putWithResponse(BinaryData input, RequestOptions requestOp public ModelWithAttributes get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(ModelWithAttributes.class, SERIALIZER); + return getWithResponse(requestOptions).getValue().toObject(ModelWithAttributes.class, XML_SERIALIZER); } /** @@ -130,6 +130,6 @@ public ModelWithAttributes get() { public void put(ModelWithAttributes input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).getValue(); + putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).getValue(); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithDatetimeValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithDatetimeValueAsyncClient.java index 18cc35250d0..75ebfe7ba75 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithDatetimeValueAsyncClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithDatetimeValueAsyncClient.java @@ -28,7 +28,7 @@ @ServiceClient(builder = XmlClientBuilder.class, isAsync = true) public final class ModelWithDatetimeValueAsyncClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithDatetimeValuesImpl serviceClient; @@ -113,7 +113,7 @@ public Mono get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ModelWithDatetime.class, SERIALIZER)); + .map(protocolMethodData -> protocolMethodData.toObject(ModelWithDatetime.class, XML_SERIALIZER)); } /** @@ -133,6 +133,6 @@ public Mono get() { public Mono put(ModelWithDatetime input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); + return putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithDatetimeValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithDatetimeValueClient.java index 2d87e4dacb9..87b0b627c02 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithDatetimeValueClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithDatetimeValueClient.java @@ -26,7 +26,7 @@ @ServiceClient(builder = XmlClientBuilder.class) public final class ModelWithDatetimeValueClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithDatetimeValuesImpl serviceClient; @@ -109,7 +109,7 @@ public Response putWithResponse(BinaryData input, RequestOptions requestOp public ModelWithDatetime get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(ModelWithDatetime.class, SERIALIZER); + return getWithResponse(requestOptions).getValue().toObject(ModelWithDatetime.class, XML_SERIALIZER); } /** @@ -128,6 +128,6 @@ public ModelWithDatetime get() { public void put(ModelWithDatetime input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).getValue(); + putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).getValue(); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithDictionaryValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithDictionaryValueAsyncClient.java index 195d04bd7d0..159bce11961 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithDictionaryValueAsyncClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithDictionaryValueAsyncClient.java @@ -28,7 +28,7 @@ @ServiceClient(builder = XmlClientBuilder.class, isAsync = true) public final class ModelWithDictionaryValueAsyncClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithDictionaryValuesImpl serviceClient; @@ -115,7 +115,7 @@ public Mono get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ModelWithDictionary.class, SERIALIZER)); + .map(protocolMethodData -> protocolMethodData.toObject(ModelWithDictionary.class, XML_SERIALIZER)); } /** @@ -135,6 +135,6 @@ public Mono get() { public Mono put(ModelWithDictionary input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); + return putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithDictionaryValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithDictionaryValueClient.java index d480bdb1d18..39f59b981a5 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithDictionaryValueClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithDictionaryValueClient.java @@ -26,7 +26,7 @@ @ServiceClient(builder = XmlClientBuilder.class) public final class ModelWithDictionaryValueClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithDictionaryValuesImpl serviceClient; @@ -111,7 +111,7 @@ public Response putWithResponse(BinaryData input, RequestOptions requestOp public ModelWithDictionary get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(ModelWithDictionary.class, SERIALIZER); + return getWithResponse(requestOptions).getValue().toObject(ModelWithDictionary.class, XML_SERIALIZER); } /** @@ -130,6 +130,6 @@ public ModelWithDictionary get() { public void put(ModelWithDictionary input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).getValue(); + putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).getValue(); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithEmptyArrayValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithEmptyArrayValueAsyncClient.java index 17ec0f852f9..7e1c583b9e6 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithEmptyArrayValueAsyncClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithEmptyArrayValueAsyncClient.java @@ -28,7 +28,7 @@ @ServiceClient(builder = XmlClientBuilder.class, isAsync = true) public final class ModelWithEmptyArrayValueAsyncClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithEmptyArrayValuesImpl serviceClient; @@ -122,7 +122,7 @@ public Mono get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ModelWithEmptyArray.class, SERIALIZER)); + .map(protocolMethodData -> protocolMethodData.toObject(ModelWithEmptyArray.class, XML_SERIALIZER)); } /** @@ -142,6 +142,6 @@ public Mono get() { public Mono put(ModelWithEmptyArray input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); + return putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithEmptyArrayValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithEmptyArrayValueClient.java index 347ef35cc6c..52b57d7b036 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithEmptyArrayValueClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithEmptyArrayValueClient.java @@ -26,7 +26,7 @@ @ServiceClient(builder = XmlClientBuilder.class) public final class ModelWithEmptyArrayValueClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithEmptyArrayValuesImpl serviceClient; @@ -118,7 +118,7 @@ public Response putWithResponse(BinaryData input, RequestOptions requestOp public ModelWithEmptyArray get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(ModelWithEmptyArray.class, SERIALIZER); + return getWithResponse(requestOptions).getValue().toObject(ModelWithEmptyArray.class, XML_SERIALIZER); } /** @@ -137,6 +137,6 @@ public ModelWithEmptyArray get() { public void put(ModelWithEmptyArray input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).getValue(); + putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).getValue(); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithEncodedNamesValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithEncodedNamesValueAsyncClient.java index cddbd682bc4..bb628afd86a 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithEncodedNamesValueAsyncClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithEncodedNamesValueAsyncClient.java @@ -28,7 +28,7 @@ @ServiceClient(builder = XmlClientBuilder.class, isAsync = true) public final class ModelWithEncodedNamesValueAsyncClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithEncodedNamesValuesImpl serviceClient; @@ -124,7 +124,7 @@ public Mono get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ModelWithEncodedNames.class, SERIALIZER)); + .map(protocolMethodData -> protocolMethodData.toObject(ModelWithEncodedNames.class, XML_SERIALIZER)); } /** @@ -144,6 +144,6 @@ public Mono get() { public Mono put(ModelWithEncodedNames input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); + return putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithEncodedNamesValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithEncodedNamesValueClient.java index 24bcb3d6adb..6f248bc20af 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithEncodedNamesValueClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithEncodedNamesValueClient.java @@ -26,7 +26,7 @@ @ServiceClient(builder = XmlClientBuilder.class) public final class ModelWithEncodedNamesValueClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithEncodedNamesValuesImpl serviceClient; @@ -119,7 +119,7 @@ public Response putWithResponse(BinaryData input, RequestOptions requestOp public ModelWithEncodedNames get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(ModelWithEncodedNames.class, SERIALIZER); + return getWithResponse(requestOptions).getValue().toObject(ModelWithEncodedNames.class, XML_SERIALIZER); } /** @@ -138,6 +138,6 @@ public ModelWithEncodedNames get() { public void put(ModelWithEncodedNames input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).getValue(); + putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).getValue(); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithEnumValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithEnumValueAsyncClient.java index 6f7b59ebc2d..4dc46a81d40 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithEnumValueAsyncClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithEnumValueAsyncClient.java @@ -28,7 +28,7 @@ @ServiceClient(builder = XmlClientBuilder.class, isAsync = true) public final class ModelWithEnumValueAsyncClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithEnumValuesImpl serviceClient; @@ -111,7 +111,7 @@ public Mono get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ModelWithEnum.class, SERIALIZER)); + .map(protocolMethodData -> protocolMethodData.toObject(ModelWithEnum.class, XML_SERIALIZER)); } /** @@ -131,6 +131,6 @@ public Mono get() { public Mono put(ModelWithEnum input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); + return putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithEnumValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithEnumValueClient.java index fba645a3581..10b19d7c64d 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithEnumValueClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithEnumValueClient.java @@ -26,7 +26,7 @@ @ServiceClient(builder = XmlClientBuilder.class) public final class ModelWithEnumValueClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithEnumValuesImpl serviceClient; @@ -107,7 +107,7 @@ public Response putWithResponse(BinaryData input, RequestOptions requestOp public ModelWithEnum get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(ModelWithEnum.class, SERIALIZER); + return getWithResponse(requestOptions).getValue().toObject(ModelWithEnum.class, XML_SERIALIZER); } /** @@ -126,6 +126,6 @@ public ModelWithEnum get() { public void put(ModelWithEnum input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).getValue(); + putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).getValue(); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithNamespaceOnPropertiesValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithNamespaceOnPropertiesValueAsyncClient.java index 224f322ada6..324185ca275 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithNamespaceOnPropertiesValueAsyncClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithNamespaceOnPropertiesValueAsyncClient.java @@ -28,7 +28,7 @@ @ServiceClient(builder = XmlClientBuilder.class, isAsync = true) public final class ModelWithNamespaceOnPropertiesValueAsyncClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithNamespaceOnPropertiesValuesImpl serviceClient; @@ -116,7 +116,8 @@ public Mono get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ModelWithNamespaceOnProperties.class, SERIALIZER)); + .map(protocolMethodData -> protocolMethodData.toObject(ModelWithNamespaceOnProperties.class, + XML_SERIALIZER)); } /** @@ -136,6 +137,6 @@ public Mono get() { public Mono put(ModelWithNamespaceOnProperties input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); + return putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithNamespaceOnPropertiesValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithNamespaceOnPropertiesValueClient.java index 5ec708f8491..0e8d2538712 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithNamespaceOnPropertiesValueClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithNamespaceOnPropertiesValueClient.java @@ -26,7 +26,7 @@ @ServiceClient(builder = XmlClientBuilder.class) public final class ModelWithNamespaceOnPropertiesValueClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithNamespaceOnPropertiesValuesImpl serviceClient; @@ -112,7 +112,8 @@ public Response putWithResponse(BinaryData input, RequestOptions requestOp public ModelWithNamespaceOnProperties get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(ModelWithNamespaceOnProperties.class, SERIALIZER); + return getWithResponse(requestOptions).getValue() + .toObject(ModelWithNamespaceOnProperties.class, XML_SERIALIZER); } /** @@ -131,6 +132,6 @@ public ModelWithNamespaceOnProperties get() { public void put(ModelWithNamespaceOnProperties input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).getValue(); + putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).getValue(); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithNamespaceValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithNamespaceValueAsyncClient.java index 539f07ce235..eee95e9b17c 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithNamespaceValueAsyncClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithNamespaceValueAsyncClient.java @@ -28,7 +28,7 @@ @ServiceClient(builder = XmlClientBuilder.class, isAsync = true) public final class ModelWithNamespaceValueAsyncClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithNamespaceValuesImpl serviceClient; @@ -113,7 +113,7 @@ public Mono get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ModelWithNamespace.class, SERIALIZER)); + .map(protocolMethodData -> protocolMethodData.toObject(ModelWithNamespace.class, XML_SERIALIZER)); } /** @@ -133,6 +133,6 @@ public Mono get() { public Mono put(ModelWithNamespace input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); + return putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithNamespaceValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithNamespaceValueClient.java index 24913a0382b..ae190101897 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithNamespaceValueClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithNamespaceValueClient.java @@ -26,7 +26,7 @@ @ServiceClient(builder = XmlClientBuilder.class) public final class ModelWithNamespaceValueClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithNamespaceValuesImpl serviceClient; @@ -109,7 +109,7 @@ public Response putWithResponse(BinaryData input, RequestOptions requestOp public ModelWithNamespace get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(ModelWithNamespace.class, SERIALIZER); + return getWithResponse(requestOptions).getValue().toObject(ModelWithNamespace.class, XML_SERIALIZER); } /** @@ -128,6 +128,6 @@ public ModelWithNamespace get() { public void put(ModelWithNamespace input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).getValue(); + putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).getValue(); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithNestedModelValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithNestedModelValueAsyncClient.java index cabf1c167d5..e3d2e270649 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithNestedModelValueAsyncClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithNestedModelValueAsyncClient.java @@ -28,7 +28,7 @@ @ServiceClient(builder = XmlClientBuilder.class, isAsync = true) public final class ModelWithNestedModelValueAsyncClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithNestedModelValuesImpl serviceClient; @@ -117,7 +117,7 @@ public Mono get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ModelWithNestedModel.class, SERIALIZER)); + .map(protocolMethodData -> protocolMethodData.toObject(ModelWithNestedModel.class, XML_SERIALIZER)); } /** @@ -137,6 +137,6 @@ public Mono get() { public Mono put(ModelWithNestedModel input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); + return putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithNestedModelValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithNestedModelValueClient.java index cb3c68d8e97..3be2b03651d 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithNestedModelValueClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithNestedModelValueClient.java @@ -26,7 +26,7 @@ @ServiceClient(builder = XmlClientBuilder.class) public final class ModelWithNestedModelValueClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithNestedModelValuesImpl serviceClient; @@ -113,7 +113,7 @@ public Response putWithResponse(BinaryData input, RequestOptions requestOp public ModelWithNestedModel get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(ModelWithNestedModel.class, SERIALIZER); + return getWithResponse(requestOptions).getValue().toObject(ModelWithNestedModel.class, XML_SERIALIZER); } /** @@ -132,6 +132,6 @@ public ModelWithNestedModel get() { public void put(ModelWithNestedModel input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).getValue(); + putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).getValue(); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithOptionalFieldValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithOptionalFieldValueAsyncClient.java index 895cc738a15..af6b9336c82 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithOptionalFieldValueAsyncClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithOptionalFieldValueAsyncClient.java @@ -28,7 +28,7 @@ @ServiceClient(builder = XmlClientBuilder.class, isAsync = true) public final class ModelWithOptionalFieldValueAsyncClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithOptionalFieldValuesImpl serviceClient; @@ -112,7 +112,7 @@ public Mono get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ModelWithOptionalField.class, SERIALIZER)); + .map(protocolMethodData -> protocolMethodData.toObject(ModelWithOptionalField.class, XML_SERIALIZER)); } /** @@ -132,6 +132,6 @@ public Mono get() { public Mono put(ModelWithOptionalField input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); + return putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithOptionalFieldValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithOptionalFieldValueClient.java index 399cd80a8f1..d6647b8b829 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithOptionalFieldValueClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithOptionalFieldValueClient.java @@ -26,7 +26,7 @@ @ServiceClient(builder = XmlClientBuilder.class) public final class ModelWithOptionalFieldValueClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithOptionalFieldValuesImpl serviceClient; @@ -109,7 +109,7 @@ public Response putWithResponse(BinaryData input, RequestOptions requestOp public ModelWithOptionalField get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(ModelWithOptionalField.class, SERIALIZER); + return getWithResponse(requestOptions).getValue().toObject(ModelWithOptionalField.class, XML_SERIALIZER); } /** @@ -128,6 +128,6 @@ public ModelWithOptionalField get() { public void put(ModelWithOptionalField input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).getValue(); + putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).getValue(); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedArraysValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedArraysValueAsyncClient.java index a369272fe63..b3e0fa7a83e 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedArraysValueAsyncClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedArraysValueAsyncClient.java @@ -28,7 +28,7 @@ @ServiceClient(builder = XmlClientBuilder.class, isAsync = true) public final class ModelWithRenamedArraysValueAsyncClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithRenamedArraysValuesImpl serviceClient; @@ -122,7 +122,7 @@ public Mono get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ModelWithRenamedArrays.class, SERIALIZER)); + .map(protocolMethodData -> protocolMethodData.toObject(ModelWithRenamedArrays.class, XML_SERIALIZER)); } /** @@ -142,6 +142,6 @@ public Mono get() { public Mono put(ModelWithRenamedArrays input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); + return putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedArraysValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedArraysValueClient.java index 816375d2b45..e405d116947 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedArraysValueClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedArraysValueClient.java @@ -26,7 +26,7 @@ @ServiceClient(builder = XmlClientBuilder.class) public final class ModelWithRenamedArraysValueClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithRenamedArraysValuesImpl serviceClient; @@ -119,7 +119,7 @@ public Response putWithResponse(BinaryData input, RequestOptions requestOp public ModelWithRenamedArrays get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(ModelWithRenamedArrays.class, SERIALIZER); + return getWithResponse(requestOptions).getValue().toObject(ModelWithRenamedArrays.class, XML_SERIALIZER); } /** @@ -138,6 +138,6 @@ public ModelWithRenamedArrays get() { public void put(ModelWithRenamedArrays input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).getValue(); + putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).getValue(); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedAttributeValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedAttributeValueAsyncClient.java index 148ca7cdc9d..7af625c648c 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedAttributeValueAsyncClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedAttributeValueAsyncClient.java @@ -28,7 +28,7 @@ @ServiceClient(builder = XmlClientBuilder.class, isAsync = true) public final class ModelWithRenamedAttributeValueAsyncClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithRenamedAttributeValuesImpl serviceClient; @@ -115,7 +115,7 @@ public Mono get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ModelWithRenamedAttribute.class, SERIALIZER)); + .map(protocolMethodData -> protocolMethodData.toObject(ModelWithRenamedAttribute.class, XML_SERIALIZER)); } /** @@ -135,6 +135,6 @@ public Mono get() { public Mono put(ModelWithRenamedAttribute input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); + return putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedAttributeValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedAttributeValueClient.java index 31ac02f7584..0c8211652fb 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedAttributeValueClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedAttributeValueClient.java @@ -26,7 +26,7 @@ @ServiceClient(builder = XmlClientBuilder.class) public final class ModelWithRenamedAttributeValueClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithRenamedAttributeValuesImpl serviceClient; @@ -111,7 +111,7 @@ public Response putWithResponse(BinaryData input, RequestOptions requestOp public ModelWithRenamedAttribute get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(ModelWithRenamedAttribute.class, SERIALIZER); + return getWithResponse(requestOptions).getValue().toObject(ModelWithRenamedAttribute.class, XML_SERIALIZER); } /** @@ -130,6 +130,6 @@ public ModelWithRenamedAttribute get() { public void put(ModelWithRenamedAttribute input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).getValue(); + putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).getValue(); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedFieldsValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedFieldsValueAsyncClient.java index a62463ba044..b309fd15e80 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedFieldsValueAsyncClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedFieldsValueAsyncClient.java @@ -28,7 +28,7 @@ @ServiceClient(builder = XmlClientBuilder.class, isAsync = true) public final class ModelWithRenamedFieldsValueAsyncClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithRenamedFieldsValuesImpl serviceClient; @@ -120,7 +120,7 @@ public Mono get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ModelWithRenamedFields.class, SERIALIZER)); + .map(protocolMethodData -> protocolMethodData.toObject(ModelWithRenamedFields.class, XML_SERIALIZER)); } /** @@ -140,6 +140,6 @@ public Mono get() { public Mono put(ModelWithRenamedFields input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); + return putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedFieldsValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedFieldsValueClient.java index 5111e8e5759..e3f47f41d23 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedFieldsValueClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedFieldsValueClient.java @@ -26,7 +26,7 @@ @ServiceClient(builder = XmlClientBuilder.class) public final class ModelWithRenamedFieldsValueClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithRenamedFieldsValuesImpl serviceClient; @@ -116,7 +116,7 @@ public Response putWithResponse(BinaryData input, RequestOptions requestOp public ModelWithRenamedFields get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(ModelWithRenamedFields.class, SERIALIZER); + return getWithResponse(requestOptions).getValue().toObject(ModelWithRenamedFields.class, XML_SERIALIZER); } /** @@ -135,6 +135,6 @@ public ModelWithRenamedFields get() { public void put(ModelWithRenamedFields input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).getValue(); + putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).getValue(); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedNestedModelValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedNestedModelValueAsyncClient.java index b9d8a681d6d..9d002686663 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedNestedModelValueAsyncClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedNestedModelValueAsyncClient.java @@ -28,7 +28,7 @@ @ServiceClient(builder = XmlClientBuilder.class, isAsync = true) public final class ModelWithRenamedNestedModelValueAsyncClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithRenamedNestedModelValuesImpl serviceClient; @@ -115,7 +115,7 @@ public Mono get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ModelWithRenamedNestedModel.class, SERIALIZER)); + .map(protocolMethodData -> protocolMethodData.toObject(ModelWithRenamedNestedModel.class, XML_SERIALIZER)); } /** @@ -135,6 +135,6 @@ public Mono get() { public Mono put(ModelWithRenamedNestedModel input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); + return putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedNestedModelValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedNestedModelValueClient.java index 7a0e81c321f..b63c9d8d0ca 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedNestedModelValueClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedNestedModelValueClient.java @@ -26,7 +26,7 @@ @ServiceClient(builder = XmlClientBuilder.class) public final class ModelWithRenamedNestedModelValueClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithRenamedNestedModelValuesImpl serviceClient; @@ -111,7 +111,7 @@ public Response putWithResponse(BinaryData input, RequestOptions requestOp public ModelWithRenamedNestedModel get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(ModelWithRenamedNestedModel.class, SERIALIZER); + return getWithResponse(requestOptions).getValue().toObject(ModelWithRenamedNestedModel.class, XML_SERIALIZER); } /** @@ -130,6 +130,6 @@ public ModelWithRenamedNestedModel get() { public void put(ModelWithRenamedNestedModel input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).getValue(); + putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).getValue(); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedPropertyValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedPropertyValueAsyncClient.java index 944e79cebe1..6946bf19d05 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedPropertyValueAsyncClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedPropertyValueAsyncClient.java @@ -28,7 +28,7 @@ @ServiceClient(builder = XmlClientBuilder.class, isAsync = true) public final class ModelWithRenamedPropertyValueAsyncClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithRenamedPropertyValuesImpl serviceClient; @@ -113,7 +113,7 @@ public Mono get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ModelWithRenamedProperty.class, SERIALIZER)); + .map(protocolMethodData -> protocolMethodData.toObject(ModelWithRenamedProperty.class, XML_SERIALIZER)); } /** @@ -133,6 +133,6 @@ public Mono get() { public Mono put(ModelWithRenamedProperty input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); + return putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedPropertyValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedPropertyValueClient.java index 86377cddb30..acd82c57fd7 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedPropertyValueClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedPropertyValueClient.java @@ -26,7 +26,7 @@ @ServiceClient(builder = XmlClientBuilder.class) public final class ModelWithRenamedPropertyValueClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithRenamedPropertyValuesImpl serviceClient; @@ -109,7 +109,7 @@ public Response putWithResponse(BinaryData input, RequestOptions requestOp public ModelWithRenamedProperty get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(ModelWithRenamedProperty.class, SERIALIZER); + return getWithResponse(requestOptions).getValue().toObject(ModelWithRenamedProperty.class, XML_SERIALIZER); } /** @@ -128,6 +128,6 @@ public ModelWithRenamedProperty get() { public void put(ModelWithRenamedProperty input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).getValue(); + putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).getValue(); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedUnwrappedModelArrayValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedUnwrappedModelArrayValueAsyncClient.java index a67671537a7..9b4c54d5638 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedUnwrappedModelArrayValueAsyncClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedUnwrappedModelArrayValueAsyncClient.java @@ -28,7 +28,7 @@ @ServiceClient(builder = XmlClientBuilder.class, isAsync = true) public final class ModelWithRenamedUnwrappedModelArrayValueAsyncClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithRenamedUnwrappedModelArrayValuesImpl serviceClient; @@ -123,7 +123,7 @@ public Mono get() { RequestOptions requestOptions = new RequestOptions(); return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) .map(protocolMethodData -> protocolMethodData.toObject(ModelWithRenamedUnwrappedModelArray.class, - SERIALIZER)); + XML_SERIALIZER)); } /** @@ -143,6 +143,6 @@ public Mono get() { public Mono put(ModelWithRenamedUnwrappedModelArray input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); + return putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedUnwrappedModelArrayValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedUnwrappedModelArrayValueClient.java index e6002cb5e46..8cf3d973817 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedUnwrappedModelArrayValueClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedUnwrappedModelArrayValueClient.java @@ -26,7 +26,7 @@ @ServiceClient(builder = XmlClientBuilder.class) public final class ModelWithRenamedUnwrappedModelArrayValueClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithRenamedUnwrappedModelArrayValuesImpl serviceClient; @@ -118,7 +118,7 @@ public ModelWithRenamedUnwrappedModelArray get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); return getWithResponse(requestOptions).getValue() - .toObject(ModelWithRenamedUnwrappedModelArray.class, SERIALIZER); + .toObject(ModelWithRenamedUnwrappedModelArray.class, XML_SERIALIZER); } /** @@ -137,6 +137,6 @@ public ModelWithRenamedUnwrappedModelArray get() { public void put(ModelWithRenamedUnwrappedModelArray input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).getValue(); + putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).getValue(); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedWrappedAndItemModelArrayValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedWrappedAndItemModelArrayValueAsyncClient.java index e7782e87f9e..3edda815c07 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedWrappedAndItemModelArrayValueAsyncClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedWrappedAndItemModelArrayValueAsyncClient.java @@ -28,7 +28,7 @@ @ServiceClient(builder = XmlClientBuilder.class, isAsync = true) public final class ModelWithRenamedWrappedAndItemModelArrayValueAsyncClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithRenamedWrappedAndItemModelArrayValuesImpl serviceClient; @@ -122,7 +122,7 @@ public Mono get() { RequestOptions requestOptions = new RequestOptions(); return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) .map(protocolMethodData -> protocolMethodData.toObject(ModelWithRenamedWrappedAndItemModelArray.class, - SERIALIZER)); + XML_SERIALIZER)); } /** @@ -142,6 +142,6 @@ public Mono get() { public Mono put(ModelWithRenamedWrappedAndItemModelArray input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); + return putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedWrappedAndItemModelArrayValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedWrappedAndItemModelArrayValueClient.java index 6afada2ae3d..1bbb9df5243 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedWrappedAndItemModelArrayValueClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedWrappedAndItemModelArrayValueClient.java @@ -26,7 +26,7 @@ @ServiceClient(builder = XmlClientBuilder.class) public final class ModelWithRenamedWrappedAndItemModelArrayValueClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithRenamedWrappedAndItemModelArrayValuesImpl serviceClient; @@ -117,7 +117,7 @@ public ModelWithRenamedWrappedAndItemModelArray get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); return getWithResponse(requestOptions).getValue() - .toObject(ModelWithRenamedWrappedAndItemModelArray.class, SERIALIZER); + .toObject(ModelWithRenamedWrappedAndItemModelArray.class, XML_SERIALIZER); } /** @@ -136,6 +136,6 @@ public ModelWithRenamedWrappedAndItemModelArray get() { public void put(ModelWithRenamedWrappedAndItemModelArray input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).getValue(); + putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).getValue(); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedWrappedModelArrayValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedWrappedModelArrayValueAsyncClient.java index 383c6f1e94a..135585aaf81 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedWrappedModelArrayValueAsyncClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedWrappedModelArrayValueAsyncClient.java @@ -28,7 +28,7 @@ @ServiceClient(builder = XmlClientBuilder.class, isAsync = true) public final class ModelWithRenamedWrappedModelArrayValueAsyncClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithRenamedWrappedModelArrayValuesImpl serviceClient; @@ -122,8 +122,8 @@ public Mono get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map( - protocolMethodData -> protocolMethodData.toObject(ModelWithRenamedWrappedModelArray.class, SERIALIZER)); + .map(protocolMethodData -> protocolMethodData.toObject(ModelWithRenamedWrappedModelArray.class, + XML_SERIALIZER)); } /** @@ -143,6 +143,6 @@ public Mono get() { public Mono put(ModelWithRenamedWrappedModelArray input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); + return putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedWrappedModelArrayValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedWrappedModelArrayValueClient.java index 5044de3bc79..7b4081ed533 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedWrappedModelArrayValueClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithRenamedWrappedModelArrayValueClient.java @@ -26,7 +26,7 @@ @ServiceClient(builder = XmlClientBuilder.class) public final class ModelWithRenamedWrappedModelArrayValueClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithRenamedWrappedModelArrayValuesImpl serviceClient; @@ -117,7 +117,8 @@ public Response putWithResponse(BinaryData input, RequestOptions requestOp public ModelWithRenamedWrappedModelArray get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(ModelWithRenamedWrappedModelArray.class, SERIALIZER); + return getWithResponse(requestOptions).getValue() + .toObject(ModelWithRenamedWrappedModelArray.class, XML_SERIALIZER); } /** @@ -136,6 +137,6 @@ public ModelWithRenamedWrappedModelArray get() { public void put(ModelWithRenamedWrappedModelArray input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).getValue(); + putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).getValue(); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithSimpleArraysValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithSimpleArraysValueAsyncClient.java index dae44cabd0a..b2f1886ac4d 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithSimpleArraysValueAsyncClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithSimpleArraysValueAsyncClient.java @@ -28,7 +28,7 @@ @ServiceClient(builder = XmlClientBuilder.class, isAsync = true) public final class ModelWithSimpleArraysValueAsyncClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithSimpleArraysValuesImpl serviceClient; @@ -121,7 +121,7 @@ public Mono get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ModelWithSimpleArrays.class, SERIALIZER)); + .map(protocolMethodData -> protocolMethodData.toObject(ModelWithSimpleArrays.class, XML_SERIALIZER)); } /** @@ -141,6 +141,6 @@ public Mono get() { public Mono put(ModelWithSimpleArrays input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); + return putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithSimpleArraysValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithSimpleArraysValueClient.java index 9bcebe26a83..b4c62ee9f4b 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithSimpleArraysValueClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithSimpleArraysValueClient.java @@ -26,7 +26,7 @@ @ServiceClient(builder = XmlClientBuilder.class) public final class ModelWithSimpleArraysValueClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithSimpleArraysValuesImpl serviceClient; @@ -117,7 +117,7 @@ public Response putWithResponse(BinaryData input, RequestOptions requestOp public ModelWithSimpleArrays get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(ModelWithSimpleArrays.class, SERIALIZER); + return getWithResponse(requestOptions).getValue().toObject(ModelWithSimpleArrays.class, XML_SERIALIZER); } /** @@ -136,6 +136,6 @@ public ModelWithSimpleArrays get() { public void put(ModelWithSimpleArrays input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).getValue(); + putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).getValue(); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithTextValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithTextValueAsyncClient.java index 8598be080ab..50bc2035d8f 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithTextValueAsyncClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithTextValueAsyncClient.java @@ -28,7 +28,7 @@ @ServiceClient(builder = XmlClientBuilder.class, isAsync = true) public final class ModelWithTextValueAsyncClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithTextValuesImpl serviceClient; @@ -113,7 +113,7 @@ public Mono get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ModelWithText.class, SERIALIZER)); + .map(protocolMethodData -> protocolMethodData.toObject(ModelWithText.class, XML_SERIALIZER)); } /** @@ -133,6 +133,6 @@ public Mono get() { public Mono put(ModelWithText input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); + return putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithTextValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithTextValueClient.java index e375ebf9c12..37d7122f090 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithTextValueClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithTextValueClient.java @@ -26,7 +26,7 @@ @ServiceClient(builder = XmlClientBuilder.class) public final class ModelWithTextValueClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithTextValuesImpl serviceClient; @@ -109,7 +109,7 @@ public Response putWithResponse(BinaryData input, RequestOptions requestOp public ModelWithText get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(ModelWithText.class, SERIALIZER); + return getWithResponse(requestOptions).getValue().toObject(ModelWithText.class, XML_SERIALIZER); } /** @@ -128,6 +128,6 @@ public ModelWithText get() { public void put(ModelWithText input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).getValue(); + putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).getValue(); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithUnwrappedArrayValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithUnwrappedArrayValueAsyncClient.java index 6bab0a31b58..1d6501a0d75 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithUnwrappedArrayValueAsyncClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithUnwrappedArrayValueAsyncClient.java @@ -28,7 +28,7 @@ @ServiceClient(builder = XmlClientBuilder.class, isAsync = true) public final class ModelWithUnwrappedArrayValueAsyncClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithUnwrappedArrayValuesImpl serviceClient; @@ -122,7 +122,7 @@ public Mono get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ModelWithUnwrappedArray.class, SERIALIZER)); + .map(protocolMethodData -> protocolMethodData.toObject(ModelWithUnwrappedArray.class, XML_SERIALIZER)); } /** @@ -142,6 +142,6 @@ public Mono get() { public Mono put(ModelWithUnwrappedArray input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); + return putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithUnwrappedArrayValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithUnwrappedArrayValueClient.java index 80ee58a2c52..c90326741ef 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithUnwrappedArrayValueClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithUnwrappedArrayValueClient.java @@ -26,7 +26,7 @@ @ServiceClient(builder = XmlClientBuilder.class) public final class ModelWithUnwrappedArrayValueClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithUnwrappedArrayValuesImpl serviceClient; @@ -117,7 +117,7 @@ public Response putWithResponse(BinaryData input, RequestOptions requestOp public ModelWithUnwrappedArray get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(ModelWithUnwrappedArray.class, SERIALIZER); + return getWithResponse(requestOptions).getValue().toObject(ModelWithUnwrappedArray.class, XML_SERIALIZER); } /** @@ -136,6 +136,6 @@ public ModelWithUnwrappedArray get() { public void put(ModelWithUnwrappedArray input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).getValue(); + putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).getValue(); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithUnwrappedModelArrayValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithUnwrappedModelArrayValueAsyncClient.java index fcf1648ed9e..d775e563442 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithUnwrappedModelArrayValueAsyncClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithUnwrappedModelArrayValueAsyncClient.java @@ -28,7 +28,7 @@ @ServiceClient(builder = XmlClientBuilder.class, isAsync = true) public final class ModelWithUnwrappedModelArrayValueAsyncClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithUnwrappedModelArrayValuesImpl serviceClient; @@ -121,7 +121,7 @@ public Mono get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(ModelWithUnwrappedModelArray.class, SERIALIZER)); + .map(protocolMethodData -> protocolMethodData.toObject(ModelWithUnwrappedModelArray.class, XML_SERIALIZER)); } /** @@ -141,6 +141,6 @@ public Mono get() { public Mono put(ModelWithUnwrappedModelArray input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); + return putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithUnwrappedModelArrayValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithUnwrappedModelArrayValueClient.java index e03eec89b3f..d285f308d93 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithUnwrappedModelArrayValueClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithUnwrappedModelArrayValueClient.java @@ -26,7 +26,7 @@ @ServiceClient(builder = XmlClientBuilder.class) public final class ModelWithUnwrappedModelArrayValueClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithUnwrappedModelArrayValuesImpl serviceClient; @@ -117,7 +117,7 @@ public Response putWithResponse(BinaryData input, RequestOptions requestOp public ModelWithUnwrappedModelArray get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(ModelWithUnwrappedModelArray.class, SERIALIZER); + return getWithResponse(requestOptions).getValue().toObject(ModelWithUnwrappedModelArray.class, XML_SERIALIZER); } /** @@ -136,6 +136,6 @@ public ModelWithUnwrappedModelArray get() { public void put(ModelWithUnwrappedModelArray input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).getValue(); + putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).getValue(); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithWrappedPrimitiveCustomItemNamesValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithWrappedPrimitiveCustomItemNamesValueAsyncClient.java index 5c128642f06..24d60771dd2 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithWrappedPrimitiveCustomItemNamesValueAsyncClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithWrappedPrimitiveCustomItemNamesValueAsyncClient.java @@ -28,7 +28,7 @@ @ServiceClient(builder = XmlClientBuilder.class, isAsync = true) public final class ModelWithWrappedPrimitiveCustomItemNamesValueAsyncClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithWrappedPrimitiveCustomItemNamesValuesImpl serviceClient; @@ -118,7 +118,7 @@ public Mono get() { RequestOptions requestOptions = new RequestOptions(); return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) .map(protocolMethodData -> protocolMethodData.toObject(ModelWithWrappedPrimitiveCustomItemNames.class, - SERIALIZER)); + XML_SERIALIZER)); } /** @@ -138,6 +138,6 @@ public Mono get() { public Mono put(ModelWithWrappedPrimitiveCustomItemNames input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); + return putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithWrappedPrimitiveCustomItemNamesValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithWrappedPrimitiveCustomItemNamesValueClient.java index b0dbd590854..2d271747f24 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithWrappedPrimitiveCustomItemNamesValueClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/ModelWithWrappedPrimitiveCustomItemNamesValueClient.java @@ -26,7 +26,7 @@ @ServiceClient(builder = XmlClientBuilder.class) public final class ModelWithWrappedPrimitiveCustomItemNamesValueClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final ModelWithWrappedPrimitiveCustomItemNamesValuesImpl serviceClient; @@ -113,7 +113,7 @@ public ModelWithWrappedPrimitiveCustomItemNames get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); return getWithResponse(requestOptions).getValue() - .toObject(ModelWithWrappedPrimitiveCustomItemNames.class, SERIALIZER); + .toObject(ModelWithWrappedPrimitiveCustomItemNames.class, XML_SERIALIZER); } /** @@ -132,6 +132,6 @@ public ModelWithWrappedPrimitiveCustomItemNames get() { public void put(ModelWithWrappedPrimitiveCustomItemNames input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).getValue(); + putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).getValue(); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/SimpleModelValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/SimpleModelValueAsyncClient.java index 9decc6bca75..a44b9f9c0bd 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/SimpleModelValueAsyncClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/SimpleModelValueAsyncClient.java @@ -28,7 +28,7 @@ @ServiceClient(builder = XmlClientBuilder.class, isAsync = true) public final class SimpleModelValueAsyncClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final SimpleModelValuesImpl serviceClient; @@ -113,7 +113,7 @@ public Mono get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(SimpleModel.class, SERIALIZER)); + .map(protocolMethodData -> protocolMethodData.toObject(SimpleModel.class, XML_SERIALIZER)); } /** @@ -133,6 +133,6 @@ public Mono get() { public Mono put(SimpleModel input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - return putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); + return putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).flatMap(FluxUtil::toMono); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/SimpleModelValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/SimpleModelValueClient.java index 0bf8ac990b0..a5598e7f4a6 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/SimpleModelValueClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/SimpleModelValueClient.java @@ -26,7 +26,7 @@ @ServiceClient(builder = XmlClientBuilder.class) public final class SimpleModelValueClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final SimpleModelValuesImpl serviceClient; @@ -109,7 +109,7 @@ public Response putWithResponse(BinaryData input, RequestOptions requestOp public SimpleModel get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(SimpleModel.class, SERIALIZER); + return getWithResponse(requestOptions).getValue().toObject(SimpleModel.class, XML_SERIALIZER); } /** @@ -128,6 +128,6 @@ public SimpleModel get() { public void put(SimpleModel input) { // Generated convenience method for putWithResponse RequestOptions requestOptions = new RequestOptions(); - putWithResponse(BinaryData.fromObject(input, SERIALIZER), requestOptions).getValue(); + putWithResponse(BinaryData.fromObject(input, XML_SERIALIZER), requestOptions).getValue(); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/XmlErrorValueAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/XmlErrorValueAsyncClient.java index 49ac7ed4ee6..5489545fdfd 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/XmlErrorValueAsyncClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/XmlErrorValueAsyncClient.java @@ -28,7 +28,7 @@ @ServiceClient(builder = XmlClientBuilder.class, isAsync = true) public final class XmlErrorValueAsyncClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final XmlErrorValuesImpl serviceClient; @@ -86,6 +86,6 @@ public Mono get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) - .map(protocolMethodData -> protocolMethodData.toObject(SimpleModel.class, SERIALIZER)); + .map(protocolMethodData -> protocolMethodData.toObject(SimpleModel.class, XML_SERIALIZER)); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/XmlErrorValueClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/XmlErrorValueClient.java index 426c157daaa..828e2e61228 100644 --- a/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/XmlErrorValueClient.java +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/payload/xml/XmlErrorValueClient.java @@ -26,7 +26,7 @@ @ServiceClient(builder = XmlClientBuilder.class) public final class XmlErrorValueClient { @Generated - private static final ObjectSerializer SERIALIZER = XmlSerializerProviders.createInstance(); + private static final ObjectSerializer XML_SERIALIZER = XmlSerializerProviders.createInstance(); @Generated private final XmlErrorValuesImpl serviceClient; @@ -82,6 +82,6 @@ public Response getWithResponse(RequestOptions requestOptions) { public SimpleModel get() { // Generated convenience method for getWithResponse RequestOptions requestOptions = new RequestOptions(); - return getWithResponse(requestOptions).getValue().toObject(SimpleModel.class, SERIALIZER); + return getWithResponse(requestOptions).getValue().toObject(SimpleModel.class, XML_SERIALIZER); } } diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/xmlbytesverify/XmlBytesVerifyAsyncClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/xmlbytesverify/XmlBytesVerifyAsyncClient.java new file mode 100644 index 00000000000..0b652a8a647 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/xmlbytesverify/XmlBytesVerifyAsyncClient.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.xmlbytesverify; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import com.azure.core.util.FluxUtil; +import reactor.core.publisher.Mono; +import tsptest.xmlbytesverify.implementation.XmlBytesVerifyClientImpl; + +/** + * Initializes a new instance of the asynchronous XmlBytesVerifyClient type. + */ +@ServiceClient(builder = XmlBytesVerifyClientBuilder.class, isAsync = true) +public final class XmlBytesVerifyAsyncClient { + @Generated + private final XmlBytesVerifyClientImpl serviceClient; + + /** + * Initializes an instance of XmlBytesVerifyAsyncClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + XmlBytesVerifyAsyncClient(XmlBytesVerifyClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The getWmtsCapabilities operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * byte[]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @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. + * @return represent a byte array along with {@link Response} on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWmtsCapabilitiesWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWmtsCapabilitiesWithResponseAsync(requestOptions); + } + + /** + * The getWmtsCapabilities operation. + * + * @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 represent a byte array on successful completion of {@link Mono}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getWmtsCapabilities() { + // Generated convenience method for getWmtsCapabilitiesWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWmtsCapabilitiesWithResponse(requestOptions).flatMap(FluxUtil::toMono) + .map(protocolMethodData -> protocolMethodData.toObject(byte[].class)); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/xmlbytesverify/XmlBytesVerifyClient.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/xmlbytesverify/XmlBytesVerifyClient.java new file mode 100644 index 00000000000..191bf91185c --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/xmlbytesverify/XmlBytesVerifyClient.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.xmlbytesverify; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceClient; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import tsptest.xmlbytesverify.implementation.XmlBytesVerifyClientImpl; + +/** + * Initializes a new instance of the synchronous XmlBytesVerifyClient type. + */ +@ServiceClient(builder = XmlBytesVerifyClientBuilder.class) +public final class XmlBytesVerifyClient { + @Generated + private final XmlBytesVerifyClientImpl serviceClient; + + /** + * Initializes an instance of XmlBytesVerifyClient class. + * + * @param serviceClient the service client implementation. + */ + @Generated + XmlBytesVerifyClient(XmlBytesVerifyClientImpl serviceClient) { + this.serviceClient = serviceClient; + } + + /** + * The getWmtsCapabilities operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * byte[]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @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. + * @return represent a byte array along with {@link Response}. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWmtsCapabilitiesWithResponse(RequestOptions requestOptions) { + return this.serviceClient.getWmtsCapabilitiesWithResponse(requestOptions); + } + + /** + * The getWmtsCapabilities operation. + * + * @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 represent a byte array. + */ + @Generated + @ServiceMethod(returns = ReturnType.SINGLE) + public byte[] getWmtsCapabilities() { + // Generated convenience method for getWmtsCapabilitiesWithResponse + RequestOptions requestOptions = new RequestOptions(); + return getWmtsCapabilitiesWithResponse(requestOptions).getValue().toObject(byte[].class); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/xmlbytesverify/XmlBytesVerifyClientBuilder.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/xmlbytesverify/XmlBytesVerifyClientBuilder.java new file mode 100644 index 00000000000..8961a958894 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/xmlbytesverify/XmlBytesVerifyClientBuilder.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.xmlbytesverify; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.serializer.JacksonAdapter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import tsptest.xmlbytesverify.implementation.XmlBytesVerifyClientImpl; + +/** + * A builder for creating a new instance of the XmlBytesVerifyClient type. + */ +@ServiceClientBuilder(serviceClients = { XmlBytesVerifyClient.class, XmlBytesVerifyAsyncClient.class }) +public final class XmlBytesVerifyClientBuilder implements HttpTrait, + ConfigurationTrait, EndpointTrait { + @Generated + private static final String SDK_NAME = "name"; + + @Generated + private static final String SDK_VERSION = "version"; + + @Generated + private static final Map PROPERTIES = CoreUtils.getProperties("tsptest-xmlbytesverify.properties"); + + @Generated + private final List pipelinePolicies; + + /** + * Create an instance of the XmlBytesVerifyClientBuilder. + */ + @Generated + public XmlBytesVerifyClientBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + + /* + * The HTTP client used to send the request. + */ + @Generated + private HttpClient httpClient; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public XmlBytesVerifyClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The HTTP pipeline to send requests through. + */ + @Generated + private HttpPipeline pipeline; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public XmlBytesVerifyClientBuilder pipeline(HttpPipeline pipeline) { + if (this.pipeline != null && pipeline == null) { + LOGGER.atInfo().log("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. + */ + @Generated + private HttpLogOptions httpLogOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public XmlBytesVerifyClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a request. + */ + @Generated + private ClientOptions clientOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public XmlBytesVerifyClientBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated + private RetryOptions retryOptions; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public XmlBytesVerifyClientBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public XmlBytesVerifyClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { + Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null."); + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service client. + */ + @Generated + private Configuration configuration; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public XmlBytesVerifyClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated + private String endpoint; + + /** + * {@inheritDoc}. + */ + @Generated + @Override + public XmlBytesVerifyClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated + private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the XmlBytesVerifyClientBuilder. + */ + @Generated + public XmlBytesVerifyClientBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Builds an instance of XmlBytesVerifyClientImpl with the provided parameters. + * + * @return an instance of XmlBytesVerifyClientImpl. + */ + @Generated + private XmlBytesVerifyClientImpl buildInnerClient() { + this.validateClient(); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + XmlBytesVerifyClientImpl client = new XmlBytesVerifyClientImpl(localPipeline, + JacksonAdapter.createDefaultSerializerAdapter(), this.endpoint); + return client; + } + + @Generated + private void validateClient() { + // This method is invoked from 'buildInnerClient'/'buildClient' method. + // Developer can customize this method, to validate that the necessary conditions are met for the new client. + Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration + = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions; + ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions; + List policies = new ArrayList<>(); + String clientName = PROPERTIES.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(localClientOptions, localHttpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = CoreUtils.createHttpHeadersFromClientOptions(localClientOptions); + if (headers != null) { + policies.add(new AddHeadersPolicy(headers)); + } + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(p -> policies.add(p)); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(localHttpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(localClientOptions) + .build(); + return httpPipeline; + } + + /** + * Builds an instance of XmlBytesVerifyAsyncClient class. + * + * @return an instance of XmlBytesVerifyAsyncClient. + */ + @Generated + public XmlBytesVerifyAsyncClient buildAsyncClient() { + return new XmlBytesVerifyAsyncClient(buildInnerClient()); + } + + /** + * Builds an instance of XmlBytesVerifyClient class. + * + * @return an instance of XmlBytesVerifyClient. + */ + @Generated + public XmlBytesVerifyClient buildClient() { + return new XmlBytesVerifyClient(buildInnerClient()); + } + + private static final ClientLogger LOGGER = new ClientLogger(XmlBytesVerifyClientBuilder.class); +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/xmlbytesverify/implementation/XmlBytesVerifyClientImpl.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/xmlbytesverify/implementation/XmlBytesVerifyClientImpl.java new file mode 100644 index 00000000000..7c7708d2d05 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/xmlbytesverify/implementation/XmlBytesVerifyClientImpl.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.xmlbytesverify.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.core.util.serializer.SerializerAdapter; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the XmlBytesVerifyClient type. + */ +public final class XmlBytesVerifyClientImpl { + /** + * The proxy service used to perform REST calls. + */ + private final XmlBytesVerifyClientService service; + + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * The HTTP pipeline to send requests through. + */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** + * The serializer to serialize an object into a string. + */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + public SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** + * Initializes an instance of XmlBytesVerifyClient client. + * + * @param endpoint Service host. + */ + public XmlBytesVerifyClientImpl(String endpoint) { + this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), + JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of XmlBytesVerifyClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint Service host. + */ + public XmlBytesVerifyClientImpl(HttpPipeline httpPipeline, String endpoint) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + } + + /** + * Initializes an instance of XmlBytesVerifyClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint Service host. + */ + public XmlBytesVerifyClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.endpoint = endpoint; + this.service + = RestProxy.create(XmlBytesVerifyClientService.class, this.httpPipeline, this.getSerializerAdapter()); + } + + /** + * The interface defining all the services for XmlBytesVerifyClient to be used by the proxy service to perform REST + * calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "XmlBytesVerifyClient") + public interface XmlBytesVerifyClientService { + @Get("/xml-bytes") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getWmtsCapabilities(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + + @Get("/xml-bytes") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getWmtsCapabilitiesSync(@HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); + } + + /** + * The getWmtsCapabilities operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * byte[]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @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. + * @return represent a byte array along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getWmtsCapabilitiesWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/xml"; + return FluxUtil + .withContext(context -> service.getWmtsCapabilities(this.getEndpoint(), accept, requestOptions, context)); + } + + /** + * The getWmtsCapabilities operation. + *

Response Body Schema

+ * + *
+     * {@code
+     * byte[]
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @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. + * @return represent a byte array along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWmtsCapabilitiesWithResponse(RequestOptions requestOptions) { + final String accept = "application/xml"; + return service.getWmtsCapabilitiesSync(this.getEndpoint(), accept, requestOptions, Context.NONE); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/xmlbytesverify/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/xmlbytesverify/implementation/package-info.java new file mode 100644 index 00000000000..eb0c82af6f4 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/xmlbytesverify/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the implementations for XmlBytesVerify. + * + */ +package tsptest.xmlbytesverify.implementation; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/xmlbytesverify/package-info.java b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/xmlbytesverify/package-info.java new file mode 100644 index 00000000000..0ecb124129b --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/xmlbytesverify/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * + * Package containing the classes for XmlBytesVerify. + * + */ +package tsptest.xmlbytesverify; diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-xmlbytesverify_metadata.json b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-xmlbytesverify_metadata.json new file mode 100644 index 00000000000..4f28e86a159 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/META-INF/tsptest-xmlbytesverify_metadata.json @@ -0,0 +1 @@ +{"flavor":"Azure","apiVersions":{},"crossLanguagePackageId":"TspTest.XmlBytesVerify","crossLanguageVersion":"cac435f1a85f","crossLanguageDefinitions":{"tsptest.xmlbytesverify.XmlBytesVerifyAsyncClient":"TspTest.XmlBytesVerify","tsptest.xmlbytesverify.XmlBytesVerifyAsyncClient.getWmtsCapabilities":"TspTest.XmlBytesVerify.getWmtsCapabilities","tsptest.xmlbytesverify.XmlBytesVerifyAsyncClient.getWmtsCapabilitiesWithResponse":"TspTest.XmlBytesVerify.getWmtsCapabilities","tsptest.xmlbytesverify.XmlBytesVerifyClient":"TspTest.XmlBytesVerify","tsptest.xmlbytesverify.XmlBytesVerifyClient.getWmtsCapabilities":"TspTest.XmlBytesVerify.getWmtsCapabilities","tsptest.xmlbytesverify.XmlBytesVerifyClient.getWmtsCapabilitiesWithResponse":"TspTest.XmlBytesVerify.getWmtsCapabilities","tsptest.xmlbytesverify.XmlBytesVerifyClientBuilder":"TspTest.XmlBytesVerify"},"generatedFiles":["src/main/java/module-info.java","src/main/java/tsptest/xmlbytesverify/XmlBytesVerifyAsyncClient.java","src/main/java/tsptest/xmlbytesverify/XmlBytesVerifyClient.java","src/main/java/tsptest/xmlbytesverify/XmlBytesVerifyClientBuilder.java","src/main/java/tsptest/xmlbytesverify/implementation/XmlBytesVerifyClientImpl.java","src/main/java/tsptest/xmlbytesverify/implementation/package-info.java","src/main/java/tsptest/xmlbytesverify/package-info.java"]} \ No newline at end of file diff --git a/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-xmlbytesverify.properties b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-xmlbytesverify.properties new file mode 100644 index 00000000000..ca812989b4f --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/main/resources/tsptest-xmlbytesverify.properties @@ -0,0 +1,2 @@ +name=${project.artifactId} +version=${project.version} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/xmlbytesverify/XmlBytesVerifyTests.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/xmlbytesverify/XmlBytesVerifyTests.java new file mode 100644 index 00000000000..0b5bde77d27 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/xmlbytesverify/XmlBytesVerifyTests.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package tsptest.xmlbytesverify; + +import java.lang.reflect.Field; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +/** + * Regression test for XML serializer gating. + * + * An operation whose response content-type is {@code application/xml} but whose body is raw {@code bytes} (not a + * structured model) must NOT generate the static XML {@code ObjectSerializer XML_SERIALIZER} field, because the + * {@code XmlSerializerProviders} helper it references is only generated for models actually used in XML. + */ +public class XmlBytesVerifyTests { + + private static boolean hasSerializerField(Class clazz) { + return Arrays.stream(clazz.getDeclaredFields()).anyMatch(f -> "XML_SERIALIZER".equals(f.getName())); + } + + @Test + public void noXmlSerializerFieldForBytesPayload() { + Assertions.assertFalse(hasSerializerField(XmlBytesVerifyClient.class), + "XmlBytesVerifyClient should not declare a static XML_SERIALIZER field for a raw bytes XML payload."); + Assertions.assertFalse(hasSerializerField(XmlBytesVerifyAsyncClient.class), + "XmlBytesVerifyAsyncClient should not declare a static XML_SERIALIZER field for a raw bytes XML payload."); + } + + @Test + public void xmlSerializerFieldPresentForModelPayload() throws ClassNotFoundException { + // Positive control: a real XML model client does declare the SERIALIZER field, ensuring the reflection + // check above is meaningful and would catch a regression that emits XML_SERIALIZER unconditionally. + Class modelClient = Class.forName("payload.xml.SimpleModelValueClient"); + Field serializer = Arrays.stream(modelClient.getDeclaredFields()) + .filter(f -> "XML_SERIALIZER".equals(f.getName())) + .findFirst() + .orElse(null); + Assertions.assertNotNull(serializer, + "payload.xml.SimpleModelValueClient should declare a XML_SERIALIZER field."); + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/xmlbytesverify/generated/XmlBytesVerifyClientTestBase.java b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/xmlbytesverify/generated/XmlBytesVerifyClientTestBase.java new file mode 100644 index 00000000000..cc4d45b2f0d --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/src/test/java/tsptest/xmlbytesverify/generated/XmlBytesVerifyClientTestBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package tsptest.xmlbytesverify.generated; + +// The Java test files under 'generated' package are generated for your reference. +// If you wish to modify these files, please copy them out of the 'generated' package, and modify there. +// See https://aka.ms/azsdk/dpg/java/tests for guide on adding a test. + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.test.TestMode; +import com.azure.core.test.TestProxyTestBase; +import com.azure.core.util.Configuration; +import tsptest.xmlbytesverify.XmlBytesVerifyClient; +import tsptest.xmlbytesverify.XmlBytesVerifyClientBuilder; + +class XmlBytesVerifyClientTestBase extends TestProxyTestBase { + protected XmlBytesVerifyClient xmlBytesVerifyClient; + + @Override + protected void beforeTest() { + XmlBytesVerifyClientBuilder xmlBytesVerifyClientbuilder = new XmlBytesVerifyClientBuilder() + .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint")) + .httpClient(getHttpClientOrUsePlayback(getHttpClients().findFirst().orElse(null))) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)); + if (getTestMode() == TestMode.RECORD) { + xmlBytesVerifyClientbuilder.addPolicy(interceptorManager.getRecordPolicy()); + } + xmlBytesVerifyClient = xmlBytesVerifyClientbuilder.buildClient(); + + } +} diff --git a/packages/http-client-java/generator/http-client-generator-test/tsp/xml-bytes-verify.tsp b/packages/http-client-java/generator/http-client-generator-test/tsp/xml-bytes-verify.tsp new file mode 100644 index 00000000000..0869e9e04a2 --- /dev/null +++ b/packages/http-client-java/generator/http-client-generator-test/tsp/xml-bytes-verify.tsp @@ -0,0 +1,20 @@ +import "@typespec/rest"; +import "@typespec/http"; +import "@azure-tools/typespec-client-generator-core"; + +using TypeSpec.Http; +using TypeSpec.Rest; +using Azure.ClientGenerator.Core; + +@service(#{ title: "XmlBytesVerify" }) +namespace TspTest.XmlBytesVerify; + +// Operation that returns a raw XML document as bytes (like planetarycomputer getWmtsCapabilities). +// The response content-type is application/xml but the body is unstructured bytes, so NO XML +// ObjectSerializer (SERIALIZER) should be generated/used. +@route("/xml-bytes") +@get +op getWmtsCapabilities(): OkResponse & { + @header("content-type") contentType: "application/xml"; + @body body: bytes; +}; diff --git a/packages/http-client-java/generator/http-client-generator/src/main/java/com/microsoft/typespec/http/client/generator/TypeSpecPlugin.java b/packages/http-client-java/generator/http-client-generator/src/main/java/com/microsoft/typespec/http/client/generator/TypeSpecPlugin.java index 93728dc59be..9715173ef60 100644 --- a/packages/http-client-java/generator/http-client-generator/src/main/java/com/microsoft/typespec/http/client/generator/TypeSpecPlugin.java +++ b/packages/http-client-java/generator/http-client-generator/src/main/java/com/microsoft/typespec/http/client/generator/TypeSpecPlugin.java @@ -129,8 +129,9 @@ protected void writeHelperClasses(Client client, CodeModel codeModel, JavaPackag } } - // XmlSerializer + // XmlSerializer, only for the azure-core (v1) data-plane flavor final boolean generateXmlSerializer = JavaSettings.getInstance().isAzureV1() + && JavaSettings.getInstance().isDataPlaneClient() && client.getModels().stream().filter(ModelUtil::isGeneratingModel).anyMatch(ClientModel::isUsedInXml); if (generateXmlSerializer) { javaPackage.addJavaFromResources(settings.getPackage(settings.getImplementationSubpackage()),