Skip to content
This repository was archived by the owner on Jul 6, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Generate.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ $job = @(
"$VANILLA_ARGUMENTS --input-file=vanilla-tests/swagger/xml-tag-with-attribute-and-value.json --namespace=fixtures.complexstreamstylexmlserialization --stream-style-serialization",
"$VANILLA_ARGUMENTS --input-file=vanilla-tests/swagger/security-info.json --namespace=fixtures.securityinfo --use-key-credential",
"$VANILLA_ARGUMENTS --input-file=vanilla-tests/swagger/special-header.json --namespace=fixtures.specialheader",
"$VANILLA_ARGUMENTS --input-file=vanilla-tests/swagger/required-fields-as-ctor-args-transformation.json --namespace=fixtures.requiredfieldsascotrargstransformation --required-fields-as-ctor-args=true --output-model-immutable --null-byte-array-maps-to-empty-array"
"$VANILLA_ARGUMENTS --input-file=vanilla-tests/swagger/required-fields-as-ctor-args-transformation.json --namespace=fixtures.requiredfieldsascotrargstransformation --required-fields-as-ctor-args=true --output-model-immutable --null-byte-array-maps-to-empty-array",
"$VANILLA_ARGUMENTS --input-file=vanilla-tests/swagger/discriminator-enum.json --namespace=fixtures.discriminatorenum"
) | ForEach-Object -Parallel $generateScript -ThrottleLimit $Parallelization -AsJob

$job | Wait-Job -Timeout 120
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package fixtures.discriminatorenum;

import com.azure.core.annotation.ExpectedResponses;
import com.azure.core.annotation.Get;
import com.azure.core.annotation.HeaderParam;
import com.azure.core.annotation.Host;
import com.azure.core.annotation.HostParam;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceInterface;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.annotation.UnexpectedResponseExceptionType;
import com.azure.core.exception.HttpResponseException;
import com.azure.core.http.HttpPipeline;
import com.azure.core.http.HttpPipelineBuilder;
import com.azure.core.http.policy.RetryPolicy;
import com.azure.core.http.policy.UserAgentPolicy;
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.RestProxy;
import com.azure.core.util.Context;
import com.azure.core.util.FluxUtil;
import com.azure.core.util.serializer.JacksonAdapter;
import com.azure.core.util.serializer.SerializerAdapter;
import fixtures.discriminatorenum.models.Dog;
import reactor.core.publisher.Mono;

/**
* Initializes a new instance of the EnumDiscriminator type.
*/
public final class EnumDiscriminator {
/**
* The proxy service used to perform REST calls.
*/
private final EnumDiscriminatorService service;

/**
* server parameter.
*/
private final String host;

/**
* Gets server parameter.
*
* @return the host value.
*/
public String getHost() {
return this.host;
}

/**
* The HTTP pipeline to send requests through.
*/
private final HttpPipeline httpPipeline;

/**
* Gets The HTTP pipeline to send requests through.
*
* @return the httpPipeline value.
*/
public HttpPipeline getHttpPipeline() {
return this.httpPipeline;
}

/**
* The serializer to serialize an object into a string.
*/
private final SerializerAdapter serializerAdapter;

/**
* Gets The serializer to serialize an object into a string.
*
* @return the serializerAdapter value.
*/
public SerializerAdapter getSerializerAdapter() {
return this.serializerAdapter;
}

/**
* Initializes an instance of EnumDiscriminator client.
*
* @param host server parameter.
*/
EnumDiscriminator(String host) {
this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(),
JacksonAdapter.createDefaultSerializerAdapter(), host);
}

/**
* Initializes an instance of EnumDiscriminator client.
*
* @param httpPipeline The HTTP pipeline to send requests through.
* @param host server parameter.
*/
EnumDiscriminator(HttpPipeline httpPipeline, String host) {
this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), host);
}

/**
* Initializes an instance of EnumDiscriminator client.
*
* @param httpPipeline The HTTP pipeline to send requests through.
* @param serializerAdapter The serializer to serialize an object into a string.
* @param host server parameter.
*/
EnumDiscriminator(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String host) {
this.httpPipeline = httpPipeline;
this.serializerAdapter = serializerAdapter;
this.host = host;
this.service = RestProxy.create(EnumDiscriminatorService.class, this.httpPipeline, this.getSerializerAdapter());
}

/**
* The interface defining all the services for EnumDiscriminator to be used by the proxy service to perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "EnumDiscriminator")
public interface EnumDiscriminatorService {
@Get("/extensible-enum")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(HttpResponseException.class)
Mono<Response<Dog>> getExtensibleModel(@HostParam("$host") String host, @HeaderParam("Accept") String accept,
Context context);
}

/**
* The getExtensibleModel operation.
*
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return test extensible enum type for discriminator along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Dog>> getExtensibleModelWithResponseAsync() {
if (this.getHost() == null) {
return Mono.error(new IllegalArgumentException("Parameter this.getHost() is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil.withContext(context -> service.getExtensibleModel(this.getHost(), accept, context));
}

/**
* The getExtensibleModel operation.
*
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return test extensible enum type for discriminator along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Dog>> getExtensibleModelWithResponseAsync(Context context) {
if (this.getHost() == null) {
return Mono.error(new IllegalArgumentException("Parameter this.getHost() is required and cannot be null."));
}
final String accept = "application/json";
return service.getExtensibleModel(this.getHost(), accept, context);
}

/**
* The getExtensibleModel operation.
*
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return test extensible enum type for discriminator on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Dog> getExtensibleModelAsync() {
return getExtensibleModelWithResponseAsync().flatMap(res -> Mono.justOrEmpty(res.getValue()));
}

/**
* The getExtensibleModel operation.
*
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return test extensible enum type for discriminator on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Dog> getExtensibleModelAsync(Context context) {
return getExtensibleModelWithResponseAsync(context).flatMap(res -> Mono.justOrEmpty(res.getValue()));
}

/**
* The getExtensibleModel operation.
*
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return test extensible enum type for discriminator along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<Dog> getExtensibleModelWithResponse(Context context) {
return getExtensibleModelWithResponseAsync(context).block();
}

/**
* The getExtensibleModel operation.
*
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return test extensible enum type for discriminator.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Dog getExtensibleModel() {
return getExtensibleModelWithResponse(Context.NONE).getValue();
}
}
Loading