updatedProperties = new HashSet<>();
+
+ @Metadata(generated = true)
+ private boolean jsonMergePatch;
+
+ @Metadata(generated = true)
+ private void serializeAsJsonMergePatch(boolean jsonMergePatch) {
+ this.jsonMergePatch = jsonMergePatch;
+ }
+
+ static {
+ JsonMergePatchHelper.setInnerModelAccessor(new JsonMergePatchHelper.InnerModelAccessor() {
+ @Override
+ public InnerModel prepareModelForJsonMergePatch(InnerModel model, boolean jsonMergePatchEnabled) {
+ model.serializeAsJsonMergePatch(jsonMergePatchEnabled);
+ return model;
+ }
+
+ @Override
+ public boolean isJsonMergePatch(InnerModel model) {
+ return model.jsonMergePatch;
+ }
+ });
+ }
+
+ /**
+ * Creates an instance of InnerModel class.
+ */
+ @Metadata(generated = true)
+ public InnerModel() {
+ }
+
+ /**
+ * Get the name property: The name property.
+ *
+ * @return the name value.
+ */
+ @Metadata(generated = true)
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * Set the name property: The name property.
+ *
+ * @param name the name value to set.
+ * @return the InnerModel object itself.
+ */
+ @Metadata(generated = true)
+ public InnerModel setName(String name) {
+ this.name = name;
+ this.updatedProperties.add("name");
+ return this;
+ }
+
+ /**
+ * Get the description property: The description property.
+ *
+ * @return the description value.
+ */
+ @Metadata(generated = true)
+ public String getDescription() {
+ return this.description;
+ }
+
+ /**
+ * Set the description property: The description property.
+ *
+ * @param description the description value to set.
+ * @return the InnerModel object itself.
+ */
+ @Metadata(generated = true)
+ public InnerModel setDescription(String description) {
+ this.description = description;
+ this.updatedProperties.add("description");
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Metadata(generated = true)
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ if (jsonMergePatch) {
+ return toJsonMergePatch(jsonWriter);
+ } else {
+ jsonWriter.writeStartObject();
+ jsonWriter.writeStringField("name", this.name);
+ jsonWriter.writeStringField("description", this.description);
+ return jsonWriter.writeEndObject();
+ }
+ }
+
+ @Metadata(generated = true)
+ private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ if (updatedProperties.contains("name")) {
+ if (this.name == null) {
+ jsonWriter.writeNullField("name");
+ } else {
+ jsonWriter.writeStringField("name", this.name);
+ }
+ }
+ if (updatedProperties.contains("description")) {
+ if (this.description == null) {
+ jsonWriter.writeNullField("description");
+ } else {
+ jsonWriter.writeStringField("description", this.description);
+ }
+ }
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of InnerModel from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of InnerModel if the JsonReader was pointing to an instance of it, or null if it was pointing
+ * to JSON null.
+ * @throws IOException If an error occurs while reading the InnerModel.
+ */
+ @Metadata(generated = true)
+ public static InnerModel fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ InnerModel deserializedInnerModel = new InnerModel();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("name".equals(fieldName)) {
+ deserializedInnerModel.name = reader.getString();
+ } else if ("description".equals(fieldName)) {
+ deserializedInnerModel.description = reader.getString();
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedInnerModel;
+ });
+ }
+}
diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/jsonmergepatch/JsonMergePatchClient.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/jsonmergepatch/JsonMergePatchClient.java
new file mode 100644
index 0000000000..c99278e2bf
--- /dev/null
+++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/jsonmergepatch/JsonMergePatchClient.java
@@ -0,0 +1,303 @@
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package payload.jsonmergepatch;
+
+import io.clientcore.core.annotation.Metadata;
+import io.clientcore.core.annotation.ServiceClient;
+import io.clientcore.core.http.exception.HttpResponseException;
+import io.clientcore.core.http.models.RequestOptions;
+import io.clientcore.core.http.models.Response;
+import io.clientcore.core.util.binarydata.BinaryData;
+import payload.jsonmergepatch.implementation.JsonMergePatchClientImpl;
+import payload.jsonmergepatch.implementation.JsonMergePatchHelper;
+
+/**
+ * Initializes a new instance of the synchronous JsonMergePatchClient type.
+ */
+@ServiceClient(builder = JsonMergePatchClientBuilder.class)
+public final class JsonMergePatchClient {
+ @Metadata(generated = true)
+ private final JsonMergePatchClientImpl serviceClient;
+
+ /**
+ * Initializes an instance of JsonMergePatchClient class.
+ *
+ * @param serviceClient the service client implementation.
+ */
+ @Metadata(generated = true)
+ JsonMergePatchClient(JsonMergePatchClientImpl serviceClient) {
+ this.serviceClient = serviceClient;
+ }
+
+ /**
+ * Test content-type: application/merge-patch+json with required body.
+ * Request Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * description: String (Optional)
+ * map (Optional): {
+ * String (Required): {
+ * name: String (Optional)
+ * description: String (Optional)
+ * }
+ * }
+ * array (Optional): [
+ * (recursive schema, see above)
+ * ]
+ * intValue: Integer (Optional)
+ * floatValue: Double (Optional)
+ * innerModel (Optional): (recursive schema, see innerModel above)
+ * intArray (Optional): [
+ * int (Optional)
+ * ]
+ * }
+ * }
+ *
+ *
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * description: String (Optional)
+ * map (Optional): {
+ * String (Required): {
+ * name: String (Optional)
+ * description: String (Optional)
+ * }
+ * }
+ * array (Optional): [
+ * (recursive schema, see above)
+ * ]
+ * intValue: Integer (Optional)
+ * floatValue: Double (Optional)
+ * innerModel (Optional): (recursive schema, see innerModel above)
+ * intArray (Optional): [
+ * int (Optional)
+ * ]
+ * }
+ * }
+ *
+ *
+ * @param body The body parameter.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the service returns an error.
+ * @return details about a resource.
+ */
+ @Metadata(generated = true)
+ public Response createResourceWithResponse(BinaryData body, RequestOptions requestOptions) {
+ return this.serviceClient.createResourceWithResponse(body, requestOptions);
+ }
+
+ /**
+ * Test content-type: application/merge-patch+json with required body.
+ * Request Body Schema
+ *
+ *
+ * {@code
+ * {
+ * description: String (Optional)
+ * map (Optional): {
+ * String (Required): {
+ * name: String (Optional)
+ * description: String (Optional)
+ * }
+ * }
+ * array (Optional): [
+ * (recursive schema, see above)
+ * ]
+ * intValue: Integer (Optional)
+ * floatValue: Double (Optional)
+ * innerModel (Optional): (recursive schema, see innerModel above)
+ * intArray (Optional): [
+ * int (Optional)
+ * ]
+ * }
+ * }
+ *
+ *
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * description: String (Optional)
+ * map (Optional): {
+ * String (Required): {
+ * name: String (Optional)
+ * description: String (Optional)
+ * }
+ * }
+ * array (Optional): [
+ * (recursive schema, see above)
+ * ]
+ * intValue: Integer (Optional)
+ * floatValue: Double (Optional)
+ * innerModel (Optional): (recursive schema, see innerModel above)
+ * intArray (Optional): [
+ * int (Optional)
+ * ]
+ * }
+ * }
+ *
+ *
+ * @param body The body parameter.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the service returns an error.
+ * @return details about a resource.
+ */
+ @Metadata(generated = true)
+ public Response updateResourceWithResponse(BinaryData body, RequestOptions requestOptions) {
+ return this.serviceClient.updateResourceWithResponse(body, requestOptions);
+ }
+
+ /**
+ * Test content-type: application/merge-patch+json with optional body.
+ * Header Parameters
+ *
+ * Header Parameters
+ * Name | Type | Required | Description |
+ * Content-Type | String | No | The content type. Allowed values:
+ * "application/merge-patch+json". |
+ *
+ * You can add these to a request with {@link RequestOptions#addHeader}
+ * Request Body Schema
+ *
+ *
+ * {@code
+ * {
+ * description: String (Optional)
+ * map (Optional): {
+ * String (Required): {
+ * name: String (Optional)
+ * description: String (Optional)
+ * }
+ * }
+ * array (Optional): [
+ * (recursive schema, see above)
+ * ]
+ * intValue: Integer (Optional)
+ * floatValue: Double (Optional)
+ * innerModel (Optional): (recursive schema, see innerModel above)
+ * intArray (Optional): [
+ * int (Optional)
+ * ]
+ * }
+ * }
+ *
+ *
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * description: String (Optional)
+ * map (Optional): {
+ * String (Required): {
+ * name: String (Optional)
+ * description: String (Optional)
+ * }
+ * }
+ * array (Optional): [
+ * (recursive schema, see above)
+ * ]
+ * intValue: Integer (Optional)
+ * floatValue: Double (Optional)
+ * innerModel (Optional): (recursive schema, see innerModel above)
+ * intArray (Optional): [
+ * int (Optional)
+ * ]
+ * }
+ * }
+ *
+ *
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the service returns an error.
+ * @return details about a resource.
+ */
+ @Metadata(generated = true)
+ public Response updateOptionalResourceWithResponse(RequestOptions requestOptions) {
+ return this.serviceClient.updateOptionalResourceWithResponse(requestOptions);
+ }
+
+ /**
+ * Test content-type: application/merge-patch+json with required body.
+ *
+ * @param body The body parameter.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the service returns an error.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return details about a resource.
+ */
+ @Metadata(generated = true)
+ public Resource createResource(Resource body) {
+ // Generated convenience method for createResourceWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return createResourceWithResponse(BinaryData.fromObject(body), requestOptions).getValue();
+ }
+
+ /**
+ * Test content-type: application/merge-patch+json with required body.
+ *
+ * @param body The body parameter.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the service returns an error.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return details about a resource.
+ */
+ @Metadata(generated = true)
+ public Resource updateResource(ResourcePatch body) {
+ // Generated convenience method for updateResourceWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ JsonMergePatchHelper.getResourcePatchAccessor().prepareModelForJsonMergePatch(body, true);
+ BinaryData bodyInBinaryData = BinaryData.fromObject(body);
+ // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization.
+ bodyInBinaryData.getLength();
+ JsonMergePatchHelper.getResourcePatchAccessor().prepareModelForJsonMergePatch(body, false);
+ return updateResourceWithResponse(bodyInBinaryData, requestOptions).getValue();
+ }
+
+ /**
+ * Test content-type: application/merge-patch+json with optional body.
+ *
+ * @param body The body parameter.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the service returns an error.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return details about a resource.
+ */
+ @Metadata(generated = true)
+ public Resource updateOptionalResource(ResourcePatch body) {
+ // Generated convenience method for updateOptionalResourceWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ if (body != null) {
+ JsonMergePatchHelper.getResourcePatchAccessor().prepareModelForJsonMergePatch(body, true);
+ BinaryData bodyInBinaryData = BinaryData.fromObject(body);
+ // BinaryData.fromObject() will not fire serialization, use getLength() to fire serialization.
+ bodyInBinaryData.getLength();
+ JsonMergePatchHelper.getResourcePatchAccessor().prepareModelForJsonMergePatch(body, false);
+ requestOptions.setBody(bodyInBinaryData);
+ }
+ return updateOptionalResourceWithResponse(requestOptions).getValue();
+ }
+
+ /**
+ * Test content-type: application/merge-patch+json with optional body.
+ *
+ * @throws HttpResponseException thrown if the service returns an error.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return details about a resource.
+ */
+ @Metadata(generated = true)
+ public Resource updateOptionalResource() {
+ // Generated convenience method for updateOptionalResourceWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return updateOptionalResourceWithResponse(requestOptions).getValue();
+ }
+}
diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/jsonmergepatch/JsonMergePatchClientBuilder.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/jsonmergepatch/JsonMergePatchClientBuilder.java
new file mode 100644
index 0000000000..0a3fd08c6e
--- /dev/null
+++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/jsonmergepatch/JsonMergePatchClientBuilder.java
@@ -0,0 +1,241 @@
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package payload.jsonmergepatch;
+
+import io.clientcore.core.annotation.Metadata;
+import io.clientcore.core.annotation.ServiceClientBuilder;
+import io.clientcore.core.http.client.HttpClient;
+import io.clientcore.core.http.models.HttpLogOptions;
+import io.clientcore.core.http.models.HttpRedirectOptions;
+import io.clientcore.core.http.models.HttpRetryOptions;
+import io.clientcore.core.http.models.ProxyOptions;
+import io.clientcore.core.http.pipeline.HttpLoggingPolicy;
+import io.clientcore.core.http.pipeline.HttpPipeline;
+import io.clientcore.core.http.pipeline.HttpPipelineBuilder;
+import io.clientcore.core.http.pipeline.HttpPipelinePolicy;
+import io.clientcore.core.http.pipeline.HttpRedirectPolicy;
+import io.clientcore.core.http.pipeline.HttpRetryPolicy;
+import io.clientcore.core.models.traits.ConfigurationTrait;
+import io.clientcore.core.models.traits.EndpointTrait;
+import io.clientcore.core.models.traits.HttpTrait;
+import io.clientcore.core.models.traits.ProxyTrait;
+import io.clientcore.core.util.ClientLogger;
+import io.clientcore.core.util.configuration.Configuration;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import payload.jsonmergepatch.implementation.JsonMergePatchClientImpl;
+
+/**
+ * A builder for creating a new instance of the JsonMergePatchClient type.
+ */
+@ServiceClientBuilder(serviceClients = { JsonMergePatchClient.class })
+public final class JsonMergePatchClientBuilder
+ implements HttpTrait, ProxyTrait,
+ ConfigurationTrait, EndpointTrait {
+ @Metadata(generated = true)
+ private static final String SDK_NAME = "name";
+
+ @Metadata(generated = true)
+ private static final String SDK_VERSION = "version";
+
+ @Metadata(generated = true)
+ private final List pipelinePolicies;
+
+ /**
+ * Create an instance of the JsonMergePatchClientBuilder.
+ */
+ @Metadata(generated = true)
+ public JsonMergePatchClientBuilder() {
+ this.pipelinePolicies = new ArrayList<>();
+ }
+
+ /*
+ * The HTTP pipeline to send requests through.
+ */
+ @Metadata(generated = true)
+ private HttpPipeline pipeline;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Metadata(generated = true)
+ @Override
+ public JsonMergePatchClientBuilder httpPipeline(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 HTTP client used to send the request.
+ */
+ @Metadata(generated = true)
+ private HttpClient httpClient;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Metadata(generated = true)
+ @Override
+ public JsonMergePatchClientBuilder httpClient(HttpClient httpClient) {
+ this.httpClient = httpClient;
+ return this;
+ }
+
+ /*
+ * The logging configuration for HTTP requests and responses.
+ */
+ @Metadata(generated = true)
+ private HttpLogOptions httpLogOptions;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Metadata(generated = true)
+ @Override
+ public JsonMergePatchClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) {
+ this.httpLogOptions = httpLogOptions;
+ return this;
+ }
+
+ /*
+ * The retry options to configure retry policy for failed requests.
+ */
+ @Metadata(generated = true)
+ private HttpRetryOptions retryOptions;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Metadata(generated = true)
+ @Override
+ public JsonMergePatchClientBuilder httpRetryOptions(HttpRetryOptions retryOptions) {
+ this.retryOptions = retryOptions;
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Metadata(generated = true)
+ @Override
+ public JsonMergePatchClientBuilder addHttpPipelinePolicy(HttpPipelinePolicy customPolicy) {
+ Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null.");
+ pipelinePolicies.add(customPolicy);
+ return this;
+ }
+
+ /*
+ * The redirect options to configure redirect policy
+ */
+ @Metadata(generated = true)
+ private HttpRedirectOptions redirectOptions;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Metadata(generated = true)
+ @Override
+ public JsonMergePatchClientBuilder httpRedirectOptions(HttpRedirectOptions redirectOptions) {
+ this.redirectOptions = redirectOptions;
+ return this;
+ }
+
+ /*
+ * The proxy options used during construction of the service client.
+ */
+ @Metadata(generated = true)
+ private ProxyOptions proxyOptions;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Metadata(generated = true)
+ @Override
+ public JsonMergePatchClientBuilder proxyOptions(ProxyOptions proxyOptions) {
+ this.proxyOptions = proxyOptions;
+ return this;
+ }
+
+ /*
+ * The configuration store that is used during construction of the service client.
+ */
+ @Metadata(generated = true)
+ private Configuration configuration;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Metadata(generated = true)
+ @Override
+ public JsonMergePatchClientBuilder configuration(Configuration configuration) {
+ this.configuration = configuration;
+ return this;
+ }
+
+ /*
+ * The service endpoint
+ */
+ @Metadata(generated = true)
+ private String endpoint;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Metadata(generated = true)
+ @Override
+ public JsonMergePatchClientBuilder endpoint(String endpoint) {
+ this.endpoint = endpoint;
+ return this;
+ }
+
+ /**
+ * Builds an instance of JsonMergePatchClientImpl with the provided parameters.
+ *
+ * @return an instance of JsonMergePatchClientImpl.
+ */
+ @Metadata(generated = true)
+ private JsonMergePatchClientImpl buildInnerClient() {
+ this.validateClient();
+ HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline();
+ String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000";
+ JsonMergePatchClientImpl client = new JsonMergePatchClientImpl(localPipeline, localEndpoint);
+ return client;
+ }
+
+ @Metadata(generated = true)
+ 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.
+ }
+
+ @Metadata(generated = true)
+ private HttpPipeline createHttpPipeline() {
+ Configuration buildConfiguration
+ = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration;
+ HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions;
+ HttpPipelineBuilder httpPipelineBuilder = new HttpPipelineBuilder();
+ List policies = new ArrayList<>();
+ policies.add(redirectOptions == null ? new HttpRedirectPolicy() : new HttpRedirectPolicy(redirectOptions));
+ policies.add(retryOptions == null ? new HttpRetryPolicy() : new HttpRetryPolicy(retryOptions));
+ this.pipelinePolicies.stream().forEach(p -> policies.add(p));
+ policies.add(new HttpLoggingPolicy(localHttpLogOptions));
+ httpPipelineBuilder.policies(policies.toArray(new HttpPipelinePolicy[0]));
+ return httpPipelineBuilder.build();
+ }
+
+ /**
+ * Builds an instance of JsonMergePatchClient class.
+ *
+ * @return an instance of JsonMergePatchClient.
+ */
+ @Metadata(generated = true)
+ public JsonMergePatchClient buildClient() {
+ return new JsonMergePatchClient(buildInnerClient());
+ }
+
+ private static final ClientLogger LOGGER = new ClientLogger(JsonMergePatchClientBuilder.class);
+}
diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/jsonmergepatch/Resource.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/jsonmergepatch/Resource.java
new file mode 100644
index 0000000000..82d7e0e8fd
--- /dev/null
+++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/jsonmergepatch/Resource.java
@@ -0,0 +1,316 @@
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package payload.jsonmergepatch;
+
+import io.clientcore.core.annotation.Metadata;
+import io.clientcore.core.annotation.TypeConditions;
+import io.clientcore.core.serialization.json.JsonReader;
+import io.clientcore.core.serialization.json.JsonSerializable;
+import io.clientcore.core.serialization.json.JsonToken;
+import io.clientcore.core.serialization.json.JsonWriter;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Details about a resource.
+ */
+@Metadata(conditions = { TypeConditions.FLUENT })
+public final class Resource implements JsonSerializable {
+ /*
+ * The name property.
+ */
+ @Metadata(generated = true)
+ private final String name;
+
+ /*
+ * The description property.
+ */
+ @Metadata(generated = true)
+ private String description;
+
+ /*
+ * The map property.
+ */
+ @Metadata(generated = true)
+ private Map map;
+
+ /*
+ * The array property.
+ */
+ @Metadata(generated = true)
+ private List array;
+
+ /*
+ * The intValue property.
+ */
+ @Metadata(generated = true)
+ private Integer intValue;
+
+ /*
+ * The floatValue property.
+ */
+ @Metadata(generated = true)
+ private Double floatValue;
+
+ /*
+ * The innerModel property.
+ */
+ @Metadata(generated = true)
+ private InnerModel innerModel;
+
+ /*
+ * The intArray property.
+ */
+ @Metadata(generated = true)
+ private List intArray;
+
+ /**
+ * Creates an instance of Resource class.
+ *
+ * @param name the name value to set.
+ */
+ @Metadata(generated = true)
+ public Resource(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Get the name property: The name property.
+ *
+ * @return the name value.
+ */
+ @Metadata(generated = true)
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * Get the description property: The description property.
+ *
+ * @return the description value.
+ */
+ @Metadata(generated = true)
+ public String getDescription() {
+ return this.description;
+ }
+
+ /**
+ * Set the description property: The description property.
+ *
+ * @param description the description value to set.
+ * @return the Resource object itself.
+ */
+ @Metadata(generated = true)
+ public Resource setDescription(String description) {
+ this.description = description;
+ return this;
+ }
+
+ /**
+ * Get the map property: The map property.
+ *
+ * @return the map value.
+ */
+ @Metadata(generated = true)
+ public Map getMap() {
+ return this.map;
+ }
+
+ /**
+ * Set the map property: The map property.
+ *
+ * @param map the map value to set.
+ * @return the Resource object itself.
+ */
+ @Metadata(generated = true)
+ public Resource setMap(Map map) {
+ this.map = map;
+ return this;
+ }
+
+ /**
+ * Get the array property: The array property.
+ *
+ * @return the array value.
+ */
+ @Metadata(generated = true)
+ public List getArray() {
+ return this.array;
+ }
+
+ /**
+ * Set the array property: The array property.
+ *
+ * @param array the array value to set.
+ * @return the Resource object itself.
+ */
+ @Metadata(generated = true)
+ public Resource setArray(List array) {
+ this.array = array;
+ return this;
+ }
+
+ /**
+ * Get the intValue property: The intValue property.
+ *
+ * @return the intValue value.
+ */
+ @Metadata(generated = true)
+ public Integer getIntValue() {
+ return this.intValue;
+ }
+
+ /**
+ * Set the intValue property: The intValue property.
+ *
+ * @param intValue the intValue value to set.
+ * @return the Resource object itself.
+ */
+ @Metadata(generated = true)
+ public Resource setIntValue(Integer intValue) {
+ this.intValue = intValue;
+ return this;
+ }
+
+ /**
+ * Get the floatValue property: The floatValue property.
+ *
+ * @return the floatValue value.
+ */
+ @Metadata(generated = true)
+ public Double getFloatValue() {
+ return this.floatValue;
+ }
+
+ /**
+ * Set the floatValue property: The floatValue property.
+ *
+ * @param floatValue the floatValue value to set.
+ * @return the Resource object itself.
+ */
+ @Metadata(generated = true)
+ public Resource setFloatValue(Double floatValue) {
+ this.floatValue = floatValue;
+ return this;
+ }
+
+ /**
+ * Get the innerModel property: The innerModel property.
+ *
+ * @return the innerModel value.
+ */
+ @Metadata(generated = true)
+ public InnerModel getInnerModel() {
+ return this.innerModel;
+ }
+
+ /**
+ * Set the innerModel property: The innerModel property.
+ *
+ * @param innerModel the innerModel value to set.
+ * @return the Resource object itself.
+ */
+ @Metadata(generated = true)
+ public Resource setInnerModel(InnerModel innerModel) {
+ this.innerModel = innerModel;
+ return this;
+ }
+
+ /**
+ * Get the intArray property: The intArray property.
+ *
+ * @return the intArray value.
+ */
+ @Metadata(generated = true)
+ public List getIntArray() {
+ return this.intArray;
+ }
+
+ /**
+ * Set the intArray property: The intArray property.
+ *
+ * @param intArray the intArray value to set.
+ * @return the Resource object itself.
+ */
+ @Metadata(generated = true)
+ public Resource setIntArray(List intArray) {
+ this.intArray = intArray;
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Metadata(generated = true)
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ jsonWriter.writeStringField("name", this.name);
+ jsonWriter.writeStringField("description", this.description);
+ jsonWriter.writeMapField("map", this.map, (writer, element) -> writer.writeJson(element));
+ jsonWriter.writeArrayField("array", this.array, (writer, element) -> writer.writeJson(element));
+ jsonWriter.writeNumberField("intValue", this.intValue);
+ jsonWriter.writeNumberField("floatValue", this.floatValue);
+ jsonWriter.writeJsonField("innerModel", this.innerModel);
+ jsonWriter.writeArrayField("intArray", this.intArray, (writer, element) -> writer.writeInt(element));
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of Resource from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of Resource if the JsonReader was pointing to an instance of it, or null if it was pointing
+ * to JSON null.
+ * @throws IllegalStateException If the deserialized JSON object was missing any required properties.
+ * @throws IOException If an error occurs while reading the Resource.
+ */
+ @Metadata(generated = true)
+ public static Resource fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ String name = null;
+ String description = null;
+ Map map = null;
+ List array = null;
+ Integer intValue = null;
+ Double floatValue = null;
+ InnerModel innerModel = null;
+ List intArray = null;
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("name".equals(fieldName)) {
+ name = reader.getString();
+ } else if ("description".equals(fieldName)) {
+ description = reader.getString();
+ } else if ("map".equals(fieldName)) {
+ map = reader.readMap(reader1 -> InnerModel.fromJson(reader1));
+ } else if ("array".equals(fieldName)) {
+ array = reader.readArray(reader1 -> InnerModel.fromJson(reader1));
+ } else if ("intValue".equals(fieldName)) {
+ intValue = reader.getNullable(JsonReader::getInt);
+ } else if ("floatValue".equals(fieldName)) {
+ floatValue = reader.getNullable(JsonReader::getDouble);
+ } else if ("innerModel".equals(fieldName)) {
+ innerModel = InnerModel.fromJson(reader);
+ } else if ("intArray".equals(fieldName)) {
+ intArray = reader.readArray(reader1 -> reader1.getInt());
+ } else {
+ reader.skipChildren();
+ }
+ }
+ Resource deserializedResource = new Resource(name);
+ deserializedResource.description = description;
+ deserializedResource.map = map;
+ deserializedResource.array = array;
+ deserializedResource.intValue = intValue;
+ deserializedResource.floatValue = floatValue;
+ deserializedResource.innerModel = innerModel;
+ deserializedResource.intArray = intArray;
+
+ return deserializedResource;
+ });
+ }
+}
diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/jsonmergepatch/ResourcePatch.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/jsonmergepatch/ResourcePatch.java
new file mode 100644
index 0000000000..4fa2902a7b
--- /dev/null
+++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/jsonmergepatch/ResourcePatch.java
@@ -0,0 +1,389 @@
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package payload.jsonmergepatch;
+
+import io.clientcore.core.annotation.Metadata;
+import io.clientcore.core.annotation.TypeConditions;
+import io.clientcore.core.serialization.json.JsonReader;
+import io.clientcore.core.serialization.json.JsonSerializable;
+import io.clientcore.core.serialization.json.JsonToken;
+import io.clientcore.core.serialization.json.JsonWriter;
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import payload.jsonmergepatch.implementation.JsonMergePatchHelper;
+
+/**
+ * Details about a resource for patch operation.
+ */
+@Metadata(conditions = { TypeConditions.FLUENT })
+public final class ResourcePatch implements JsonSerializable {
+ /*
+ * The description property.
+ */
+ @Metadata(generated = true)
+ private String description;
+
+ /*
+ * The map property.
+ */
+ @Metadata(generated = true)
+ private Map map;
+
+ /*
+ * The array property.
+ */
+ @Metadata(generated = true)
+ private List array;
+
+ /*
+ * The intValue property.
+ */
+ @Metadata(generated = true)
+ private Integer intValue;
+
+ /*
+ * The floatValue property.
+ */
+ @Metadata(generated = true)
+ private Double floatValue;
+
+ /*
+ * The innerModel property.
+ */
+ @Metadata(generated = true)
+ private InnerModel innerModel;
+
+ /*
+ * The intArray property.
+ */
+ @Metadata(generated = true)
+ private List intArray;
+
+ /**
+ * Stores updated model property, the value is property name, not serialized name.
+ */
+ @Metadata(generated = true)
+ private final Set updatedProperties = new HashSet<>();
+
+ @Metadata(generated = true)
+ private boolean jsonMergePatch;
+
+ @Metadata(generated = true)
+ private void serializeAsJsonMergePatch(boolean jsonMergePatch) {
+ this.jsonMergePatch = jsonMergePatch;
+ }
+
+ static {
+ JsonMergePatchHelper.setResourcePatchAccessor(new JsonMergePatchHelper.ResourcePatchAccessor() {
+ @Override
+ public ResourcePatch prepareModelForJsonMergePatch(ResourcePatch model, boolean jsonMergePatchEnabled) {
+ model.serializeAsJsonMergePatch(jsonMergePatchEnabled);
+ return model;
+ }
+
+ @Override
+ public boolean isJsonMergePatch(ResourcePatch model) {
+ return model.jsonMergePatch;
+ }
+ });
+ }
+
+ /**
+ * Creates an instance of ResourcePatch class.
+ */
+ @Metadata(generated = true)
+ public ResourcePatch() {
+ }
+
+ /**
+ * Get the description property: The description property.
+ *
+ * @return the description value.
+ */
+ @Metadata(generated = true)
+ public String getDescription() {
+ return this.description;
+ }
+
+ /**
+ * Set the description property: The description property.
+ *
+ * @param description the description value to set.
+ * @return the ResourcePatch object itself.
+ */
+ @Metadata(generated = true)
+ public ResourcePatch setDescription(String description) {
+ this.description = description;
+ this.updatedProperties.add("description");
+ return this;
+ }
+
+ /**
+ * Get the map property: The map property.
+ *
+ * @return the map value.
+ */
+ @Metadata(generated = true)
+ public Map getMap() {
+ return this.map;
+ }
+
+ /**
+ * Set the map property: The map property.
+ *
+ * @param map the map value to set.
+ * @return the ResourcePatch object itself.
+ */
+ @Metadata(generated = true)
+ public ResourcePatch setMap(Map map) {
+ this.map = map;
+ this.updatedProperties.add("map");
+ return this;
+ }
+
+ /**
+ * Get the array property: The array property.
+ *
+ * @return the array value.
+ */
+ @Metadata(generated = true)
+ public List getArray() {
+ return this.array;
+ }
+
+ /**
+ * Set the array property: The array property.
+ *
+ * @param array the array value to set.
+ * @return the ResourcePatch object itself.
+ */
+ @Metadata(generated = true)
+ public ResourcePatch setArray(List array) {
+ this.array = array;
+ this.updatedProperties.add("array");
+ return this;
+ }
+
+ /**
+ * Get the intValue property: The intValue property.
+ *
+ * @return the intValue value.
+ */
+ @Metadata(generated = true)
+ public Integer getIntValue() {
+ return this.intValue;
+ }
+
+ /**
+ * Set the intValue property: The intValue property.
+ *
+ * @param intValue the intValue value to set.
+ * @return the ResourcePatch object itself.
+ */
+ @Metadata(generated = true)
+ public ResourcePatch setIntValue(Integer intValue) {
+ this.intValue = intValue;
+ this.updatedProperties.add("intValue");
+ return this;
+ }
+
+ /**
+ * Get the floatValue property: The floatValue property.
+ *
+ * @return the floatValue value.
+ */
+ @Metadata(generated = true)
+ public Double getFloatValue() {
+ return this.floatValue;
+ }
+
+ /**
+ * Set the floatValue property: The floatValue property.
+ *
+ * @param floatValue the floatValue value to set.
+ * @return the ResourcePatch object itself.
+ */
+ @Metadata(generated = true)
+ public ResourcePatch setFloatValue(Double floatValue) {
+ this.floatValue = floatValue;
+ this.updatedProperties.add("floatValue");
+ return this;
+ }
+
+ /**
+ * Get the innerModel property: The innerModel property.
+ *
+ * @return the innerModel value.
+ */
+ @Metadata(generated = true)
+ public InnerModel getInnerModel() {
+ return this.innerModel;
+ }
+
+ /**
+ * Set the innerModel property: The innerModel property.
+ *
+ * @param innerModel the innerModel value to set.
+ * @return the ResourcePatch object itself.
+ */
+ @Metadata(generated = true)
+ public ResourcePatch setInnerModel(InnerModel innerModel) {
+ this.innerModel = innerModel;
+ this.updatedProperties.add("innerModel");
+ return this;
+ }
+
+ /**
+ * Get the intArray property: The intArray property.
+ *
+ * @return the intArray value.
+ */
+ @Metadata(generated = true)
+ public List getIntArray() {
+ return this.intArray;
+ }
+
+ /**
+ * Set the intArray property: The intArray property.
+ *
+ * @param intArray the intArray value to set.
+ * @return the ResourcePatch object itself.
+ */
+ @Metadata(generated = true)
+ public ResourcePatch setIntArray(List intArray) {
+ this.intArray = intArray;
+ this.updatedProperties.add("intArray");
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Metadata(generated = true)
+ @Override
+ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
+ if (jsonMergePatch) {
+ return toJsonMergePatch(jsonWriter);
+ } else {
+ jsonWriter.writeStartObject();
+ jsonWriter.writeStringField("description", this.description);
+ jsonWriter.writeMapField("map", this.map, (writer, element) -> writer.writeJson(element));
+ jsonWriter.writeArrayField("array", this.array, (writer, element) -> writer.writeJson(element));
+ jsonWriter.writeNumberField("intValue", this.intValue);
+ jsonWriter.writeNumberField("floatValue", this.floatValue);
+ jsonWriter.writeJsonField("innerModel", this.innerModel);
+ jsonWriter.writeArrayField("intArray", this.intArray, (writer, element) -> writer.writeInt(element));
+ return jsonWriter.writeEndObject();
+ }
+ }
+
+ @Metadata(generated = true)
+ private JsonWriter toJsonMergePatch(JsonWriter jsonWriter) throws IOException {
+ jsonWriter.writeStartObject();
+ if (updatedProperties.contains("description")) {
+ if (this.description == null) {
+ jsonWriter.writeNullField("description");
+ } else {
+ jsonWriter.writeStringField("description", this.description);
+ }
+ }
+ if (updatedProperties.contains("map")) {
+ if (this.map == null) {
+ jsonWriter.writeNullField("map");
+ } else {
+ jsonWriter.writeMapField("map", this.map, (writer, element) -> {
+ if (element != null) {
+ JsonMergePatchHelper.getInnerModelAccessor().prepareModelForJsonMergePatch(element, true);
+ writer.writeJson(element);
+ JsonMergePatchHelper.getInnerModelAccessor().prepareModelForJsonMergePatch(element, false);
+ } else {
+ writer.writeNull();
+ }
+ });
+ }
+ }
+ if (updatedProperties.contains("array")) {
+ if (this.array == null) {
+ jsonWriter.writeNullField("array");
+ } else {
+ jsonWriter.writeArrayField("array", this.array, (writer, element) -> writer.writeJson(element));
+ }
+ }
+ if (updatedProperties.contains("intValue")) {
+ if (this.intValue == null) {
+ jsonWriter.writeNullField("intValue");
+ } else {
+ jsonWriter.writeNumberField("intValue", this.intValue);
+ }
+ }
+ if (updatedProperties.contains("floatValue")) {
+ if (this.floatValue == null) {
+ jsonWriter.writeNullField("floatValue");
+ } else {
+ jsonWriter.writeNumberField("floatValue", this.floatValue);
+ }
+ }
+ if (updatedProperties.contains("innerModel")) {
+ if (this.innerModel == null) {
+ jsonWriter.writeNullField("innerModel");
+ } else {
+ JsonMergePatchHelper.getInnerModelAccessor().prepareModelForJsonMergePatch(this.innerModel, true);
+ jsonWriter.writeJsonField("innerModel", this.innerModel);
+ JsonMergePatchHelper.getInnerModelAccessor().prepareModelForJsonMergePatch(this.innerModel, false);
+ }
+ }
+ if (updatedProperties.contains("intArray")) {
+ if (this.intArray == null) {
+ jsonWriter.writeNullField("intArray");
+ } else {
+ jsonWriter.writeArrayField("intArray", this.intArray, (writer, element) -> writer.writeInt(element));
+ }
+ }
+ return jsonWriter.writeEndObject();
+ }
+
+ /**
+ * Reads an instance of ResourcePatch from the JsonReader.
+ *
+ * @param jsonReader The JsonReader being read.
+ * @return An instance of ResourcePatch if the JsonReader was pointing to an instance of it, or null if it was
+ * pointing to JSON null.
+ * @throws IOException If an error occurs while reading the ResourcePatch.
+ */
+ @Metadata(generated = true)
+ public static ResourcePatch fromJson(JsonReader jsonReader) throws IOException {
+ return jsonReader.readObject(reader -> {
+ ResourcePatch deserializedResourcePatch = new ResourcePatch();
+ while (reader.nextToken() != JsonToken.END_OBJECT) {
+ String fieldName = reader.getFieldName();
+ reader.nextToken();
+
+ if ("description".equals(fieldName)) {
+ deserializedResourcePatch.description = reader.getString();
+ } else if ("map".equals(fieldName)) {
+ Map map = reader.readMap(reader1 -> InnerModel.fromJson(reader1));
+ deserializedResourcePatch.map = map;
+ } else if ("array".equals(fieldName)) {
+ List array = reader.readArray(reader1 -> InnerModel.fromJson(reader1));
+ deserializedResourcePatch.array = array;
+ } else if ("intValue".equals(fieldName)) {
+ deserializedResourcePatch.intValue = reader.getNullable(JsonReader::getInt);
+ } else if ("floatValue".equals(fieldName)) {
+ deserializedResourcePatch.floatValue = reader.getNullable(JsonReader::getDouble);
+ } else if ("innerModel".equals(fieldName)) {
+ deserializedResourcePatch.innerModel = InnerModel.fromJson(reader);
+ } else if ("intArray".equals(fieldName)) {
+ List intArray = reader.readArray(reader1 -> reader1.getInt());
+ deserializedResourcePatch.intArray = intArray;
+ } else {
+ reader.skipChildren();
+ }
+ }
+
+ return deserializedResourcePatch;
+ });
+ }
+}
diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/jsonmergepatch/implementation/JsonMergePatchClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/jsonmergepatch/implementation/JsonMergePatchClientImpl.java
new file mode 100644
index 0000000000..2f4158fc10
--- /dev/null
+++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/jsonmergepatch/implementation/JsonMergePatchClientImpl.java
@@ -0,0 +1,307 @@
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package payload.jsonmergepatch.implementation;
+
+import io.clientcore.core.annotation.ServiceInterface;
+import io.clientcore.core.http.RestProxy;
+import io.clientcore.core.http.annotation.BodyParam;
+import io.clientcore.core.http.annotation.HeaderParam;
+import io.clientcore.core.http.annotation.HostParam;
+import io.clientcore.core.http.annotation.HttpRequestInformation;
+import io.clientcore.core.http.annotation.UnexpectedResponseExceptionDetail;
+import io.clientcore.core.http.exception.HttpResponseException;
+import io.clientcore.core.http.models.HttpHeaderName;
+import io.clientcore.core.http.models.HttpMethod;
+import io.clientcore.core.http.models.RequestOptions;
+import io.clientcore.core.http.models.Response;
+import io.clientcore.core.http.pipeline.HttpPipeline;
+import io.clientcore.core.util.binarydata.BinaryData;
+import payload.jsonmergepatch.Resource;
+
+/**
+ * Initializes a new instance of the JsonMergePatchClient type.
+ */
+public final class JsonMergePatchClientImpl {
+ /**
+ * The proxy service used to perform REST calls.
+ */
+ private final JsonMergePatchClientService 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;
+ }
+
+ /**
+ * Initializes an instance of JsonMergePatchClient client.
+ *
+ * @param httpPipeline The HTTP pipeline to send requests through.
+ * @param endpoint Service host.
+ */
+ public JsonMergePatchClientImpl(HttpPipeline httpPipeline, String endpoint) {
+ this.endpoint = "http://localhost:3000";
+ this.httpPipeline = httpPipeline;
+ this.service = RestProxy.create(JsonMergePatchClientService.class, this.httpPipeline);
+ }
+
+ /**
+ * The interface defining all the services for JsonMergePatchClient to be used by the proxy service to perform REST
+ * calls.
+ */
+ @ServiceInterface(name = "JsonMergePatchClient", host = "{endpoint}")
+ public interface JsonMergePatchClientService {
+ @HttpRequestInformation(
+ method = HttpMethod.PUT,
+ path = "/json-merge-patch/create/resource",
+ expectedStatusCodes = { 200 })
+ @UnexpectedResponseExceptionDetail
+ Response createResourceSync(@HostParam("endpoint") String endpoint,
+ @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept,
+ @BodyParam("application/json") BinaryData body, RequestOptions requestOptions);
+
+ @HttpRequestInformation(
+ method = HttpMethod.PATCH,
+ path = "/json-merge-patch/update/resource",
+ expectedStatusCodes = { 200 })
+ @UnexpectedResponseExceptionDetail
+ Response updateResourceSync(@HostParam("endpoint") String endpoint,
+ @HeaderParam("content-type") String contentType, @HeaderParam("Accept") String accept,
+ @BodyParam("application/merge-patch+json") BinaryData body, RequestOptions requestOptions);
+
+ @HttpRequestInformation(
+ method = HttpMethod.PATCH,
+ path = "/json-merge-patch/update/resource/optional",
+ expectedStatusCodes = { 200 })
+ @UnexpectedResponseExceptionDetail
+ Response updateOptionalResourceSync(@HostParam("endpoint") String endpoint,
+ @HeaderParam("Accept") String accept, RequestOptions requestOptions);
+ }
+
+ /**
+ * Test content-type: application/merge-patch+json with required body.
+ * Request Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * description: String (Optional)
+ * map (Optional): {
+ * String (Required): {
+ * name: String (Optional)
+ * description: String (Optional)
+ * }
+ * }
+ * array (Optional): [
+ * (recursive schema, see above)
+ * ]
+ * intValue: Integer (Optional)
+ * floatValue: Double (Optional)
+ * innerModel (Optional): (recursive schema, see innerModel above)
+ * intArray (Optional): [
+ * int (Optional)
+ * ]
+ * }
+ * }
+ *
+ *
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * description: String (Optional)
+ * map (Optional): {
+ * String (Required): {
+ * name: String (Optional)
+ * description: String (Optional)
+ * }
+ * }
+ * array (Optional): [
+ * (recursive schema, see above)
+ * ]
+ * intValue: Integer (Optional)
+ * floatValue: Double (Optional)
+ * innerModel (Optional): (recursive schema, see innerModel above)
+ * intArray (Optional): [
+ * int (Optional)
+ * ]
+ * }
+ * }
+ *
+ *
+ * @param body The body parameter.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the service returns an error.
+ * @return details about a resource.
+ */
+ public Response createResourceWithResponse(BinaryData body, RequestOptions requestOptions) {
+ final String contentType = "application/json";
+ final String accept = "application/json";
+ return service.createResourceSync(this.getEndpoint(), contentType, accept, body, requestOptions);
+ }
+
+ /**
+ * Test content-type: application/merge-patch+json with required body.
+ * Request Body Schema
+ *
+ *
+ * {@code
+ * {
+ * description: String (Optional)
+ * map (Optional): {
+ * String (Required): {
+ * name: String (Optional)
+ * description: String (Optional)
+ * }
+ * }
+ * array (Optional): [
+ * (recursive schema, see above)
+ * ]
+ * intValue: Integer (Optional)
+ * floatValue: Double (Optional)
+ * innerModel (Optional): (recursive schema, see innerModel above)
+ * intArray (Optional): [
+ * int (Optional)
+ * ]
+ * }
+ * }
+ *
+ *
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * description: String (Optional)
+ * map (Optional): {
+ * String (Required): {
+ * name: String (Optional)
+ * description: String (Optional)
+ * }
+ * }
+ * array (Optional): [
+ * (recursive schema, see above)
+ * ]
+ * intValue: Integer (Optional)
+ * floatValue: Double (Optional)
+ * innerModel (Optional): (recursive schema, see innerModel above)
+ * intArray (Optional): [
+ * int (Optional)
+ * ]
+ * }
+ * }
+ *
+ *
+ * @param body The body parameter.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the service returns an error.
+ * @return details about a resource.
+ */
+ public Response updateResourceWithResponse(BinaryData body, RequestOptions requestOptions) {
+ final String contentType = "application/merge-patch+json";
+ final String accept = "application/json";
+ return service.updateResourceSync(this.getEndpoint(), contentType, accept, body, requestOptions);
+ }
+
+ /**
+ * Test content-type: application/merge-patch+json with optional body.
+ * Header Parameters
+ *
+ * Header Parameters
+ * Name | Type | Required | Description |
+ * Content-Type | String | No | The content type. Allowed values:
+ * "application/merge-patch+json". |
+ *
+ * You can add these to a request with {@link RequestOptions#addHeader}
+ * Request Body Schema
+ *
+ *
+ * {@code
+ * {
+ * description: String (Optional)
+ * map (Optional): {
+ * String (Required): {
+ * name: String (Optional)
+ * description: String (Optional)
+ * }
+ * }
+ * array (Optional): [
+ * (recursive schema, see above)
+ * ]
+ * intValue: Integer (Optional)
+ * floatValue: Double (Optional)
+ * innerModel (Optional): (recursive schema, see innerModel above)
+ * intArray (Optional): [
+ * int (Optional)
+ * ]
+ * }
+ * }
+ *
+ *
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * {
+ * name: String (Required)
+ * description: String (Optional)
+ * map (Optional): {
+ * String (Required): {
+ * name: String (Optional)
+ * description: String (Optional)
+ * }
+ * }
+ * array (Optional): [
+ * (recursive schema, see above)
+ * ]
+ * intValue: Integer (Optional)
+ * floatValue: Double (Optional)
+ * innerModel (Optional): (recursive schema, see innerModel above)
+ * intArray (Optional): [
+ * int (Optional)
+ * ]
+ * }
+ * }
+ *
+ *
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the service returns an error.
+ * @return details about a resource.
+ */
+ public Response updateOptionalResourceWithResponse(RequestOptions requestOptions) {
+ final String accept = "application/json";
+ RequestOptions requestOptionsLocal = requestOptions == null ? new RequestOptions() : requestOptions;
+ requestOptionsLocal.addRequestCallback(requestLocal -> {
+ if (requestLocal.getBody() != null && requestLocal.getHeaders().get(HttpHeaderName.CONTENT_TYPE) == null) {
+ requestLocal.getHeaders().set(HttpHeaderName.CONTENT_TYPE, "application/merge-patch+json");
+ }
+ });
+ return service.updateOptionalResourceSync(this.getEndpoint(), accept, requestOptionsLocal);
+ }
+}
diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/jsonmergepatch/implementation/JsonMergePatchHelper.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/jsonmergepatch/implementation/JsonMergePatchHelper.java
new file mode 100644
index 0000000000..64e667b6f3
--- /dev/null
+++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/jsonmergepatch/implementation/JsonMergePatchHelper.java
@@ -0,0 +1,43 @@
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package payload.jsonmergepatch.implementation;
+
+import payload.jsonmergepatch.InnerModel;
+import payload.jsonmergepatch.ResourcePatch;
+
+/**
+ * This is the Helper class to enable json merge patch serialization for a model.
+ */
+public class JsonMergePatchHelper {
+ private static InnerModelAccessor innerModelAccessor;
+
+ public interface InnerModelAccessor {
+ InnerModel prepareModelForJsonMergePatch(InnerModel innerModel, boolean jsonMergePatchEnabled);
+
+ boolean isJsonMergePatch(InnerModel innerModel);
+ }
+
+ public static void setInnerModelAccessor(InnerModelAccessor accessor) {
+ innerModelAccessor = accessor;
+ }
+
+ public static InnerModelAccessor getInnerModelAccessor() {
+ return innerModelAccessor;
+ }
+
+ private static ResourcePatchAccessor resourcePatchAccessor;
+
+ public interface ResourcePatchAccessor {
+ ResourcePatch prepareModelForJsonMergePatch(ResourcePatch resourcePatch, boolean jsonMergePatchEnabled);
+
+ boolean isJsonMergePatch(ResourcePatch resourcePatch);
+ }
+
+ public static void setResourcePatchAccessor(ResourcePatchAccessor accessor) {
+ resourcePatchAccessor = accessor;
+ }
+
+ public static ResourcePatchAccessor getResourcePatchAccessor() {
+ return resourcePatchAccessor;
+ }
+}
diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/jsonmergepatch/implementation/package-info.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/jsonmergepatch/implementation/package-info.java
new file mode 100644
index 0000000000..c04e0b4bc2
--- /dev/null
+++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/jsonmergepatch/implementation/package-info.java
@@ -0,0 +1,7 @@
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+/**
+ * Package containing the implementations for JsonMergePatch.
+ * Test for merge-patch+json content-type.
+ */
+package payload.jsonmergepatch.implementation;
diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/jsonmergepatch/package-info.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/jsonmergepatch/package-info.java
new file mode 100644
index 0000000000..dced85e1ca
--- /dev/null
+++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/jsonmergepatch/package-info.java
@@ -0,0 +1,7 @@
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+/**
+ * Package containing the classes for JsonMergePatch.
+ * Test for merge-patch+json content-type.
+ */
+package payload.jsonmergepatch;
diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/mediatype/MediaTypeClient.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/mediatype/MediaTypeClient.java
new file mode 100644
index 0000000000..03ecadc2ca
--- /dev/null
+++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/mediatype/MediaTypeClient.java
@@ -0,0 +1,166 @@
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package payload.mediatype;
+
+import io.clientcore.core.annotation.Metadata;
+import io.clientcore.core.annotation.ServiceClient;
+import io.clientcore.core.http.exception.HttpResponseException;
+import io.clientcore.core.http.models.RequestOptions;
+import io.clientcore.core.http.models.Response;
+import io.clientcore.core.util.binarydata.BinaryData;
+import payload.mediatype.implementation.StringBodiesImpl;
+
+/**
+ * Initializes a new instance of the synchronous MediaTypeClient type.
+ */
+@ServiceClient(builder = MediaTypeClientBuilder.class)
+public final class MediaTypeClient {
+ @Metadata(generated = true)
+ private final StringBodiesImpl serviceClient;
+
+ /**
+ * Initializes an instance of MediaTypeClient class.
+ *
+ * @param serviceClient the service client implementation.
+ */
+ @Metadata(generated = true)
+ MediaTypeClient(StringBodiesImpl serviceClient) {
+ this.serviceClient = serviceClient;
+ }
+
+ /**
+ * The sendAsText operation.
+ * Request Body Schema
+ *
+ *
+ * {@code
+ * String
+ * }
+ *
+ *
+ * @param text The text parameter.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the service returns an error.
+ * @return the response.
+ */
+ @Metadata(generated = true)
+ public Response sendAsTextWithResponse(BinaryData text, RequestOptions requestOptions) {
+ return this.serviceClient.sendAsTextWithResponse(text, requestOptions);
+ }
+
+ /**
+ * The getAsText operation.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * String
+ * }
+ *
+ *
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the service returns an error.
+ * @return a sequence of textual characters.
+ */
+ @Metadata(generated = true)
+ public Response getAsTextWithResponse(RequestOptions requestOptions) {
+ return this.serviceClient.getAsTextWithResponse(requestOptions);
+ }
+
+ /**
+ * The sendAsJson operation.
+ * Request Body Schema
+ *
+ *
+ * {@code
+ * String
+ * }
+ *
+ *
+ * @param text The text parameter.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the service returns an error.
+ * @return the response.
+ */
+ @Metadata(generated = true)
+ public Response sendAsJsonWithResponse(BinaryData text, RequestOptions requestOptions) {
+ return this.serviceClient.sendAsJsonWithResponse(text, requestOptions);
+ }
+
+ /**
+ * The getAsJson operation.
+ * Response Body Schema
+ *
+ *
+ * {@code
+ * String
+ * }
+ *
+ *
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the service returns an error.
+ * @return a sequence of textual characters.
+ */
+ @Metadata(generated = true)
+ public Response getAsJsonWithResponse(RequestOptions requestOptions) {
+ return this.serviceClient.getAsJsonWithResponse(requestOptions);
+ }
+
+ /**
+ * The sendAsText operation.
+ *
+ * @param text The text parameter.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the service returns an error.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ */
+ @Metadata(generated = true)
+ public void sendAsText(String text) {
+ // Generated convenience method for sendAsTextWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ sendAsTextWithResponse(BinaryData.fromString(text), requestOptions).getValue();
+ }
+
+ /**
+ * The getAsText operation.
+ *
+ * @throws HttpResponseException thrown if the service returns an error.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a sequence of textual characters.
+ */
+ @Metadata(generated = true)
+ public String getAsText() {
+ // Generated convenience method for getAsTextWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getAsTextWithResponse(requestOptions).getValue();
+ }
+
+ /**
+ * The sendAsJson operation.
+ *
+ * @param text The text parameter.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the service returns an error.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ */
+ @Metadata(generated = true)
+ public void sendAsJson(String text) {
+ // Generated convenience method for sendAsJsonWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ sendAsJsonWithResponse(BinaryData.fromObject(text), requestOptions).getValue();
+ }
+
+ /**
+ * The getAsJson operation.
+ *
+ * @throws HttpResponseException thrown if the service returns an error.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a sequence of textual characters.
+ */
+ @Metadata(generated = true)
+ public String getAsJson() {
+ // Generated convenience method for getAsJsonWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getAsJsonWithResponse(requestOptions).getValue();
+ }
+}
diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/mediatype/MediaTypeClientBuilder.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/mediatype/MediaTypeClientBuilder.java
new file mode 100644
index 0000000000..5f8f964750
--- /dev/null
+++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/mediatype/MediaTypeClientBuilder.java
@@ -0,0 +1,241 @@
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package payload.mediatype;
+
+import io.clientcore.core.annotation.Metadata;
+import io.clientcore.core.annotation.ServiceClientBuilder;
+import io.clientcore.core.http.client.HttpClient;
+import io.clientcore.core.http.models.HttpLogOptions;
+import io.clientcore.core.http.models.HttpRedirectOptions;
+import io.clientcore.core.http.models.HttpRetryOptions;
+import io.clientcore.core.http.models.ProxyOptions;
+import io.clientcore.core.http.pipeline.HttpLoggingPolicy;
+import io.clientcore.core.http.pipeline.HttpPipeline;
+import io.clientcore.core.http.pipeline.HttpPipelineBuilder;
+import io.clientcore.core.http.pipeline.HttpPipelinePolicy;
+import io.clientcore.core.http.pipeline.HttpRedirectPolicy;
+import io.clientcore.core.http.pipeline.HttpRetryPolicy;
+import io.clientcore.core.models.traits.ConfigurationTrait;
+import io.clientcore.core.models.traits.EndpointTrait;
+import io.clientcore.core.models.traits.HttpTrait;
+import io.clientcore.core.models.traits.ProxyTrait;
+import io.clientcore.core.util.ClientLogger;
+import io.clientcore.core.util.configuration.Configuration;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import payload.mediatype.implementation.MediaTypeClientImpl;
+
+/**
+ * A builder for creating a new instance of the MediaTypeClient type.
+ */
+@ServiceClientBuilder(serviceClients = { MediaTypeClient.class })
+public final class MediaTypeClientBuilder
+ implements HttpTrait, ProxyTrait,
+ ConfigurationTrait, EndpointTrait {
+ @Metadata(generated = true)
+ private static final String SDK_NAME = "name";
+
+ @Metadata(generated = true)
+ private static final String SDK_VERSION = "version";
+
+ @Metadata(generated = true)
+ private final List pipelinePolicies;
+
+ /**
+ * Create an instance of the MediaTypeClientBuilder.
+ */
+ @Metadata(generated = true)
+ public MediaTypeClientBuilder() {
+ this.pipelinePolicies = new ArrayList<>();
+ }
+
+ /*
+ * The HTTP pipeline to send requests through.
+ */
+ @Metadata(generated = true)
+ private HttpPipeline pipeline;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Metadata(generated = true)
+ @Override
+ public MediaTypeClientBuilder httpPipeline(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 HTTP client used to send the request.
+ */
+ @Metadata(generated = true)
+ private HttpClient httpClient;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Metadata(generated = true)
+ @Override
+ public MediaTypeClientBuilder httpClient(HttpClient httpClient) {
+ this.httpClient = httpClient;
+ return this;
+ }
+
+ /*
+ * The logging configuration for HTTP requests and responses.
+ */
+ @Metadata(generated = true)
+ private HttpLogOptions httpLogOptions;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Metadata(generated = true)
+ @Override
+ public MediaTypeClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) {
+ this.httpLogOptions = httpLogOptions;
+ return this;
+ }
+
+ /*
+ * The retry options to configure retry policy for failed requests.
+ */
+ @Metadata(generated = true)
+ private HttpRetryOptions retryOptions;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Metadata(generated = true)
+ @Override
+ public MediaTypeClientBuilder httpRetryOptions(HttpRetryOptions retryOptions) {
+ this.retryOptions = retryOptions;
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Metadata(generated = true)
+ @Override
+ public MediaTypeClientBuilder addHttpPipelinePolicy(HttpPipelinePolicy customPolicy) {
+ Objects.requireNonNull(customPolicy, "'customPolicy' cannot be null.");
+ pipelinePolicies.add(customPolicy);
+ return this;
+ }
+
+ /*
+ * The redirect options to configure redirect policy
+ */
+ @Metadata(generated = true)
+ private HttpRedirectOptions redirectOptions;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Metadata(generated = true)
+ @Override
+ public MediaTypeClientBuilder httpRedirectOptions(HttpRedirectOptions redirectOptions) {
+ this.redirectOptions = redirectOptions;
+ return this;
+ }
+
+ /*
+ * The proxy options used during construction of the service client.
+ */
+ @Metadata(generated = true)
+ private ProxyOptions proxyOptions;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Metadata(generated = true)
+ @Override
+ public MediaTypeClientBuilder proxyOptions(ProxyOptions proxyOptions) {
+ this.proxyOptions = proxyOptions;
+ return this;
+ }
+
+ /*
+ * The configuration store that is used during construction of the service client.
+ */
+ @Metadata(generated = true)
+ private Configuration configuration;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Metadata(generated = true)
+ @Override
+ public MediaTypeClientBuilder configuration(Configuration configuration) {
+ this.configuration = configuration;
+ return this;
+ }
+
+ /*
+ * The service endpoint
+ */
+ @Metadata(generated = true)
+ private String endpoint;
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Metadata(generated = true)
+ @Override
+ public MediaTypeClientBuilder endpoint(String endpoint) {
+ this.endpoint = endpoint;
+ return this;
+ }
+
+ /**
+ * Builds an instance of MediaTypeClientImpl with the provided parameters.
+ *
+ * @return an instance of MediaTypeClientImpl.
+ */
+ @Metadata(generated = true)
+ private MediaTypeClientImpl buildInnerClient() {
+ this.validateClient();
+ HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline();
+ String localEndpoint = (endpoint != null) ? endpoint : "http://localhost:3000";
+ MediaTypeClientImpl client = new MediaTypeClientImpl(localPipeline, localEndpoint);
+ return client;
+ }
+
+ @Metadata(generated = true)
+ 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.
+ }
+
+ @Metadata(generated = true)
+ private HttpPipeline createHttpPipeline() {
+ Configuration buildConfiguration
+ = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration;
+ HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions;
+ HttpPipelineBuilder httpPipelineBuilder = new HttpPipelineBuilder();
+ List policies = new ArrayList<>();
+ policies.add(redirectOptions == null ? new HttpRedirectPolicy() : new HttpRedirectPolicy(redirectOptions));
+ policies.add(retryOptions == null ? new HttpRetryPolicy() : new HttpRetryPolicy(retryOptions));
+ this.pipelinePolicies.stream().forEach(p -> policies.add(p));
+ policies.add(new HttpLoggingPolicy(localHttpLogOptions));
+ httpPipelineBuilder.policies(policies.toArray(new HttpPipelinePolicy[0]));
+ return httpPipelineBuilder.build();
+ }
+
+ /**
+ * Builds an instance of MediaTypeClient class.
+ *
+ * @return an instance of MediaTypeClient.
+ */
+ @Metadata(generated = true)
+ public MediaTypeClient buildMediaTypeClient() {
+ return new MediaTypeClient(buildInnerClient().getStringBodies());
+ }
+
+ private static final ClientLogger LOGGER = new ClientLogger(MediaTypeClientBuilder.class);
+}
diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/mediatype/implementation/MediaTypeClientImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/mediatype/implementation/MediaTypeClientImpl.java
new file mode 100644
index 0000000000..ba3bba55ef
--- /dev/null
+++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/mediatype/implementation/MediaTypeClientImpl.java
@@ -0,0 +1,64 @@
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package payload.mediatype.implementation;
+
+import io.clientcore.core.http.pipeline.HttpPipeline;
+
+/**
+ * Initializes a new instance of the MediaTypeClient type.
+ */
+public final class MediaTypeClientImpl {
+ /**
+ * 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 StringBodiesImpl object to access its operations.
+ */
+ private final StringBodiesImpl stringBodies;
+
+ /**
+ * Gets the StringBodiesImpl object to access its operations.
+ *
+ * @return the StringBodiesImpl object.
+ */
+ public StringBodiesImpl getStringBodies() {
+ return this.stringBodies;
+ }
+
+ /**
+ * Initializes an instance of MediaTypeClient client.
+ *
+ * @param httpPipeline The HTTP pipeline to send requests through.
+ * @param endpoint Service host.
+ */
+ public MediaTypeClientImpl(HttpPipeline httpPipeline, String endpoint) {
+ this.endpoint = "http://localhost:3000";
+ this.httpPipeline = httpPipeline;
+ this.stringBodies = new StringBodiesImpl(this);
+ }
+}
diff --git a/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/mediatype/implementation/StringBodiesImpl.java b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/mediatype/implementation/StringBodiesImpl.java
new file mode 100644
index 0000000000..d056ec5134
--- /dev/null
+++ b/packages/http-client-java/generator/http-client-generator-clientcore-test/src/main/java/payload/mediatype/implementation/StringBodiesImpl.java
@@ -0,0 +1,160 @@
+// Code generated by Microsoft (R) TypeSpec Code Generator.
+
+package payload.mediatype.implementation;
+
+import io.clientcore.core.annotation.ServiceInterface;
+import io.clientcore.core.http.RestProxy;
+import io.clientcore.core.http.annotation.BodyParam;
+import io.clientcore.core.http.annotation.HeaderParam;
+import io.clientcore.core.http.annotation.HostParam;
+import io.clientcore.core.http.annotation.HttpRequestInformation;
+import io.clientcore.core.http.annotation.UnexpectedResponseExceptionDetail;
+import io.clientcore.core.http.exception.HttpResponseException;
+import io.clientcore.core.http.models.HttpMethod;
+import io.clientcore.core.http.models.RequestOptions;
+import io.clientcore.core.http.models.Response;
+import io.clientcore.core.util.binarydata.BinaryData;
+
+/**
+ * An instance of this class provides access to all the operations defined in StringBodies.
+ */
+public final class StringBodiesImpl {
+ /**
+ * The proxy service used to perform REST calls.
+ */
+ private final StringBodiesService service;
+
+ /**
+ * The service client containing this operation class.
+ */
+ private final MediaTypeClientImpl client;
+
+ /**
+ * Initializes an instance of StringBodiesImpl.
+ *
+ * @param client the instance of the service client containing this operation class.
+ */
+ StringBodiesImpl(MediaTypeClientImpl client) {
+ this.service = RestProxy.create(StringBodiesService.class, client.getHttpPipeline());
+ this.client = client;
+ }
+
+ /**
+ * The interface defining all the services for MediaTypeClientStringBodies to be used by the proxy service to
+ * perform REST calls.
+ */
+ @ServiceInterface(name = "MediaTypeClientStrin", host = "{endpoint}")
+ public interface StringBodiesService {
+ @HttpRequestInformation(
+ method = HttpMethod.POST,
+ path = "/payload/media-type/string-body/sendAsText",
+ expectedStatusCodes = { 200 })
+ @UnexpectedResponseExceptionDetail
+ Response sendAsTextSync(@HostParam("endpoint") String endpoint,
+ @HeaderParam("content-type") String contentType, @BodyParam("text/plain") BinaryData text,
+ RequestOptions requestOptions);
+
+ @HttpRequestInformation(
+ method = HttpMethod.GET,
+ path = "/payload/media-type/string-body/getAsText",
+ expectedStatusCodes = { 200 })
+ @UnexpectedResponseExceptionDetail
+ Response getAsTextSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept,
+ RequestOptions requestOptions);
+
+ @HttpRequestInformation(
+ method = HttpMethod.POST,
+ path = "/payload/media-type/string-body/sendAsJson",
+ expectedStatusCodes = { 200 })
+ @UnexpectedResponseExceptionDetail
+ Response sendAsJsonSync(@HostParam("endpoint") String endpoint,
+ @HeaderParam("content-type") String contentType, @BodyParam("application/json") BinaryData text,
+ RequestOptions requestOptions);
+
+ @HttpRequestInformation(
+ method = HttpMethod.GET,
+ path = "/payload/media-type/string-body/getAsJson",
+ expectedStatusCodes = { 200 })
+ @UnexpectedResponseExceptionDetail
+ Response getAsJsonSync(@HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept,
+ RequestOptions requestOptions);
+ }
+
+ /**
+ * The sendAsText operation.
+ *