From 067d5ba7558188571f49558907b9bafd896c7915 Mon Sep 17 00:00:00 2001 From: Connie Date: Wed, 14 Sep 2022 13:07:06 -0700 Subject: [PATCH 01/16] Regenerating swagger classes. --- .../AzureSchemaRegistryImplBuilder.java | 231 +++++++++--------- .../SchemaGroupsOperationsImpl.java | 7 +- .../implementation/SchemasImpl.java | 154 ++++++++++-- .../implementation/models/ErrorException.java | 1 + .../models/SchemasGetByIdHeaders.java | 17 ++ .../models/SchemasGetByIdResponse.java | 21 +- .../SchemasQueryIdByContentHeaders.java | 16 ++ .../models/SchemasRegisterHeaders.java | 16 ++ 8 files changed, 327 insertions(+), 136 deletions(-) diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/AzureSchemaRegistryImplBuilder.java b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/AzureSchemaRegistryImplBuilder.java index 8d100c061310a..6985850a6c4a8 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/AzureSchemaRegistryImplBuilder.java +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/AzureSchemaRegistryImplBuilder.java @@ -4,205 +4,207 @@ package com.azure.data.schemaregistry.implementation; +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.CookiePolicy; 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.serializer.JacksonAdapter; import com.azure.core.util.serializer.SerializerAdapter; - import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** A builder for creating a new instance of the AzureSchemaRegistry type. */ @ServiceClientBuilder(serviceClients = {AzureSchemaRegistryImpl.class}) -public final class AzureSchemaRegistryImplBuilder { - private static final String SDK_NAME = "name"; +public final class AzureSchemaRegistryImplBuilder + implements HttpTrait, + ConfigurationTrait, + EndpointTrait { + @Generated private static final String SDK_NAME = "name"; + + @Generated private static final String SDK_VERSION = "version"; - private static final String SDK_VERSION = "version"; + @Generated private final Map properties = new HashMap<>(); - private final Map properties = new HashMap<>(); + @Generated private final List pipelinePolicies; /** Create an instance of the AzureSchemaRegistryImplBuilder. */ + @Generated public AzureSchemaRegistryImplBuilder() { this.pipelinePolicies = new ArrayList<>(); } /* - * The Schema Registry service endpoint, for example - * my-namespace.servicebus.windows.net. + * The HTTP pipeline to send requests through. */ - private String endpoint; + @Generated private HttpPipeline pipeline; - /** - * Sets The Schema Registry service endpoint, for example my-namespace.servicebus.windows.net. - * - * @param endpoint the endpoint value. - * @return the AzureSchemaRegistryImplBuilder. - */ - public AzureSchemaRegistryImplBuilder endpoint(String endpoint) { - this.endpoint = endpoint; + /** {@inheritDoc}. */ + @Generated + @Override + public AzureSchemaRegistryImplBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; return this; } /* - * Api Version + * The HTTP client used to send the request. */ - private String apiVersion; + @Generated private HttpClient httpClient; - /** - * Sets Api Version. - * - * @param apiVersion the apiVersion value. - * @return the AzureSchemaRegistryImplBuilder. - */ - public AzureSchemaRegistryImplBuilder apiVersion(String apiVersion) { - this.apiVersion = apiVersion; + /** {@inheritDoc}. */ + @Generated + @Override + public AzureSchemaRegistryImplBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; return this; } /* - * The HTTP pipeline to send requests through + * The logging configuration for HTTP requests and responses. */ - private HttpPipeline pipeline; + @Generated private HttpLogOptions httpLogOptions; - /** - * Sets The HTTP pipeline to send requests through. - * - * @param pipeline the pipeline value. - * @return the AzureSchemaRegistryImplBuilder. - */ - public AzureSchemaRegistryImplBuilder pipeline(HttpPipeline pipeline) { - this.pipeline = pipeline; + /** {@inheritDoc}. */ + @Generated + @Override + public AzureSchemaRegistryImplBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; return this; } /* - * The serializer to serialize an object into a string + * The client options such as application ID and custom headers to set on a request. */ - private SerializerAdapter serializerAdapter; + @Generated private ClientOptions clientOptions; - /** - * Sets The serializer to serialize an object into a string. - * - * @param serializerAdapter the serializerAdapter value. - * @return the AzureSchemaRegistryImplBuilder. - */ - public AzureSchemaRegistryImplBuilder serializerAdapter(SerializerAdapter serializerAdapter) { - this.serializerAdapter = serializerAdapter; + /** {@inheritDoc}. */ + @Generated + @Override + public AzureSchemaRegistryImplBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; return this; } /* - * The HTTP client used to send the request. + * The retry options to configure retry policy for failed requests. */ - private HttpClient httpClient; + @Generated private RetryOptions retryOptions; - /** - * Sets The HTTP client used to send the request. - * - * @param httpClient the httpClient value. - * @return the AzureSchemaRegistryImplBuilder. - */ - public AzureSchemaRegistryImplBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; + /** {@inheritDoc}. */ + @Generated + @Override + public AzureSchemaRegistryImplBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** {@inheritDoc}. */ + @Generated + @Override + public AzureSchemaRegistryImplBuilder addPolicy(HttpPipelinePolicy customPolicy) { + pipelinePolicies.add(customPolicy); return this; } /* - * The configuration store that is used during construction of the service - * client. + * The configuration store that is used during construction of the service client. */ - private Configuration configuration; + @Generated private Configuration configuration; - /** - * Sets The configuration store that is used during construction of the service client. - * - * @param configuration the configuration value. - * @return the AzureSchemaRegistryImplBuilder. - */ + /** {@inheritDoc}. */ + @Generated + @Override public AzureSchemaRegistryImplBuilder configuration(Configuration configuration) { this.configuration = configuration; return this; } /* - * The logging configuration for HTTP requests and responses. + * The service endpoint */ - private HttpLogOptions httpLogOptions; + @Generated private String endpoint; - /** - * Sets The logging configuration for HTTP requests and responses. - * - * @param httpLogOptions the httpLogOptions value. - * @return the AzureSchemaRegistryImplBuilder. - */ - public AzureSchemaRegistryImplBuilder httpLogOptions(HttpLogOptions httpLogOptions) { - this.httpLogOptions = httpLogOptions; + /** {@inheritDoc}. */ + @Generated + @Override + public AzureSchemaRegistryImplBuilder endpoint(String endpoint) { + this.endpoint = endpoint; return this; } /* - * The retry policy that will attempt to retry failed requests, if - * applicable. + * Api Version */ - private RetryPolicy retryPolicy; + @Generated private String apiVersion; /** - * Sets The retry policy that will attempt to retry failed requests, if applicable. + * Sets Api Version. * - * @param retryPolicy the retryPolicy value. + * @param apiVersion the apiVersion value. * @return the AzureSchemaRegistryImplBuilder. */ - public AzureSchemaRegistryImplBuilder retryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; + @Generated + public AzureSchemaRegistryImplBuilder apiVersion(String apiVersion) { + this.apiVersion = apiVersion; return this; } /* - * The list of Http pipeline policies to add. - */ - private final List pipelinePolicies; - - /* - * The client options such as application ID and custom headers to set on a - * request. + * The serializer to serialize an object into a string */ - private ClientOptions clientOptions; + @Generated private SerializerAdapter serializerAdapter; /** - * Sets The client options such as application ID and custom headers to set on a request. + * Sets The serializer to serialize an object into a string. * - * @param clientOptions the clientOptions value. + * @param serializerAdapter the serializerAdapter value. * @return the AzureSchemaRegistryImplBuilder. */ - public AzureSchemaRegistryImplBuilder clientOptions(ClientOptions clientOptions) { - this.clientOptions = clientOptions; + @Generated + public AzureSchemaRegistryImplBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; return this; } + /* + * The retry policy that will attempt to retry failed requests, if applicable. + */ + @Generated private RetryPolicy retryPolicy; + /** - * Adds a custom Http pipeline policy. + * Sets The retry policy that will attempt to retry failed requests, if applicable. * - * @param customPolicy The custom Http pipeline policy to add. + * @param retryPolicy the retryPolicy value. * @return the AzureSchemaRegistryImplBuilder. */ - public AzureSchemaRegistryImplBuilder addPolicy(HttpPipelinePolicy customPolicy) { - pipelinePolicies.add(customPolicy); + @Generated + public AzureSchemaRegistryImplBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; return this; } @@ -211,20 +213,18 @@ public AzureSchemaRegistryImplBuilder addPolicy(HttpPipelinePolicy customPolicy) * * @return an instance of AzureSchemaRegistryImpl. */ + @Generated public AzureSchemaRegistryImpl buildClient() { - if (apiVersion == null) { - this.apiVersion = "2021-10"; - } - if (pipeline == null) { - this.pipeline = createHttpPipeline(); - } - if (serializerAdapter == null) { - this.serializerAdapter = JacksonAdapter.createDefaultSerializerAdapter(); - } - AzureSchemaRegistryImpl client = new AzureSchemaRegistryImpl(pipeline, serializerAdapter, endpoint, apiVersion); + HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline(); + String localApiVersion = (apiVersion != null) ? apiVersion : "2021-10"; + SerializerAdapter localSerializerAdapter = + (serializerAdapter != null) ? serializerAdapter : JacksonAdapter.createDefaultSerializerAdapter(); + AzureSchemaRegistryImpl client = + new AzureSchemaRegistryImpl(localPipeline, localSerializerAdapter, endpoint, localApiVersion); return client; } + @Generated private HttpPipeline createHttpPipeline() { Configuration buildConfiguration = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; @@ -239,21 +239,32 @@ private HttpPipeline createHttpPipeline() { String clientVersion = properties.getOrDefault(SDK_VERSION, "UnknownVersion"); String applicationId = CoreUtils.getApplicationId(clientOptions, httpLogOptions); policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); HttpHeaders headers = new HttpHeaders(); clientOptions.getHeaders().forEach(header -> headers.set(header.getName(), header.getValue())); if (headers.getSize() > 0) { policies.add(new AddHeadersPolicy(headers)); } + policies.addAll( + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); HttpPolicyProviders.addBeforeRetryPolicies(policies); - policies.add(retryPolicy == null ? new RetryPolicy() : retryPolicy); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); policies.add(new CookiePolicy()); - policies.addAll(this.pipelinePolicies); + policies.addAll( + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogOptions)); HttpPipeline httpPipeline = new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) + .clientOptions(clientOptions) .build(); return httpPipeline; } diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/SchemaGroupsOperationsImpl.java b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/SchemaGroupsOperationsImpl.java index f88d8c23647e1..fafbf4c937430 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/SchemaGroupsOperationsImpl.java +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/SchemaGroupsOperationsImpl.java @@ -58,13 +58,16 @@ Mono> list( } /** - * Gets the list of schema groups user is authorized to access. + * Get list of schema groups. + * + *

Gets the list of schema groups user is authorized to access. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the list of schema groups user is authorized to access. + * @return the list of schema groups user is authorized to access along with {@link Response} on successful + * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> listWithResponseAsync(Context context) { diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/SchemasImpl.java b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/SchemasImpl.java index 6b73c5465d657..81de88037d02b 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/SchemasImpl.java +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/SchemasImpl.java @@ -20,12 +20,15 @@ import com.azure.core.annotation.UnexpectedResponseExceptionType; 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.data.schemaregistry.implementation.models.ErrorException; import com.azure.data.schemaregistry.implementation.models.SchemaVersions; import com.azure.data.schemaregistry.implementation.models.SchemasGetByIdResponse; import com.azure.data.schemaregistry.implementation.models.SchemasQueryIdByContentResponse; import com.azure.data.schemaregistry.implementation.models.SchemasRegisterResponse; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; /** An instance of this class provides access to all the operations defined in Schemas. */ @@ -85,8 +88,24 @@ Mono queryIdByContent( @PathParam("groupName") String groupName, @PathParam("schemaName") String schemaName, @QueryParam("api-version") String apiVersion, - @BodyParam("application/json; serialization=Avro") String schemaContent, - @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json; serialization=Avro") Flux schemaContent, + @HeaderParam("Content-Length") long contentLength, + @HeaderParam("Accept") String accept, + Context context); + + @Post("/$schemaGroups/{groupName}/schemas/{schemaName}:get-id") + @ExpectedResponses({204}) + @UnexpectedResponseExceptionType( + value = ErrorException.class, + code = {415}) + @UnexpectedResponseExceptionType(ErrorException.class) + Mono queryIdByContent( + @HostParam("endpoint") String endpoint, + @PathParam("groupName") String groupName, + @PathParam("schemaName") String schemaName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json; serialization=Avro") BinaryData schemaContent, + @HeaderParam("Content-Length") long contentLength, @HeaderParam("Accept") String accept, Context context); @@ -101,31 +120,51 @@ Mono register( @PathParam("groupName") String groupName, @PathParam("schemaName") String schemaName, @QueryParam("api-version") String apiVersion, - @BodyParam("application/json; serialization=Avro") String schemaContent, - @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json; serialization=Avro") Flux schemaContent, + @HeaderParam("Content-Length") long contentLength, + @HeaderParam("Accept") String accept, + Context context); + + @Put("/$schemaGroups/{groupName}/schemas/{schemaName}") + @ExpectedResponses({204}) + @UnexpectedResponseExceptionType( + value = ErrorException.class, + code = {415}) + @UnexpectedResponseExceptionType(ErrorException.class) + Mono register( + @HostParam("endpoint") String endpoint, + @PathParam("groupName") String groupName, + @PathParam("schemaName") String schemaName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json; serialization=Avro") BinaryData schemaContent, + @HeaderParam("Content-Length") long contentLength, @HeaderParam("Accept") String accept, Context context); } /** - * Gets a registered schema by its unique ID. Azure Schema Registry guarantees that ID is unique within a namespace. - * Operation response type is based on serialization of schema requested. + * Get a registered schema by its unique ID reference. + * + *

Gets a registered schema by its unique ID. Azure Schema Registry guarantees that ID is unique within a + * namespace. Operation response type is based on serialization of schema requested. * * @param id References specific schema in registry namespace. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a registered schema by its unique ID. + * @return a registered schema by its unique ID on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getByIdWithResponseAsync(String id, Context context) { - final String accept = "application/json; serialization=avro"; + final String accept = "application/json; serialization=Avro"; return service.getById(this.client.getEndpoint(), id, this.client.getApiVersion(), accept, context); } /** - * Gets the list of all versions of one schema. + * Get list schema versions. + * + *

Gets the list of all versions of one schema. * * @param groupName Schema group under which schema is registered. Group's serialization type should match the * serialization type specified in the request. @@ -134,7 +173,8 @@ public Mono getByIdWithResponseAsync(String id, Context * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the list of all versions of one schema. + * @return the list of all versions of one schema along with {@link Response} on successful completion of {@link + * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> getVersionsWithResponseAsync( @@ -145,25 +185,61 @@ public Mono> getVersionsWithResponseAsync( } /** - * Gets the ID referencing an existing schema within the specified schema group, as matched by schema content + * Get ID for existing schema. + * + *

Gets the ID referencing an existing schema within the specified schema group, as matched by schema content + * comparison. + * + * @param groupName Schema group under which schema is registered. Group's serialization type should match the + * serialization type specified in the request. + * @param schemaName Name of requested schema. + * @param schemaContent String representation (UTF-8) of the registered schema. + * @param contentLength The Content-Length header for the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorException thrown if the request is rejected by server. + * @throws ErrorException thrown if the request is rejected by server on status code 415. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the ID referencing an existing schema within the specified schema group, as matched by schema content + * comparison on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono queryIdByContentWithResponseAsync( + String groupName, String schemaName, Flux schemaContent, long contentLength, Context context) { + final String accept = "application/json"; + return service.queryIdByContent( + this.client.getEndpoint(), + groupName, + schemaName, + this.client.getApiVersion(), + schemaContent, + contentLength, + accept, + context); + } + + /** + * Get ID for existing schema. + * + *

Gets the ID referencing an existing schema within the specified schema group, as matched by schema content * comparison. * * @param groupName Schema group under which schema is registered. Group's serialization type should match the * serialization type specified in the request. * @param schemaName Name of requested schema. * @param schemaContent String representation (UTF-8) of the registered schema. - * @param contentType The contentType parameter. + * @param contentLength The Content-Length header for the request. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorException thrown if the request is rejected by server. * @throws ErrorException thrown if the request is rejected by server on status code 415. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the ID referencing an existing schema within the specified schema group, as matched by schema content - * comparison. + * comparison on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono queryIdByContentWithResponseAsync( - String groupName, String schemaName, String schemaContent, String contentType, Context context) { + String groupName, String schemaName, BinaryData schemaContent, long contentLength, Context context) { final String accept = "application/json"; return service.queryIdByContent( this.client.getEndpoint(), @@ -171,29 +247,67 @@ public Mono queryIdByContentWithResponseAsync( schemaName, this.client.getApiVersion(), schemaContent, - contentType, + contentLength, accept, context); } /** - * Register new schema. If schema of specified name does not exist in specified group, schema is created at version - * 1. If schema of specified name exists already in specified group, schema is created at latest version + 1. + * Register new schema + * + *

Register new schema. If schema of specified name does not exist in specified group, schema is created at + * version 1. If schema of specified name exists already in specified group, schema is created at latest version + + * 1. + * + * @param groupName Schema group under which schema should be registered. Group's serialization type should match + * the serialization type specified in the request. + * @param schemaName Name of schema being registered. + * @param schemaContent String representation (UTF-8) of the schema being registered. + * @param contentLength The Content-Length header for the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorException thrown if the request is rejected by server. + * @throws ErrorException thrown if the request is rejected by server on status code 415. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono registerWithResponseAsync( + String groupName, String schemaName, Flux schemaContent, long contentLength, Context context) { + final String accept = "application/json"; + return service.register( + this.client.getEndpoint(), + groupName, + schemaName, + this.client.getApiVersion(), + schemaContent, + contentLength, + accept, + context); + } + + /** + * Register new schema + * + *

Register new schema. If schema of specified name does not exist in specified group, schema is created at + * version 1. If schema of specified name exists already in specified group, schema is created at latest version + + * 1. * * @param groupName Schema group under which schema should be registered. Group's serialization type should match * the serialization type specified in the request. * @param schemaName Name of schema being registered. * @param schemaContent String representation (UTF-8) of the schema being registered. + * @param contentLength The Content-Length header for the request. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorException thrown if the request is rejected by server. * @throws ErrorException thrown if the request is rejected by server on status code 415. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono registerWithResponseAsync( - String groupName, String schemaName, String schemaContent, String contentType, Context context) { + String groupName, String schemaName, BinaryData schemaContent, long contentLength, Context context) { final String accept = "application/json"; return service.register( this.client.getEndpoint(), @@ -201,7 +315,7 @@ public Mono registerWithResponseAsync( schemaName, this.client.getApiVersion(), schemaContent, - contentType, + contentLength, accept, context); } diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/models/ErrorException.java b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/models/ErrorException.java index 1e48076d522df..331ace0b96d24 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/models/ErrorException.java +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/models/ErrorException.java @@ -30,6 +30,7 @@ public ErrorException(String message, HttpResponse response, Error value) { super(message, response, value); } + /** {@inheritDoc} */ @Override public Error getValue() { return (Error) super.getValue(); diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/models/SchemasGetByIdHeaders.java b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/models/SchemasGetByIdHeaders.java index ed6a9bd4cbbbd..2db54c3b8d083 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/models/SchemasGetByIdHeaders.java +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/models/SchemasGetByIdHeaders.java @@ -5,6 +5,7 @@ package com.azure.data.schemaregistry.implementation.models; import com.azure.core.annotation.Fluent; +import com.azure.core.http.HttpHeaders; import com.fasterxml.jackson.annotation.JsonProperty; /** The SchemasGetByIdHeaders model. */ @@ -52,6 +53,22 @@ public final class SchemasGetByIdHeaders { @JsonProperty(value = "Content-Type") private String contentType; + // HttpHeaders containing the raw property values. + /** + * Creates an instance of SchemasGetByIdHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public SchemasGetByIdHeaders(HttpHeaders rawHeaders) { + this.schemaVersion = Integer.parseInt(rawHeaders.getValue("Schema-Version")); + this.schemaId = rawHeaders.getValue("Schema-Id"); + this.schemaGroupName = rawHeaders.getValue("Schema-Group-Name"); + this.schemaName = rawHeaders.getValue("Schema-Name"); + this.schemaIdLocation = rawHeaders.getValue("Schema-Id-Location"); + this.location = rawHeaders.getValue("Location"); + this.contentType = rawHeaders.getValue("Content-Type"); + } + /** * Get the schemaVersion property: The Schema-Version property. * diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/models/SchemasGetByIdResponse.java b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/models/SchemasGetByIdResponse.java index 9813cb4658af9..19fd11da5bb9c 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/models/SchemasGetByIdResponse.java +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/models/SchemasGetByIdResponse.java @@ -7,11 +7,10 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; import com.azure.core.http.rest.ResponseBase; - -import java.nio.ByteBuffer; +import java.io.InputStream; /** Contains all response data for the getById operation. */ -public final class SchemasGetByIdResponse extends ResponseBase { +public final class SchemasGetByIdResponse extends ResponseBase { /** * Creates an instance of SchemasGetByIdResponse. * @@ -22,7 +21,21 @@ public final class SchemasGetByIdResponse extends ResponseBase Date: Wed, 14 Sep 2022 13:08:57 -0700 Subject: [PATCH 02/16] Update README.md version. --- sdk/schemaregistry/azure-data-schemaregistry/swagger/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/schemaregistry/azure-data-schemaregistry/swagger/README.md b/sdk/schemaregistry/azure-data-schemaregistry/swagger/README.md index 88239cb3432ee..2b4dd6ab4ef6c 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/swagger/README.md +++ b/sdk/schemaregistry/azure-data-schemaregistry/swagger/README.md @@ -16,7 +16,7 @@ autorest --java --use:@autorest/java@4.0.x ### Code generation settings ``` yaml -input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/77ace2a6387b5a210f6b822262bc68cffa55499d/specification/schemaregistry/data-plane/Microsoft.EventHub/stable/2021-10/schemaregistry.json +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/a31ffeca96db3901c77b7dabbb8f224f226e78b9/specification/schemaregistry/data-plane/Microsoft.EventHub/stable/2021-10/schemaregistry.json java: true output-folder: ../ namespace: com.azure.data.schemaregistry From 50baee7fbed3b8b2f57cf96fe7f135cb005b6ff3 Mon Sep 17 00:00:00 2001 From: Connie Date: Wed, 14 Sep 2022 13:09:39 -0700 Subject: [PATCH 03/16] Regeneration added empty spaces. --- .../data/schemaregistry/implementation/models/ErrorDetail.java | 1 - .../data/schemaregistry/implementation/models/SchemaGroups.java | 1 - .../schemaregistry/implementation/models/SchemaVersions.java | 1 - 3 files changed, 3 deletions(-) diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/models/ErrorDetail.java b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/models/ErrorDetail.java index d2090704a6ed6..c1cec549d4170 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/models/ErrorDetail.java +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/models/ErrorDetail.java @@ -6,7 +6,6 @@ import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; - import java.util.List; /** Error response returned from Azure Schema Registry service. */ diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/models/SchemaGroups.java b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/models/SchemaGroups.java index 380a81a791024..e7de5f685e384 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/models/SchemaGroups.java +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/models/SchemaGroups.java @@ -6,7 +6,6 @@ import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; - import java.util.List; /** Array received from the registry containing the list of schema groups. */ diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/models/SchemaVersions.java b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/models/SchemaVersions.java index c046ebfcfdf58..d981a6636e3b4 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/models/SchemaVersions.java +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/models/SchemaVersions.java @@ -6,7 +6,6 @@ import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; - import java.util.List; /** Array received from the registry containing the list of versions for specific schema. */ From 1c02ba793a4fa8fe864304311e87f35c0bda6beb Mon Sep 17 00:00:00 2001 From: Connie Date: Wed, 14 Sep 2022 13:11:04 -0700 Subject: [PATCH 04/16] Add GetSchemaVersion after generation. --- .../implementation/SchemasImpl.java | 52 ++++- .../SchemasGetSchemaVersionHeaders.java | 211 ++++++++++++++++++ .../SchemasGetSchemaVersionResponse.java | 41 ++++ 3 files changed, 299 insertions(+), 5 deletions(-) create mode 100644 sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/models/SchemasGetSchemaVersionHeaders.java create mode 100644 sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/models/SchemasGetSchemaVersionResponse.java diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/SchemasImpl.java b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/SchemasImpl.java index 81de88037d02b..309267d3348ce 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/SchemasImpl.java +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/SchemasImpl.java @@ -25,6 +25,7 @@ import com.azure.data.schemaregistry.implementation.models.ErrorException; import com.azure.data.schemaregistry.implementation.models.SchemaVersions; import com.azure.data.schemaregistry.implementation.models.SchemasGetByIdResponse; +import com.azure.data.schemaregistry.implementation.models.SchemasGetSchemaVersionResponse; import com.azure.data.schemaregistry.implementation.models.SchemasQueryIdByContentResponse; import com.azure.data.schemaregistry.implementation.models.SchemasRegisterResponse; import java.nio.ByteBuffer; @@ -77,6 +78,18 @@ Mono> getVersions( @HeaderParam("Accept") String accept, Context context); + @Get("/$schemaGroups/{groupName}/schemas/{schemaName}/versions/{schemaVersion}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ErrorException.class) + Mono getSchemaVersion( + @HostParam("endpoint") String endpoint, + @PathParam("groupName") String groupName, + @PathParam("schemaName") String schemaName, + @PathParam("schemaVersion") int schemaVersion, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + @Post("/$schemaGroups/{groupName}/schemas/{schemaName}:get-id") @ExpectedResponses({204}) @UnexpectedResponseExceptionType( @@ -168,7 +181,7 @@ public Mono getByIdWithResponseAsync(String id, Context * * @param groupName Schema group under which schema is registered. Group's serialization type should match the * serialization type specified in the request. - * @param schemaName Name of schema being registered. + * @param schemaName Name of schema. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ErrorException thrown if the request is rejected by server. @@ -184,6 +197,35 @@ public Mono> getVersionsWithResponseAsync( this.client.getEndpoint(), groupName, schemaName, this.client.getApiVersion(), accept, context); } + /** + * Get specific schema versions. + * + *

Gets one specific version of one schema. + * + * @param groupName Schema group under which schema is registered. Group's serialization type should match the + * serialization type specified in the request. + * @param schemaName Name of schema. + * @param schemaVersion Version number of specific schema. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ErrorException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return one specific version of one schema on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getSchemaVersionWithResponseAsync( + String groupName, String schemaName, int schemaVersion, Context context) { + final String accept = "application/json"; + return service.getSchemaVersion( + this.client.getEndpoint(), + groupName, + schemaName, + schemaVersion, + this.client.getApiVersion(), + accept, + context); + } + /** * Get ID for existing schema. * @@ -192,7 +234,7 @@ public Mono> getVersionsWithResponseAsync( * * @param groupName Schema group under which schema is registered. Group's serialization type should match the * serialization type specified in the request. - * @param schemaName Name of requested schema. + * @param schemaName Name of schema. * @param schemaContent String representation (UTF-8) of the registered schema. * @param contentLength The Content-Length header for the request. * @param context The context to associate with this operation. @@ -226,7 +268,7 @@ public Mono queryIdByContentWithResponseAsync( * * @param groupName Schema group under which schema is registered. Group's serialization type should match the * serialization type specified in the request. - * @param schemaName Name of requested schema. + * @param schemaName Name of schema. * @param schemaContent String representation (UTF-8) of the registered schema. * @param contentLength The Content-Length header for the request. * @param context The context to associate with this operation. @@ -261,7 +303,7 @@ public Mono queryIdByContentWithResponseAsync( * * @param groupName Schema group under which schema should be registered. Group's serialization type should match * the serialization type specified in the request. - * @param schemaName Name of schema being registered. + * @param schemaName Name of schema. * @param schemaContent String representation (UTF-8) of the schema being registered. * @param contentLength The Content-Length header for the request. * @param context The context to associate with this operation. @@ -295,7 +337,7 @@ public Mono registerWithResponseAsync( * * @param groupName Schema group under which schema should be registered. Group's serialization type should match * the serialization type specified in the request. - * @param schemaName Name of schema being registered. + * @param schemaName Name of schema. * @param schemaContent String representation (UTF-8) of the schema being registered. * @param contentLength The Content-Length header for the request. * @param context The context to associate with this operation. diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/models/SchemasGetSchemaVersionHeaders.java b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/models/SchemasGetSchemaVersionHeaders.java new file mode 100644 index 0000000000000..6958014397c5d --- /dev/null +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/models/SchemasGetSchemaVersionHeaders.java @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.data.schemaregistry.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.http.HttpHeaders; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SchemasGetSchemaVersionHeaders model. */ +@Fluent +public final class SchemasGetSchemaVersionHeaders { + /* + * The Schema-Version property. + */ + @JsonProperty(value = "Schema-Version") + private Integer schemaVersion; + + /* + * The Schema-Id property. + */ + @JsonProperty(value = "Schema-Id") + private String schemaId; + + /* + * The Schema-Group-Name property. + */ + @JsonProperty(value = "Schema-Group-Name") + private String schemaGroupName; + + /* + * The Schema-Name property. + */ + @JsonProperty(value = "Schema-Name") + private String schemaName; + + /* + * The Schema-Id-Location property. + */ + @JsonProperty(value = "Schema-Id-Location") + private String schemaIdLocation; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /* + * The Content-Type property. + */ + @JsonProperty(value = "Content-Type") + private String contentType; + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of SchemasGetSchemaVersionHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public SchemasGetSchemaVersionHeaders(HttpHeaders rawHeaders) { + this.schemaVersion = Integer.parseInt(rawHeaders.getValue("Schema-Version")); + this.schemaId = rawHeaders.getValue("Schema-Id"); + this.schemaGroupName = rawHeaders.getValue("Schema-Group-Name"); + this.schemaName = rawHeaders.getValue("Schema-Name"); + this.schemaIdLocation = rawHeaders.getValue("Schema-Id-Location"); + this.location = rawHeaders.getValue("Location"); + this.contentType = rawHeaders.getValue("Content-Type"); + } + + /** + * Get the schemaVersion property: The Schema-Version property. + * + * @return the schemaVersion value. + */ + public Integer getSchemaVersion() { + return this.schemaVersion; + } + + /** + * Set the schemaVersion property: The Schema-Version property. + * + * @param schemaVersion the schemaVersion value to set. + * @return the SchemasGetSchemaVersionHeaders object itself. + */ + public SchemasGetSchemaVersionHeaders setSchemaVersion(Integer schemaVersion) { + this.schemaVersion = schemaVersion; + return this; + } + + /** + * Get the schemaId property: The Schema-Id property. + * + * @return the schemaId value. + */ + public String getSchemaId() { + return this.schemaId; + } + + /** + * Set the schemaId property: The Schema-Id property. + * + * @param schemaId the schemaId value to set. + * @return the SchemasGetSchemaVersionHeaders object itself. + */ + public SchemasGetSchemaVersionHeaders setSchemaId(String schemaId) { + this.schemaId = schemaId; + return this; + } + + /** + * Get the schemaGroupName property: The Schema-Group-Name property. + * + * @return the schemaGroupName value. + */ + public String getSchemaGroupName() { + return this.schemaGroupName; + } + + /** + * Set the schemaGroupName property: The Schema-Group-Name property. + * + * @param schemaGroupName the schemaGroupName value to set. + * @return the SchemasGetSchemaVersionHeaders object itself. + */ + public SchemasGetSchemaVersionHeaders setSchemaGroupName(String schemaGroupName) { + this.schemaGroupName = schemaGroupName; + return this; + } + + /** + * Get the schemaName property: The Schema-Name property. + * + * @return the schemaName value. + */ + public String getSchemaName() { + return this.schemaName; + } + + /** + * Set the schemaName property: The Schema-Name property. + * + * @param schemaName the schemaName value to set. + * @return the SchemasGetSchemaVersionHeaders object itself. + */ + public SchemasGetSchemaVersionHeaders setSchemaName(String schemaName) { + this.schemaName = schemaName; + return this; + } + + /** + * Get the schemaIdLocation property: The Schema-Id-Location property. + * + * @return the schemaIdLocation value. + */ + public String getSchemaIdLocation() { + return this.schemaIdLocation; + } + + /** + * Set the schemaIdLocation property: The Schema-Id-Location property. + * + * @param schemaIdLocation the schemaIdLocation value to set. + * @return the SchemasGetSchemaVersionHeaders object itself. + */ + public SchemasGetSchemaVersionHeaders setSchemaIdLocation(String schemaIdLocation) { + this.schemaIdLocation = schemaIdLocation; + return this; + } + + /** + * Get the location property: The Location property. + * + * @return the location value. + */ + public String getLocation() { + return this.location; + } + + /** + * Set the location property: The Location property. + * + * @param location the location value to set. + * @return the SchemasGetSchemaVersionHeaders object itself. + */ + public SchemasGetSchemaVersionHeaders setLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the contentType property: The Content-Type property. + * + * @return the contentType value. + */ + public String getContentType() { + return this.contentType; + } + + /** + * Set the contentType property: The Content-Type property. + * + * @param contentType the contentType value to set. + * @return the SchemasGetSchemaVersionHeaders object itself. + */ + public SchemasGetSchemaVersionHeaders setContentType(String contentType) { + this.contentType = contentType; + return this; + } +} diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/models/SchemasGetSchemaVersionResponse.java b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/models/SchemasGetSchemaVersionResponse.java new file mode 100644 index 0000000000000..4bcd261922691 --- /dev/null +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/models/SchemasGetSchemaVersionResponse.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.data.schemaregistry.implementation.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import java.io.InputStream; + +/** Contains all response data for the getSchemaVersion operation. */ +public final class SchemasGetSchemaVersionResponse extends ResponseBase { + /** + * Creates an instance of SchemasGetSchemaVersionResponse. + * + * @param request the request which resulted in this SchemasGetSchemaVersionResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public SchemasGetSchemaVersionResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + InputStream value, + SchemasGetSchemaVersionHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** + * Gets the deserialized response body. + * + * @return the deserialized response body. + */ + @Override + public InputStream getValue() { + return super.getValue(); + } +} From b3da9b9536ccd4a8f430a9b3f5197b913fb97908 Mon Sep 17 00:00:00 2001 From: Connie Date: Wed, 14 Sep 2022 15:06:31 -0700 Subject: [PATCH 05/16] Fixing build breaks. --- .../SchemaRegistryAsyncClient.java | 74 ++++++++++++++----- .../schemaregistry/SchemaRegistryClient.java | 4 + 2 files changed, 60 insertions(+), 18 deletions(-) diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/SchemaRegistryAsyncClient.java b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/SchemaRegistryAsyncClient.java index 2250d72e46020..019fb6cf17be4 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/SchemaRegistryAsyncClient.java +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/SchemaRegistryAsyncClient.java @@ -10,18 +10,23 @@ import com.azure.core.exception.ResourceNotFoundException; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.BinaryData; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; import com.azure.core.util.logging.ClientLogger; import com.azure.data.schemaregistry.implementation.AzureSchemaRegistryImpl; import com.azure.data.schemaregistry.implementation.SchemaRegistryHelper; import com.azure.data.schemaregistry.implementation.models.ErrorException; -import com.azure.data.schemaregistry.implementation.models.SchemasQueryIdByContentHeaders; import com.azure.data.schemaregistry.models.SchemaFormat; import com.azure.data.schemaregistry.models.SchemaProperties; import com.azure.data.schemaregistry.models.SchemaRegistrySchema; import reactor.core.publisher.Mono; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.UncheckedIOException; import java.nio.charset.StandardCharsets; import java.util.Objects; @@ -160,9 +165,10 @@ Mono> registerSchemaWithResponse(String groupName, St logger.verbose("Registering schema. Group: '{}', name: '{}', serialization type: '{}', payload: '{}'", groupName, name, format, schemaDefinition); - final String contentType = getContentType(format); + final BinaryData binaryData = BinaryData.fromString(schemaDefinition); - return restService.getSchemas().registerWithResponseAsync(groupName, name, schemaDefinition, contentType, context) + return restService.getSchemas().registerWithResponseAsync(groupName, name, binaryData, binaryData.getLength(), + context) .map(response -> { final SchemaProperties registered = SchemaRegistryHelper.getSchemaProperties(response); @@ -182,6 +188,7 @@ Mono> registerSchemaWithResponse(String groupName, St * @throws NullPointerException if {@code schemaId} is null. * @throws ResourceNotFoundException if a schema with the matching {@code schemaId} could not be found. * @throws HttpResponseException if an issue was encountered while fetching the schema. + * @throws UncheckedIOException if an error occurred while deserializing response. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getSchema(String schemaId) { @@ -198,6 +205,7 @@ public Mono getSchema(String schemaId) { * @throws NullPointerException if {@code schemaId} is null. * @throws ResourceNotFoundException if a schema with the matching {@code schemaId} could not be found. * @throws HttpResponseException if an issue was encountered while fetching the schema. + * @throws UncheckedIOException if an error occurred while deserializing response. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> getSchemaWithResponse(String schemaId) { @@ -211,13 +219,21 @@ Mono> getSchemaWithResponse(String schemaId, Cont return this.restService.getSchemas().getByIdWithResponseAsync(schemaId, context) .onErrorMap(ErrorException.class, SchemaRegistryAsyncClient::remapError) - .map(response -> { + .handle((response, sink) -> { final SchemaProperties schemaObject = SchemaRegistryHelper.getSchemaProperties(response); - final String schema = new String(response.getValue(), StandardCharsets.UTF_8); + final String schema; - return new SimpleResponse<>( + try { + schema = convertToString(response.getValue()); + } catch (UncheckedIOException e) { + sink.error(e); + return; + } + + sink.next(new SimpleResponse<>( response.getRequest(), response.getStatusCode(), - response.getHeaders(), new SchemaRegistrySchema(schemaObject, schema)); + response.getHeaders(), new SchemaRegistrySchema(schemaObject, schema))); + sink.complete(); }); } @@ -232,8 +248,8 @@ Mono> getSchemaWithResponse(String schemaId, Cont * * @return A mono that completes with the properties for a matching schema. * - * @throws NullPointerException if {@code groupName}, {@code name}, {@code schemaDefinition}, or {@code format} is - * null. + * @throws NullPointerException if {@code groupName}, {@code name}, {@code schemaDefinition}, or {@code format} + * is null. * @throws ResourceNotFoundException if a schema with matching parameters could not be located. * @throws HttpResponseException if an issue was encountered while finding a matching schema. */ @@ -255,8 +271,8 @@ public Mono getSchemaProperties(String groupName, String name, * * @return A mono that completes with the properties for a matching schema. * - * @throws NullPointerException if {@code groupName}, {@code name}, {@code schemaDefinition}, or {@code format} is - * null. + * @throws NullPointerException if {@code groupName}, {@code name}, {@code schemaDefinition}, or {@code format} + * is null. * @throws ResourceNotFoundException if a schema with matching parameters could not be located. * @throws HttpResponseException if an issue was encountered while finding a matching schema. */ @@ -279,8 +295,8 @@ public Mono> getSchemaPropertiesWithResponse(String g * * @return A mono that completes with the properties for a matching schema. * - * @throws NullPointerException if {@code groupName}, {@code name}, {@code schemaDefinition}, or {@code format} is - * null. + * @throws NullPointerException if {@code groupName}, {@code name}, {@code schemaDefinition}, or {@code format} + * is null. * @throws ResourceNotFoundException if a schema with matching parameters could not be located. * @throws HttpResponseException if an issue was encountered while finding a matching schema. */ @@ -301,13 +317,12 @@ Mono> getSchemaPropertiesWithResponse(String groupNam context = Context.NONE; } - final String contentType = getContentType(format); + final BinaryData binaryData = BinaryData.fromString(schemaDefinition); return restService.getSchemas() - .queryIdByContentWithResponseAsync(groupName, name, schemaDefinition, contentType, context) + .queryIdByContentWithResponseAsync(groupName, name, binaryData, binaryData.getLength(), context) .onErrorMap(ErrorException.class, SchemaRegistryAsyncClient::remapError) .map(response -> { - final SchemasQueryIdByContentHeaders deserializedHeaders = response.getDeserializedHeaders(); final SchemaProperties properties = SchemaRegistryHelper.getSchemaProperties(response); return new SimpleResponse<>( @@ -338,7 +353,30 @@ private static Throwable remapError(ErrorException error) { return error; } - private static String getContentType(SchemaFormat schemaFormat) { - return "application/json; serialization=" + schemaFormat; + /** + * Converts an input stream into its string representation. + * + * @param inputStream Input stream. + * + * @return A string representation. + * + * @throws UncheckedIOException if an {@link IOException} is thrown when creating the readers. + */ + private static String convertToString(InputStream inputStream) { + final StringBuilder builder = new StringBuilder(); + try (BufferedReader reader = new BufferedReader( + new InputStreamReader(inputStream, StandardCharsets.UTF_8))) { + + String str; + + while ((str = reader.readLine()) != null) { + builder.append(str); + } + + } catch (IOException exception) { + throw new UncheckedIOException("Error occurred while deserializing schemaContent.", exception); + } + + return builder.toString(); } } diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/SchemaRegistryClient.java b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/SchemaRegistryClient.java index 03f36b4b9692b..117d2828da46b 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/SchemaRegistryClient.java +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/SchemaRegistryClient.java @@ -14,6 +14,8 @@ import com.azure.data.schemaregistry.models.SchemaProperties; import com.azure.data.schemaregistry.models.SchemaRegistrySchema; +import java.io.UncheckedIOException; + /** * HTTP-based client that interacts with Azure Schema Registry service to store and retrieve schemas on demand. * @@ -134,6 +136,7 @@ public Response registerSchemaWithResponse(String groupName, S * @throws NullPointerException if {@code schemaId} is null. * @throws ResourceNotFoundException if a schema with the matching {@code schemaId} could not be found. * @throws HttpResponseException if an issue was encountered while fetching the schema. + * @throws UncheckedIOException if an error occurred while deserializing response. */ @ServiceMethod(returns = ReturnType.SINGLE) public SchemaRegistrySchema getSchema(String schemaId) { @@ -151,6 +154,7 @@ public SchemaRegistrySchema getSchema(String schemaId) { * @throws NullPointerException if {@code schemaId} is null. * @throws ResourceNotFoundException if a schema with the matching {@code schemaId} could not be found. * @throws HttpResponseException if an issue was encountered while fetching the schema. + * @throws UncheckedIOException if an error occurred while deserializing response. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getSchemaWithResponse(String schemaId, Context context) { From 20cc1747ae508aff42e990c975d359772ef34c3d Mon Sep 17 00:00:00 2001 From: Connie Date: Mon, 19 Sep 2022 14:46:08 -0700 Subject: [PATCH 06/16] Adding --add-exports and add-opens for tests. --- sdk/schemaregistry/azure-data-schemaregistry/pom.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sdk/schemaregistry/azure-data-schemaregistry/pom.xml b/sdk/schemaregistry/azure-data-schemaregistry/pom.xml index 23906a86bd6b2..fb0189a78e981 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/pom.xml +++ b/sdk/schemaregistry/azure-data-schemaregistry/pom.xml @@ -39,7 +39,10 @@ + --add-opens com.azure.core/com.azure.core.implementation.util=ALL-UNNAMED --add-opens com.azure.data.schemaregistry/com.azure.data.schemaregistry=ALL-UNNAMED + + --add-exports com.azure.core/com.azure.core.implementation.util=ALL-UNNAMED --add-exports com.azure.data.schemaregistry/com.azure.data.schemaregistry.implementation.models=ALL-UNNAMED **/implementation/**/*.java From ddc2ec3815e5117c4adf77e2d888c77c171e0b41 Mon Sep 17 00:00:00 2001 From: Connie Date: Mon, 26 Sep 2022 10:34:49 -0700 Subject: [PATCH 07/16] Adding public surface --- .../SchemaRegistryAsyncClient.java | 70 +++++++++++++++++++ .../schemaregistry/SchemaRegistryClient.java | 44 ++++++++++++ .../implementation/SchemaRegistryHelper.java | 9 +-- .../models/SchemaProperties.java | 20 ++++-- 4 files changed, 135 insertions(+), 8 deletions(-) diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/SchemaRegistryAsyncClient.java b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/SchemaRegistryAsyncClient.java index 019fb6cf17be4..8390151ce2348 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/SchemaRegistryAsyncClient.java +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/SchemaRegistryAsyncClient.java @@ -195,6 +195,26 @@ public Mono getSchema(String schemaId) { return getSchemaWithResponse(schemaId).map(Response::getValue); } + /** + * Gets the schema properties of the schema associated with the group name, schema name, and schema version. + * + * @param groupName Group name for the schema + * @param schemaName Name of the schema + * @param schemaVersion Version of schema + * + * @return The {@link SchemaProperties} matching the parameters. + * + * @throws NullPointerException if {@code groupName} or {@code schemaName} is null. + * @throws ResourceNotFoundException if a schema with the matching {@code groupName} or {@code schemaName} could + * not be found. + * @throws HttpResponseException if an issue was encountered while fetching the schema. + * @throws UncheckedIOException if an error occurred while deserializing response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getSchema(String groupName, String schemaName, int schemaVersion) { + return getSchemaWithResponse(groupName, schemaName, schemaVersion).map(Response::getValue); + } + /** * Gets the schema properties of the schema associated with the unique schema id. * @@ -212,6 +232,28 @@ public Mono> getSchemaWithResponse(String schemaI return FluxUtil.withContext(context -> getSchemaWithResponse(schemaId, context)); } + /** + * Gets the schema properties of the schema associated with the group name, schema name, and schema version. + * + * @param groupName Group name for the schema + * @param schemaName Name of the schema + * @param schemaVersion Version of schema + * + * @return The {@link SchemaProperties} matching the parameters. + * + * @throws NullPointerException if {@code groupName} or {@code schemaName} is null. + * @throws ResourceNotFoundException if a schema with the matching {@code groupName} or {@code schemaName} could + * not be found. + * @throws HttpResponseException if an issue was encountered while fetching the schema. + * @throws UncheckedIOException if an error occurred while deserializing response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getSchemaWithResponse(String groupName, String schemaName, + int schemaVersion) { + + return FluxUtil.withContext(context -> getSchemaWithResponse(groupName, schemaName, schemaVersion, context)); + } + Mono> getSchemaWithResponse(String schemaId, Context context) { if (Objects.isNull(schemaId)) { return monoError(logger, new NullPointerException("'schemaId' should not be null.")); @@ -237,6 +279,34 @@ Mono> getSchemaWithResponse(String schemaId, Cont }); } + Mono> getSchemaWithResponse(String groupName, String schemaName, int schemaVersion, + Context context) { + + if (Objects.isNull(groupName)) { + return monoError(logger, new NullPointerException("'groupName' should not be null.")); + } + + // return this.restService.getSchemas().getByIdWithResponseAsync(schemaId, context) + // .onErrorMap(ErrorException.class, SchemaRegistryAsyncClient::remapError) + // .handle((response, sink) -> { + // final SchemaProperties schemaObject = SchemaRegistryHelper.getSchemaProperties(response); + // final String schema; + // + // try { + // schema = convertToString(response.getValue()); + // } catch (UncheckedIOException e) { + // sink.error(e); + // return; + // } + // + // sink.next(new SimpleResponse<>( + // response.getRequest(), response.getStatusCode(), + // response.getHeaders(), new SchemaRegistrySchema(schemaObject, schema))); + // sink.complete(); + // }); + return Mono.empty(); + } + /** * Gets the schema identifier associated with the given schema. Gets a cached value if it exists, otherwise makes a * call to the service. diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/SchemaRegistryClient.java b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/SchemaRegistryClient.java index 117d2828da46b..abf02b30283d9 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/SchemaRegistryClient.java +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/SchemaRegistryClient.java @@ -10,9 +10,11 @@ import com.azure.core.exception.ResourceNotFoundException; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; import com.azure.data.schemaregistry.models.SchemaFormat; import com.azure.data.schemaregistry.models.SchemaProperties; import com.azure.data.schemaregistry.models.SchemaRegistrySchema; +import reactor.core.publisher.Mono; import java.io.UncheckedIOException; @@ -143,6 +145,26 @@ public SchemaRegistrySchema getSchema(String schemaId) { return this.asyncClient.getSchema(schemaId).block(); } + /** + * Gets the schema properties of the schema associated with the group name, schema name, and schema version. + * + * @param groupName Group name for the schema + * @param schemaName Name of the schema + * @param schemaVersion Version of schema + * + * @return The {@link SchemaProperties} matching the parameters. + * + * @throws NullPointerException if {@code groupName} or {@code schemaName} is null. + * @throws ResourceNotFoundException if a schema with the matching {@code groupName} or {@code schemaName} could + * not be found. + * @throws HttpResponseException if an issue was encountered while fetching the schema. + * @throws UncheckedIOException if an error occurred while deserializing response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SchemaRegistrySchema getSchema(String groupName, String schemaName, int schemaVersion) { + return this.asyncClient.getSchema(groupName, schemaName, schemaVersion).block(); + } + /** * Gets the schema properties of the schema associated with the unique schema id. * @@ -161,6 +183,28 @@ public Response getSchemaWithResponse(String schemaId, Con return this.asyncClient.getSchemaWithResponse(schemaId, context).block(); } + /** + * Gets the schema properties of the schema associated with the group name, schema name, and schema version. + * + * @param groupName Group name for the schema + * @param schemaName Name of the schema + * @param schemaVersion Version of schema + * @param context The context to pass to the Http pipeline. + * + * @return The {@link SchemaProperties} matching the parameters. + * + * @throws NullPointerException if {@code groupName} or {@code schemaName} is null. + * @throws ResourceNotFoundException if a schema with the matching {@code groupName} or {@code schemaName} could + * not be found. + * @throws HttpResponseException if an issue was encountered while fetching the schema. + * @throws UncheckedIOException if an error occurred while deserializing response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getSchemaWithResponse(String groupName, String schemaName, + int schemaVersion, Context context) { + return this.asyncClient.getSchemaWithResponse(groupName, schemaName, schemaVersion, context).block(); + } + /** * Gets schema properties for a schema with matching {@code groupName}, {@code name}, {@code schemaDefinition}, and * {@code format}. diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/SchemaRegistryHelper.java b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/SchemaRegistryHelper.java index 599d2914689cf..d36b23cf454ba 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/SchemaRegistryHelper.java +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/SchemaRegistryHelper.java @@ -23,7 +23,8 @@ public final class SchemaRegistryHelper { * Accessor interface. */ public interface SchemaRegistryModelsAccessor { - SchemaProperties getSchemaProperties(String id, SchemaFormat format, String groupName, String name); + SchemaProperties getSchemaProperties(String id, SchemaFormat format, String groupName, String name, + int version); } /** @@ -39,21 +40,21 @@ public static SchemaProperties getSchemaProperties(SchemasRegisterResponse respo final SchemasRegisterHeaders headers = response.getDeserializedHeaders(); return accessor.getSchemaProperties(headers.getSchemaId(), SchemaFormat.AVRO, headers.getSchemaGroupName(), - headers.getSchemaName()); + headers.getSchemaName(), headers.getSchemaVersion()); } public static SchemaProperties getSchemaProperties(SchemasGetByIdResponse response) { final SchemasGetByIdHeaders headers = response.getDeserializedHeaders(); return accessor.getSchemaProperties(headers.getSchemaId(), SchemaFormat.AVRO, headers.getSchemaGroupName(), - headers.getSchemaName()); + headers.getSchemaName(), headers.getSchemaVersion()); } public static SchemaProperties getSchemaProperties(SchemasQueryIdByContentResponse response) { final SchemasQueryIdByContentHeaders headers = response.getDeserializedHeaders(); return accessor.getSchemaProperties(headers.getSchemaId(), SchemaFormat.AVRO, headers.getSchemaGroupName(), - headers.getSchemaName()); + headers.getSchemaName(), headers.getSchemaVersion()); } } diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/models/SchemaProperties.java b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/models/SchemaProperties.java index 848de66f6d4e4..177ac3907ac08 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/models/SchemaProperties.java +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/models/SchemaProperties.java @@ -21,12 +21,14 @@ public final class SchemaProperties { private final SchemaFormat format; private final String groupName; private final String name; + private final int version; static { SchemaRegistryHelper.setAccessor(new SchemaRegistryHelper.SchemaRegistryModelsAccessor() { @Override - public SchemaProperties getSchemaProperties(String id, SchemaFormat format, String groupName, String name) { - return new SchemaProperties(id, format, groupName, name); + public SchemaProperties getSchemaProperties(String id, SchemaFormat format, String groupName, String name, + int version) { + return new SchemaProperties(id, format, groupName, name, version); } }); } @@ -38,7 +40,7 @@ public SchemaProperties getSchemaProperties(String id, SchemaFormat format, Stri * @param format The type of schema, e.g. avro, json. */ public SchemaProperties(String id, SchemaFormat format) { - this(id, format, null, null); + this(id, format, null, null, -1); } /** @@ -49,11 +51,12 @@ public SchemaProperties(String id, SchemaFormat format) { * @param groupName The schema group for this schema. * @param name The name of the schema. */ - SchemaProperties(String id, SchemaFormat format, String groupName, String name) { + SchemaProperties(String id, SchemaFormat format, String groupName, String name, int version) { this.id = id; this.format = format; this.groupName = groupName; this.name = name; + this.version = version; } /** @@ -90,4 +93,13 @@ public String getGroupName() { public String getName() { return name; } + + /** + * Gets the version of the schema. + * + * @return The version of the schema. + */ + public int getVersion() { + return version; + } } From 42bda4c61ae524ea31142a8ed23fcb576077aeb0 Mon Sep 17 00:00:00 2001 From: Connie Date: Mon, 26 Sep 2022 11:09:50 -0700 Subject: [PATCH 08/16] Referencing unreleased azure-core --- sdk/schemaregistry/azure-data-schemaregistry-apacheavro/pom.xml | 2 +- sdk/schemaregistry/azure-data-schemaregistry/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/pom.xml b/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/pom.xml index 90518ee2490f1..414279269571e 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/pom.xml +++ b/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/pom.xml @@ -47,7 +47,7 @@ com.azure azure-core - 1.32.0 + 1.33.0-beta.1 com.azure diff --git a/sdk/schemaregistry/azure-data-schemaregistry/pom.xml b/sdk/schemaregistry/azure-data-schemaregistry/pom.xml index fb0189a78e981..bf00f827c0fe4 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/pom.xml +++ b/sdk/schemaregistry/azure-data-schemaregistry/pom.xml @@ -52,7 +52,7 @@ com.azure azure-core - 1.32.0 + 1.33.0-beta.1 com.azure From 5a37851311b9669dbfb414180fd989ca3ac06022 Mon Sep 17 00:00:00 2001 From: Connie Date: Tue, 27 Sep 2022 00:21:51 -0700 Subject: [PATCH 09/16] Adding test. --- ...ientTests.getSchemaByGroupNameVersion.json | 1 + .../SchemaRegistryAsyncClientTests.java | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 sdk/schemaregistry/azure-data-schemaregistry-apacheavro/src/test/resources/session-records/SchemaRegistryAsyncClientTests.getSchemaByGroupNameVersion.json diff --git a/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/src/test/resources/session-records/SchemaRegistryAsyncClientTests.getSchemaByGroupNameVersion.json b/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/src/test/resources/session-records/SchemaRegistryAsyncClientTests.getSchemaByGroupNameVersion.json new file mode 100644 index 0000000000000..0967ef424bce6 --- /dev/null +++ b/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/src/test/resources/session-records/SchemaRegistryAsyncClientTests.getSchemaByGroupNameVersion.json @@ -0,0 +1 @@ +{} diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/test/java/com/azure/data/schemaregistry/SchemaRegistryAsyncClientTests.java b/sdk/schemaregistry/azure-data-schemaregistry/src/test/java/com/azure/data/schemaregistry/SchemaRegistryAsyncClientTests.java index 9114d69cfcdd7..7dbf273c7fbc1 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/test/java/com/azure/data/schemaregistry/SchemaRegistryAsyncClientTests.java +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/test/java/com/azure/data/schemaregistry/SchemaRegistryAsyncClientTests.java @@ -309,6 +309,33 @@ public void getSchemaIdDoesNotExist() { .verify(); } + @Test + public void getSchemaByGroupNameVersion() { + // Arrange + final SchemaRegistryAsyncClient client1 = builder.buildAsyncClient(); + final String schemaName = testResourceNamer.randomName("sch", RESOURCE_LENGTH); + + // Register a schema first. + final SchemaProperties registeredSchema = client1.registerSchema(schemaGroup, schemaName, SCHEMA_CONTENT, + SchemaFormat.AVRO).block(Duration.ofSeconds(10)); + + assertNotNull(registeredSchema); + + // Act & Assert + StepVerifier.create(client1.getSchema(schemaGroup, schemaName, registeredSchema.getVersion())) + .assertNext(actual -> { + SchemaProperties properties = actual.getProperties(); + assertNotNull(properties); + + assertEquals(registeredSchema.getVersion(), properties.getVersion()); + assertEquals(schemaGroup, registeredSchema.getGroupName()); + assertEquals(schemaName, registeredSchema.getName()); + assertEquals(registeredSchema.getId(), registeredSchema.getId()); + }) + .expectComplete() + .verify(); + } + static void assertSchemaRegistrySchema(SchemaRegistrySchema actual, String expectedSchemaId, SchemaFormat format, String expectedContents) { From d08beff9db26596114f9b55c7dd4d6a9f019865c Mon Sep 17 00:00:00 2001 From: Connie Date: Tue, 27 Sep 2022 00:23:28 -0700 Subject: [PATCH 10/16] Asserting schema version. --- .../data/schemaregistry/SchemaRegistryAsyncClientTests.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/test/java/com/azure/data/schemaregistry/SchemaRegistryAsyncClientTests.java b/sdk/schemaregistry/azure-data-schemaregistry/src/test/java/com/azure/data/schemaregistry/SchemaRegistryAsyncClientTests.java index 7dbf273c7fbc1..15c0a0ea3aa8b 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/test/java/com/azure/data/schemaregistry/SchemaRegistryAsyncClientTests.java +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/test/java/com/azure/data/schemaregistry/SchemaRegistryAsyncClientTests.java @@ -191,6 +191,7 @@ public void registerAndGetSchemaId() { StepVerifier.create(client1.registerSchema(schemaGroup, schemaName, SCHEMA_CONTENT, SchemaFormat.AVRO)) .assertNext(response -> { assertSchemaProperties(response, null, SchemaFormat.AVRO, schemaGroup, schemaName); + assertEquals(1, response.getVersion()); schemaId.set(response.getId()); }).verifyComplete(); @@ -203,6 +204,9 @@ public void registerAndGetSchemaId() { StepVerifier.create(client2.getSchemaProperties(schemaGroup, schemaName, SCHEMA_CONTENT, SchemaFormat.AVRO)) .assertNext(schema -> { assertSchemaProperties(schema, schemaIdToGet, SchemaFormat.AVRO, schemaGroup, schemaName); + + // Should be the same version since we did not register a new one. + assertEquals(1, schema.getVersion()); }) .verifyComplete(); } From 40986c09b0ae201c93cdbf3219d392bfde05c8a8 Mon Sep 17 00:00:00 2001 From: Connie Date: Tue, 27 Sep 2022 00:31:24 -0700 Subject: [PATCH 11/16] Deserializing response for schema call. --- .../SchemaRegistryAsyncClient.java | 47 +++++++++++-------- .../implementation/SchemaRegistryHelper.java | 10 ++++ 2 files changed, 38 insertions(+), 19 deletions(-) diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/SchemaRegistryAsyncClient.java b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/SchemaRegistryAsyncClient.java index 8390151ce2348..611a6f5a0737a 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/SchemaRegistryAsyncClient.java +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/SchemaRegistryAsyncClient.java @@ -286,25 +286,34 @@ Mono> getSchemaWithResponse(String groupName, Str return monoError(logger, new NullPointerException("'groupName' should not be null.")); } - // return this.restService.getSchemas().getByIdWithResponseAsync(schemaId, context) - // .onErrorMap(ErrorException.class, SchemaRegistryAsyncClient::remapError) - // .handle((response, sink) -> { - // final SchemaProperties schemaObject = SchemaRegistryHelper.getSchemaProperties(response); - // final String schema; - // - // try { - // schema = convertToString(response.getValue()); - // } catch (UncheckedIOException e) { - // sink.error(e); - // return; - // } - // - // sink.next(new SimpleResponse<>( - // response.getRequest(), response.getStatusCode(), - // response.getHeaders(), new SchemaRegistrySchema(schemaObject, schema))); - // sink.complete(); - // }); - return Mono.empty(); + return this.restService.getSchemas().getSchemaVersionWithResponseAsync(groupName, schemaName, schemaVersion, + context) + .onErrorMap(ErrorException.class, SchemaRegistryAsyncClient::remapError) + .handle((response, sink) -> { + final InputStream schemaInputStream = response.getValue(); + final SchemaProperties schemaObject = SchemaRegistryHelper.getSchemaProperties(response); + final String schema; + + if (schemaInputStream == null) { + sink.error(new IllegalArgumentException(String.format( + "Schema definition should not be null. Group Name: %s. Schema Name: %s. Version: %d", + groupName, schemaName, schemaVersion))); + + return; + } + + try { + schema = convertToString(schemaInputStream); + } catch (UncheckedIOException e) { + sink.error(e); + return; + } + + sink.next(new SimpleResponse<>( + response.getRequest(), response.getStatusCode(), + response.getHeaders(), new SchemaRegistrySchema(schemaObject, schema))); + sink.complete(); + }); } /** diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/SchemaRegistryHelper.java b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/SchemaRegistryHelper.java index d36b23cf454ba..289333f6e9c98 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/SchemaRegistryHelper.java +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/implementation/SchemaRegistryHelper.java @@ -4,6 +4,8 @@ import com.azure.data.schemaregistry.implementation.models.SchemasGetByIdHeaders; import com.azure.data.schemaregistry.implementation.models.SchemasGetByIdResponse; +import com.azure.data.schemaregistry.implementation.models.SchemasGetSchemaVersionHeaders; +import com.azure.data.schemaregistry.implementation.models.SchemasGetSchemaVersionResponse; import com.azure.data.schemaregistry.implementation.models.SchemasQueryIdByContentHeaders; import com.azure.data.schemaregistry.implementation.models.SchemasQueryIdByContentResponse; import com.azure.data.schemaregistry.implementation.models.SchemasRegisterHeaders; @@ -56,5 +58,13 @@ public static SchemaProperties getSchemaProperties(SchemasQueryIdByContentRespon return accessor.getSchemaProperties(headers.getSchemaId(), SchemaFormat.AVRO, headers.getSchemaGroupName(), headers.getSchemaName(), headers.getSchemaVersion()); } + + public static SchemaProperties getSchemaProperties(SchemasGetSchemaVersionResponse response) { + final SchemasGetSchemaVersionHeaders headers = response.getDeserializedHeaders(); + + return accessor.getSchemaProperties(headers.getSchemaId(), SchemaFormat.AVRO, headers.getSchemaGroupName(), + headers.getSchemaName(), headers.getSchemaVersion()); + } + } From 0c60ebbbdd0a31cd6a2627b3008284d18f051619 Mon Sep 17 00:00:00 2001 From: Connie Date: Tue, 27 Sep 2022 00:31:32 -0700 Subject: [PATCH 12/16] Adding test recording for async. --- ...ientTests.getSchemaByGroupNameVersion.json | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryAsyncClientTests.getSchemaByGroupNameVersion.json diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryAsyncClientTests.getSchemaByGroupNameVersion.json b/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryAsyncClientTests.getSchemaByGroupNameVersion.json new file mode 100644 index 0000000000000..ec3d27ca88fdd --- /dev/null +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryAsyncClientTests.getSchemaByGroupNameVersion.json @@ -0,0 +1,53 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/mygroup/schemas/sch439370379?api-version=2021-10", + "Headers" : { + "User-Agent" : "azsdk-java-azure-data-schemaregistry/1.3.0-beta.1 (11.0.5; Windows 10; 10.0)", + "x-ms-client-request-id" : "899445ce-8e18-4cf3-90fe-ee4fb5ef49ea", + "Content-Type" : "application/json; serialization=Avro" + }, + "Response" : { + "content-length" : "0", + "Schema-Version" : "1", + "Server" : "Microsoft-HTTPAPI/2.0", + "Schema-Name" : "sch439370379", + "retry-after" : "0", + "Schema-Id-Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/$schemas/b5e21f8bdb234cceb2ba558935f56704?api-version=2021-10", + "StatusCode" : "204", + "Date" : "Tue, 27 Sep 2022 07:29:56 GMT", + "Strict-Transport-Security" : "max-age=31536000", + "Schema-Id" : "b5e21f8bdb234cceb2ba558935f56704", + "Schema-Group-Name" : "mygroup", + "Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/mygroup/schemas/sch439370379/versions/1?api-version=2021-10", + "Schema-Versions-Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/mygroup/schemas/sch439370379/versions?api-version=2021-10" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/mygroup/schemas/sch439370379/versions/1?api-version=2021-10", + "Headers" : { + "User-Agent" : "azsdk-java-azure-data-schemaregistry/1.3.0-beta.1 (11.0.5; Windows 10; 10.0)", + "x-ms-client-request-id" : "d4f429db-d225-4fbe-92ee-b69fcbadffd2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Schema-Version" : "1", + "Server" : "Microsoft-HTTPAPI/2.0", + "Schema-Name" : "sch439370379", + "retry-after" : "0", + "Schema-Id-Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/$schemas/b5e21f8bdb234cceb2ba558935f56704?api-version=2021-10", + "StatusCode" : "200", + "Date" : "Tue, 27 Sep 2022 07:29:56 GMT", + "Strict-Transport-Security" : "max-age=31536000", + "Schema-Id" : "b5e21f8bdb234cceb2ba558935f56704", + "Schema-Group-Name" : "mygroup", + "Body" : "{\"type\":\"record\",\"namespace\":\"TestSchema\",\"name\":\"Employee\",\"fields\":[{\"name\":\"Name\",\"type\":\"string\"},{\"name\":\"Age\",\"type\":\"int\"}]}", + "Content-Type" : "application/json;serialization=Avro", + "Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/mygroup/schemas/sch439370379/versions/1?api-version=2021-10", + "Schema-Versions-Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/mygroup/schemas/sch439370379/versions?api-version=2021-10" + }, + "Exception" : null + } ], + "variables" : [ "sch439370379" ] +} \ No newline at end of file From 273edf6bb9abc97d7764f95f744dc0d57c7bbf18 Mon Sep 17 00:00:00 2001 From: Connie Date: Tue, 27 Sep 2022 00:34:53 -0700 Subject: [PATCH 13/16] Adding sync test case. --- .../SchemaRegistryClientTests.java | 27 ++++++++++ ...ientTests.getSchemaByGroupNameVersion.json | 53 +++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryClientTests.getSchemaByGroupNameVersion.json diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/test/java/com/azure/data/schemaregistry/SchemaRegistryClientTests.java b/sdk/schemaregistry/azure-data-schemaregistry/src/test/java/com/azure/data/schemaregistry/SchemaRegistryClientTests.java index 84f3ddc828bdc..2d32584359520 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/test/java/com/azure/data/schemaregistry/SchemaRegistryClientTests.java +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/test/java/com/azure/data/schemaregistry/SchemaRegistryClientTests.java @@ -246,4 +246,31 @@ public void getSchemaIdDoesNotExist() { assertEquals(404, error.getResponse().getStatusCode()); } + + @Test + public void getSchemaByGroupNameVersion() { + // Arrange + final SchemaRegistryClient client1 = builder.buildClient(); + final String schemaName = testResourceNamer.randomName("sch", RESOURCE_LENGTH); + + // Register a schema first. + final SchemaProperties registeredSchema = client1.registerSchema(schemaGroup, schemaName, SCHEMA_CONTENT, + SchemaFormat.AVRO); + + assertNotNull(registeredSchema); + + // Act + final SchemaRegistrySchema actual = client1.getSchema(schemaGroup, schemaName, registeredSchema.getVersion()); + + // Assert + assertNotNull(schemaName); + + final SchemaProperties properties = actual.getProperties(); + assertNotNull(properties); + + assertEquals(registeredSchema.getVersion(), properties.getVersion()); + assertEquals(schemaGroup, registeredSchema.getGroupName()); + assertEquals(schemaName, registeredSchema.getName()); + assertEquals(registeredSchema.getId(), registeredSchema.getId()); + } } diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryClientTests.getSchemaByGroupNameVersion.json b/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryClientTests.getSchemaByGroupNameVersion.json new file mode 100644 index 0000000000000..263cf25845914 --- /dev/null +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/test/resources/session-records/SchemaRegistryClientTests.getSchemaByGroupNameVersion.json @@ -0,0 +1,53 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/mygroup/schemas/sch55155bad7?api-version=2021-10", + "Headers" : { + "User-Agent" : "azsdk-java-azure-data-schemaregistry/1.3.0-beta.1 (11.0.5; Windows 10; 10.0)", + "x-ms-client-request-id" : "86a13e8e-095c-4e47-b126-3ed3e438223f", + "Content-Type" : "application/json; serialization=Avro" + }, + "Response" : { + "content-length" : "0", + "Schema-Version" : "1", + "Server" : "Microsoft-HTTPAPI/2.0", + "Schema-Name" : "sch55155bad7", + "retry-after" : "0", + "Schema-Id-Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/$schemas/dc0c992aa2a742c38487671446b3a973?api-version=2021-10", + "StatusCode" : "204", + "Date" : "Tue, 27 Sep 2022 07:33:53 GMT", + "Strict-Transport-Security" : "max-age=31536000", + "Schema-Id" : "dc0c992aa2a742c38487671446b3a973", + "Schema-Group-Name" : "mygroup", + "Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/mygroup/schemas/sch55155bad7/versions/1?api-version=2021-10", + "Schema-Versions-Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/mygroup/schemas/sch55155bad7/versions?api-version=2021-10" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.servicebus.windows.net/$schemaGroups/mygroup/schemas/sch55155bad7/versions/1?api-version=2021-10", + "Headers" : { + "User-Agent" : "azsdk-java-azure-data-schemaregistry/1.3.0-beta.1 (11.0.5; Windows 10; 10.0)", + "x-ms-client-request-id" : "7ef4e984-4e89-4253-9dcc-8827908af106" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Schema-Version" : "1", + "Server" : "Microsoft-HTTPAPI/2.0", + "Schema-Name" : "sch55155bad7", + "retry-after" : "0", + "Schema-Id-Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/$schemas/dc0c992aa2a742c38487671446b3a973?api-version=2021-10", + "StatusCode" : "200", + "Date" : "Tue, 27 Sep 2022 07:33:53 GMT", + "Strict-Transport-Security" : "max-age=31536000", + "Schema-Id" : "dc0c992aa2a742c38487671446b3a973", + "Schema-Group-Name" : "mygroup", + "Body" : "{\"type\":\"record\",\"namespace\":\"TestSchema\",\"name\":\"Employee\",\"fields\":[{\"name\":\"Name\",\"type\":\"string\"},{\"name\":\"Age\",\"type\":\"int\"}]}", + "Content-Type" : "application/json;serialization=Avro", + "Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/mygroup/schemas/sch55155bad7/versions/1?api-version=2021-10", + "Schema-Versions-Location" : "https://conniey.servicebus.windows.net:443/$schemagroups/mygroup/schemas/sch55155bad7/versions?api-version=2021-10" + }, + "Exception" : null + } ], + "variables" : [ "sch55155bad7" ] +} From 59bcc8d641450f80920bf1a6a9147a2e67bfa796 Mon Sep 17 00:00:00 2001 From: Connie Date: Tue, 27 Sep 2022 00:37:43 -0700 Subject: [PATCH 14/16] Adding CHANGELOG entry. --- sdk/schemaregistry/azure-data-schemaregistry/CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sdk/schemaregistry/azure-data-schemaregistry/CHANGELOG.md b/sdk/schemaregistry/azure-data-schemaregistry/CHANGELOG.md index 618d77af01930..f340637ff4226 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/CHANGELOG.md +++ b/sdk/schemaregistry/azure-data-schemaregistry/CHANGELOG.md @@ -4,6 +4,14 @@ ### Features Added +- Added `getVersion` to `SchemaProperties`. +- Added the following methods in `SchemaRegistryAsyncClient`: + - `Mono getSchema(String groupName, String schemaName, int schemaVersion)` + - `Mono> getSchemaWithResponse(String groupName, String schemaName, int schemaVersion)` +- Added the following methods in `SchemaRegistryClient`: + - `SchemaRegistrySchema getSchema(String groupName, String schemaName, int schemaVersion)` + - `Response getSchemaWithResponse(String groupName, String schemaName, int schemaVersion, Context context)` + ### Breaking Changes ### Bugs Fixed From a9d94610b205659ce77a4ef8ae870252e54f92e4 Mon Sep 17 00:00:00 2001 From: Connie Date: Tue, 27 Sep 2022 02:31:04 -0700 Subject: [PATCH 15/16] REmove unused imports --- .../com/azure/data/schemaregistry/SchemaRegistryClient.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/SchemaRegistryClient.java b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/SchemaRegistryClient.java index abf02b30283d9..ab51b5e836122 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/SchemaRegistryClient.java +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/SchemaRegistryClient.java @@ -10,11 +10,9 @@ import com.azure.core.exception.ResourceNotFoundException; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; import com.azure.data.schemaregistry.models.SchemaFormat; import com.azure.data.schemaregistry.models.SchemaProperties; import com.azure.data.schemaregistry.models.SchemaRegistrySchema; -import reactor.core.publisher.Mono; import java.io.UncheckedIOException; From 91d8a138cf68a6d2126aee87d4733f0397f26e00 Mon Sep 17 00:00:00 2001 From: Connie Date: Thu, 29 Sep 2022 12:16:50 -0700 Subject: [PATCH 16/16] Fixing return documentation. --- .../data/schemaregistry/SchemaRegistryAsyncClient.java | 8 ++++---- .../azure/data/schemaregistry/SchemaRegistryClient.java | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/SchemaRegistryAsyncClient.java b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/SchemaRegistryAsyncClient.java index 611a6f5a0737a..61dd48fb48fad 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/SchemaRegistryAsyncClient.java +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/SchemaRegistryAsyncClient.java @@ -183,7 +183,7 @@ Mono> registerSchemaWithResponse(String groupName, St * * @param schemaId The unique identifier of the schema. * - * @return The {@link SchemaProperties} associated with the given {@code schemaId}. + * @return The {@link SchemaRegistrySchema} associated with the given {@code schemaId}. * * @throws NullPointerException if {@code schemaId} is null. * @throws ResourceNotFoundException if a schema with the matching {@code schemaId} could not be found. @@ -202,7 +202,7 @@ public Mono getSchema(String schemaId) { * @param schemaName Name of the schema * @param schemaVersion Version of schema * - * @return The {@link SchemaProperties} matching the parameters. + * @return The {@link SchemaRegistrySchema} matching the parameters. * * @throws NullPointerException if {@code groupName} or {@code schemaName} is null. * @throws ResourceNotFoundException if a schema with the matching {@code groupName} or {@code schemaName} could @@ -220,7 +220,7 @@ public Mono getSchema(String groupName, String schemaName, * * @param schemaId The unique identifier of the schema. * - * @return The {@link SchemaProperties} associated with the given {@code schemaId} along with the HTTP response. + * @return The {@link SchemaRegistrySchema} associated with the given {@code schemaId} along with the HTTP response. * * @throws NullPointerException if {@code schemaId} is null. * @throws ResourceNotFoundException if a schema with the matching {@code schemaId} could not be found. @@ -239,7 +239,7 @@ public Mono> getSchemaWithResponse(String schemaI * @param schemaName Name of the schema * @param schemaVersion Version of schema * - * @return The {@link SchemaProperties} matching the parameters. + * @return The {@link SchemaRegistrySchema} matching the parameters. * * @throws NullPointerException if {@code groupName} or {@code schemaName} is null. * @throws ResourceNotFoundException if a schema with the matching {@code groupName} or {@code schemaName} could diff --git a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/SchemaRegistryClient.java b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/SchemaRegistryClient.java index ab51b5e836122..8fb045ebfdfd5 100644 --- a/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/SchemaRegistryClient.java +++ b/sdk/schemaregistry/azure-data-schemaregistry/src/main/java/com/azure/data/schemaregistry/SchemaRegistryClient.java @@ -131,7 +131,7 @@ public Response registerSchemaWithResponse(String groupName, S * * @param schemaId The unique identifier of the schema. * - * @return The {@link SchemaProperties} associated with the given {@code schemaId}. + * @return The {@link SchemaRegistrySchema} associated with the given {@code schemaId}. * * @throws NullPointerException if {@code schemaId} is null. * @throws ResourceNotFoundException if a schema with the matching {@code schemaId} could not be found. @@ -150,7 +150,7 @@ public SchemaRegistrySchema getSchema(String schemaId) { * @param schemaName Name of the schema * @param schemaVersion Version of schema * - * @return The {@link SchemaProperties} matching the parameters. + * @return The {@link SchemaRegistrySchema} matching the parameters. * * @throws NullPointerException if {@code groupName} or {@code schemaName} is null. * @throws ResourceNotFoundException if a schema with the matching {@code groupName} or {@code schemaName} could @@ -169,7 +169,7 @@ public SchemaRegistrySchema getSchema(String groupName, String schemaName, int s * @param schemaId The unique identifier of the schema. * @param context The context to pass to the Http pipeline. * - * @return The {@link SchemaProperties} associated with the given {@code schemaId} and its HTTP response. + * @return The {@link SchemaRegistrySchema} associated with the given {@code schemaId} and its HTTP response. * * @throws NullPointerException if {@code schemaId} is null. * @throws ResourceNotFoundException if a schema with the matching {@code schemaId} could not be found. @@ -189,7 +189,7 @@ public Response getSchemaWithResponse(String schemaId, Con * @param schemaVersion Version of schema * @param context The context to pass to the Http pipeline. * - * @return The {@link SchemaProperties} matching the parameters. + * @return The {@link SchemaRegistrySchema} matching the parameters. * * @throws NullPointerException if {@code groupName} or {@code schemaName} is null. * @throws ResourceNotFoundException if a schema with the matching {@code groupName} or {@code schemaName} could