Open weidongxu-microsoft opened 1 year ago
Also when use template / traits, service may not able to write the model ApiOptions
in the first place.
op list 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...
GetFileFromBatchNode is RpcOperation<
GetFileFromBatchNodeOptions,
BatchResponseHeaders &
FileResponse & {
@body
@doc("A response containing the file content.")
file: bytes;
},
{},
BatchError
>;
op RpcOperation<
TParams extends TypeSpec.Reflection.Model,
TResponse extends TypeSpec.Reflection.Model,
Traits extends TypeSpec.Reflection.Model = {},
TErrorResponse = Azure.Core.Foundations.ErrorResponse,
TraitContexts extends TraitContext = 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>
.
Source MVAD apiview java: https://apiview.dev/Assemblies/Conversation/66bfc5cd130a4eb4a4e05b9d192c7e2b#3b0999fbf4bb4752af7fb60c958b129e apiview .net: https://apiview.dev/Assemblies/Conversation/0eacd79245e14c6fa88d5991aac2e02f#51d7c0923d6a41cbbe89658a521cca38
E.g. If tsp define (model or alias) as a group
And Java API be
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 modelApiOptions
.