Skip to content

Commit

Permalink
tsp, update local test for spread (Azure#2835)
Browse files Browse the repository at this point in the history
  • Loading branch information
weidongxu-microsoft authored Jun 25, 2024
1 parent b151ff3 commit 180c01f
Show file tree
Hide file tree
Showing 22 changed files with 182 additions and 202 deletions.
1 change: 1 addition & 0 deletions typespec-extension/package-lock.json

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

2 changes: 2 additions & 0 deletions typespec-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"peerDependencies": {
"@azure-tools/typespec-azure-core": ">=0.43.0 <1.0.0",
"@azure-tools/typespec-azure-resource-manager": ">=0.43.0 <1.0.0",
"@azure-tools/typespec-autorest": ">=0.43.0 <1.0.0",
"@azure-tools/typespec-azure-rulesets": ">=0.43.0 <1.0.0",
"@azure-tools/typespec-client-generator-core": ">=0.43.0 <1.0.0",
"@typespec/compiler": ">=0.57.0 <1.0.0",
Expand All @@ -63,6 +64,7 @@
"devDependencies": {
"@azure-tools/typespec-azure-core": "0.43.0",
"@azure-tools/typespec-azure-resource-manager": "0.43.0",
"@azure-tools/typespec-autorest": "0.43.0",
"@azure-tools/typespec-azure-rulesets": "0.43.0",
"@azure-tools/typespec-client-generator-core": "0.43.0",
"@types/js-yaml": "~4.0.9",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public final class InternalAsyncClient {
* }
* }</pre>
*
* @param apiRequest The apiRequest parameter.
* @param body The body parameter.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
Expand All @@ -72,8 +72,8 @@ public final class InternalAsyncClient {
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Response<BinaryData>> postInternalWithResponse(BinaryData apiRequest, RequestOptions requestOptions) {
return this.serviceClient.postInternalWithResponseAsync(apiRequest, requestOptions);
Mono<Response<BinaryData>> postInternalWithResponse(BinaryData body, RequestOptions requestOptions) {
return this.serviceClient.postInternalWithResponseAsync(body, requestOptions);
}

/**
Expand Down Expand Up @@ -126,7 +126,7 @@ Mono<Response<Void>> postProtocalInternalWithResponse(BinaryData body, RequestOp
/**
* The postInternal operation.
*
* @param apiRequest The apiRequest parameter.
* @param body The body parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
Expand All @@ -137,10 +137,10 @@ Mono<Response<Void>> postProtocalInternalWithResponse(BinaryData body, RequestOp
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<ResponseInternal> postInternal(ApiRequest apiRequest) {
Mono<ResponseInternal> postInternal(ApiRequest body) {
// Generated convenience method for postInternalWithResponse
RequestOptions requestOptions = new RequestOptions();
return postInternalWithResponse(BinaryData.fromObject(apiRequest), requestOptions).flatMap(FluxUtil::toMono)
return postInternalWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono)
.map(protocolMethodData -> protocolMethodData.toObject(ResponseInternal.class));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public final class InternalClient {
* }
* }</pre>
*
* @param apiRequest The apiRequest parameter.
* @param body The body parameter.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
Expand All @@ -70,8 +70,8 @@ public final class InternalClient {
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
Response<BinaryData> postInternalWithResponse(BinaryData apiRequest, RequestOptions requestOptions) {
return this.serviceClient.postInternalWithResponse(apiRequest, requestOptions);
Response<BinaryData> postInternalWithResponse(BinaryData body, RequestOptions requestOptions) {
return this.serviceClient.postInternalWithResponse(body, requestOptions);
}

/**
Expand Down Expand Up @@ -124,7 +124,7 @@ Response<Void> postProtocalInternalWithResponse(BinaryData body, RequestOptions
/**
* The postInternal operation.
*
* @param apiRequest The apiRequest parameter.
* @param body The body parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
Expand All @@ -135,10 +135,10 @@ Response<Void> postProtocalInternalWithResponse(BinaryData body, RequestOptions
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
ResponseInternal postInternal(ApiRequest apiRequest) {
ResponseInternal postInternal(ApiRequest body) {
// Generated convenience method for postInternalWithResponse
RequestOptions requestOptions = new RequestOptions();
return postInternalWithResponse(BinaryData.fromObject(apiRequest), requestOptions).getValue()
return postInternalWithResponse(BinaryData.fromObject(body), requestOptions).getValue()
.toObject(ResponseInternal.class);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public interface InternalOpsService {
@UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
@UnexpectedResponseExceptionType(HttpResponseException.class)
Mono<Response<BinaryData>> postInternal(@HostParam("endpoint") String endpoint,
@HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData apiRequest,
@HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData body,
RequestOptions requestOptions, Context context);

@Post("/internal")
Expand All @@ -76,7 +76,7 @@ Mono<Response<BinaryData>> postInternal(@HostParam("endpoint") String endpoint,
@UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
@UnexpectedResponseExceptionType(HttpResponseException.class)
Response<BinaryData> postInternalSync(@HostParam("endpoint") String endpoint,
@HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData apiRequest,
@HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData body,
RequestOptions requestOptions, Context context);

@Get("/internal")
Expand Down Expand Up @@ -140,7 +140,7 @@ Response<Void> postProtocalInternalSync(@HostParam("endpoint") String endpoint,
* }
* }</pre>
*
* @param apiRequest The apiRequest parameter.
* @param body The body parameter.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
Expand All @@ -149,11 +149,10 @@ Response<Void> postProtocalInternalSync(@HostParam("endpoint") String endpoint,
* @return the response body along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<BinaryData>> postInternalWithResponseAsync(BinaryData apiRequest,
RequestOptions requestOptions) {
public Mono<Response<BinaryData>> postInternalWithResponseAsync(BinaryData body, RequestOptions requestOptions) {
final String accept = "application/json";
return FluxUtil.withContext(
context -> service.postInternal(this.client.getEndpoint(), accept, apiRequest, requestOptions, context));
context -> service.postInternal(this.client.getEndpoint(), accept, body, requestOptions, context));
}

/**
Expand All @@ -178,7 +177,7 @@ public Mono<Response<BinaryData>> postInternalWithResponseAsync(BinaryData apiRe
* }
* }</pre>
*
* @param apiRequest The apiRequest parameter.
* @param body The body parameter.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
Expand All @@ -187,9 +186,9 @@ public Mono<Response<BinaryData>> postInternalWithResponseAsync(BinaryData apiRe
* @return the response body along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<BinaryData> postInternalWithResponse(BinaryData apiRequest, RequestOptions requestOptions) {
public Response<BinaryData> postInternalWithResponse(BinaryData body, RequestOptions requestOptions) {
final String accept = "application/json";
return service.postInternalSync(this.client.getEndpoint(), accept, apiRequest, requestOptions, Context.NONE);
return service.postInternalSync(this.client.getEndpoint(), accept, body, requestOptions, Context.NONE);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public final class LiteralServiceAsyncClient {
* }
* }</pre>
*
* @param model The model parameter.
* @param body The body parameter.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
Expand All @@ -77,14 +77,14 @@ public final class LiteralServiceAsyncClient {
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<BinaryData>> putWithResponse(BinaryData model, RequestOptions requestOptions) {
return this.serviceClient.putWithResponseAsync(model, requestOptions);
public Mono<Response<BinaryData>> putWithResponse(BinaryData body, RequestOptions requestOptions) {
return this.serviceClient.putWithResponseAsync(body, requestOptions);
}

/**
* The put operation.
*
* @param model The model parameter.
* @param body The body parameter.
* @param optionalLiteralParam The optionalLiteralParam parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws HttpResponseException thrown if the request is rejected by server.
Expand All @@ -96,20 +96,20 @@ public Mono<Response<BinaryData>> putWithResponse(BinaryData model, RequestOptio
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Model> put(Model model, PutRequestOptionalLiteralParam optionalLiteralParam) {
public Mono<Model> put(Model body, PutRequestOptionalLiteralParam optionalLiteralParam) {
// Generated convenience method for putWithResponse
RequestOptions requestOptions = new RequestOptions();
if (optionalLiteralParam != null) {
requestOptions.addQueryParam("optionalLiteralParam", optionalLiteralParam.toString(), false);
}
return putWithResponse(BinaryData.fromObject(model), requestOptions).flatMap(FluxUtil::toMono)
return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono)
.map(protocolMethodData -> protocolMethodData.toObject(Model.class));
}

/**
* The put operation.
*
* @param model The model parameter.
* @param body The body parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
Expand All @@ -120,10 +120,10 @@ public Mono<Model> put(Model model, PutRequestOptionalLiteralParam optionalLiter
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Model> put(Model model) {
public Mono<Model> put(Model body) {
// Generated convenience method for putWithResponse
RequestOptions requestOptions = new RequestOptions();
return putWithResponse(BinaryData.fromObject(model), requestOptions).flatMap(FluxUtil::toMono)
return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono)
.map(protocolMethodData -> protocolMethodData.toObject(Model.class));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public final class LiteralServiceClient {
* }
* }</pre>
*
* @param model The model parameter.
* @param body The body parameter.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
Expand All @@ -75,14 +75,14 @@ public final class LiteralServiceClient {
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<BinaryData> putWithResponse(BinaryData model, RequestOptions requestOptions) {
return this.serviceClient.putWithResponse(model, requestOptions);
public Response<BinaryData> putWithResponse(BinaryData body, RequestOptions requestOptions) {
return this.serviceClient.putWithResponse(body, requestOptions);
}

/**
* The put operation.
*
* @param model The model parameter.
* @param body The body parameter.
* @param optionalLiteralParam The optionalLiteralParam parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws HttpResponseException thrown if the request is rejected by server.
Expand All @@ -94,19 +94,19 @@ public Response<BinaryData> putWithResponse(BinaryData model, RequestOptions req
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
public Model put(Model model, PutRequestOptionalLiteralParam optionalLiteralParam) {
public Model put(Model body, PutRequestOptionalLiteralParam optionalLiteralParam) {
// Generated convenience method for putWithResponse
RequestOptions requestOptions = new RequestOptions();
if (optionalLiteralParam != null) {
requestOptions.addQueryParam("optionalLiteralParam", optionalLiteralParam.toString(), false);
}
return putWithResponse(BinaryData.fromObject(model), requestOptions).getValue().toObject(Model.class);
return putWithResponse(BinaryData.fromObject(body), requestOptions).getValue().toObject(Model.class);
}

/**
* The put operation.
*
* @param model The model parameter.
* @param body The body parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
Expand All @@ -117,9 +117,9 @@ public Model put(Model model, PutRequestOptionalLiteralParam optionalLiteralPara
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
public Model put(Model model) {
public Model put(Model body) {
// Generated convenience method for putWithResponse
RequestOptions requestOptions = new RequestOptions();
return putWithResponse(BinaryData.fromObject(model), requestOptions).getValue().toObject(Model.class);
return putWithResponse(BinaryData.fromObject(body), requestOptions).getValue().toObject(Model.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public interface LiteralOpsService {
@UnexpectedResponseExceptionType(HttpResponseException.class)
Mono<Response<BinaryData>> put(@HostParam("endpoint") String endpoint,
@QueryParam("literalParam") String literalParam, @HeaderParam("accept") String accept,
@BodyParam("application/json") BinaryData model, RequestOptions requestOptions, Context context);
@BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context);

@Put("/literal/put")
@ExpectedResponses({ 200 })
Expand All @@ -77,7 +77,7 @@ Mono<Response<BinaryData>> put(@HostParam("endpoint") String endpoint,
@UnexpectedResponseExceptionType(HttpResponseException.class)
Response<BinaryData> putSync(@HostParam("endpoint") String endpoint,
@QueryParam("literalParam") String literalParam, @HeaderParam("accept") String accept,
@BodyParam("application/json") BinaryData model, RequestOptions requestOptions, Context context);
@BodyParam("application/json") BinaryData body, RequestOptions requestOptions, Context context);
}

/**
Expand Down Expand Up @@ -108,7 +108,7 @@ Response<BinaryData> putSync(@HostParam("endpoint") String endpoint,
* }
* }</pre>
*
* @param model The model parameter.
* @param body The body parameter.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
Expand All @@ -117,11 +117,11 @@ Response<BinaryData> putSync(@HostParam("endpoint") String endpoint,
* @return the response body along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<BinaryData>> putWithResponseAsync(BinaryData model, RequestOptions requestOptions) {
public Mono<Response<BinaryData>> putWithResponseAsync(BinaryData body, RequestOptions requestOptions) {
final String literalParam = "literalParam";
final String accept = "application/json";
return FluxUtil.withContext(
context -> service.put(this.client.getEndpoint(), literalParam, accept, model, requestOptions, context));
context -> service.put(this.client.getEndpoint(), literalParam, accept, body, requestOptions, context));
}

/**
Expand Down Expand Up @@ -152,7 +152,7 @@ public Mono<Response<BinaryData>> putWithResponseAsync(BinaryData model, Request
* }
* }</pre>
*
* @param model The model parameter.
* @param body The body parameter.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
Expand All @@ -161,9 +161,9 @@ public Mono<Response<BinaryData>> putWithResponseAsync(BinaryData model, Request
* @return the response body along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<BinaryData> putWithResponse(BinaryData model, RequestOptions requestOptions) {
public Response<BinaryData> putWithResponse(BinaryData body, RequestOptions requestOptions) {
final String literalParam = "literalParam";
final String accept = "application/json";
return service.putSync(this.client.getEndpoint(), literalParam, accept, model, requestOptions, Context.NONE);
return service.putSync(this.client.getEndpoint(), literalParam, accept, body, requestOptions, Context.NONE);
}
}
Loading

0 comments on commit 180c01f

Please sign in to comment.