You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 6, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Jul 6, 2026. It is now read-only.
tsp, support grouping of path+query+header+body properties in model, reflect it in convenience API signature #2088
Model ApiOptions {
@path id: string;
@query format: string;
name: string;
data: bytes;
}
op post(options: ApiOptions): OkResponse;
And Java API be
void postWithResponse(String id, String format, BinaryData options);
void post(ApiOptions options);
Enhanced case would involve multiple groups, e.g. post(Option1, Option2, Option3).
Before we get to TOM, wondering whether we'd like to support a @optionBag(name = "ApiOptions") decorator in TCGC, for the simple case that all path/query/header parameters and all body properties would be grouped to a model ApiOptions.
oplist is ResourceOperations.ResourceList<User,ListQueryParametersTrait<global.Azure.Core.StandardListQueryParameters&global.Azure.Core.OrderByQueryParameter&global.Azure.Core.FilterQueryParameter&global.Azure.Core.SelectQueryParameter&global.Azure.Core.ExpandQueryParameter>>;
And even simple template could get things complicated...
GetFileFromBatchNodeisRpcOperation<GetFileFromBatchNodeOptions,BatchResponseHeaders&FileResponse&{
@body
@doc("A response containing the file content.")file: bytes;},{},BatchError>;opRpcOperation<TParamsextendsTypeSpec.Reflection.Model,TResponseextendsTypeSpec.Reflection.Model,TraitsextendsTypeSpec.Reflection.Model={},TErrorResponse=Azure.Core.Foundations.ErrorResponse,TraitContextsextendsTraitContext=TraitContext.Undefined> is Foundations.Operation<TParams&TraitProperties<Traits,TraitLocation.Parameters>,TResponse&TraitProperties<Traits,TraitLocation.Response,TraitContexts>,Traits,TErrorResponse>;
Even I use GetFileFromBatchNodeOptions here, RpcOperation adds Traits, and then in Foundations.Operation would again add VersionParameterTrait<ApiVersionParameter>.
Activity
weidongxu-microsoft commentedon May 15, 2023
PoC #2140
weidongxu-microsoft commentedon Aug 18, 2023
Also when use template / traits, service may not able to write the
model ApiOptionsin the first place.e.g.
https://github.com/Azure/cadl-ranch/blob/53d3826/packages/cadl-ranch-specs/http/azure/core/basic/main.tsp#L175-L182
weidongxu-microsoft commentedon Aug 28, 2023
And even simple template could get things complicated...
Even I use
GetFileFromBatchNodeOptionshere,RpcOperationadds Traits, and then inFoundations.Operationwould again addVersionParameterTrait<ApiVersionParameter>.weidongxu-microsoft commentedon Aug 31, 2023
Azure/typespec-azure#2724
weidongxu-microsoft commentedon May 27, 2024
Azure/typespec-azure#831
haolingdong-msft commentedon Nov 27, 2025
discussed in shanghai team's sync up, close it as it is duplicate issue of #2984