Document standard $top/$skip parameters for ARM subscription list operations#4601
Document standard $top/$skip parameters for ARM subscription list operations#4601Copilot wants to merge 2 commits into
$top/$skip parameters for ARM subscription list operations#4601Conversation
Co-authored-by: haolingdong-msft <87355844+haolingdong-msft@users.noreply.github.com>
$top/$skip parameters for ARM subscription list operations
| } | ||
| ``` | ||
|
|
||
| If you prefer the Azure Core reusable model, you can also pass `Azure.Core.StandardListQueryParameters`: |
There was a problem hiding this comment.
These don't actually inject the $top and $skip` names, so it's preferred these are not used for ARM.
There was a problem hiding this comment.
Thanks Mark for the comment.I saw the code of Azure.Core.StandardListQueryParameters has $top and $skip parameters. https://github.com/Azure/typespec-azure/blob/main/packages/typespec-azure-core/lib/models.tsp#L120-L124
Do I misunderstand anything?
@doc("Provides the most common query parameters for list operations.")
model StandardListQueryParameters {
...TopQueryParameter;
...SkipQueryParameter;
...MaxPageSizeQueryParameter;
}
There was a problem hiding this comment.
I also noticed there are a few other standard query parameters already defined in the code. Do you have any thoughts on how we should guide users to use them?
https://github.com/Azure/typespec-azure/blob/main/packages/typespec-azure-core/lib/models.tsp#L93-L117
I’m wondering if we should include all of the standard query parameters, or maybe just highlight the most common ones. Curious what you think here.
| Employee, | ||
| Parameters = Azure.Core.StandardListQueryParameters | ||
| >; | ||
| } |
There was a problem hiding this comment.
Note that there is also a standard $filter parameter we should mention: https://azure.github.io/typespec-azure/docs/libraries/azure-resource-manager/reference/data-types/#Azure.ResourceManager.ArmFilterParameter
ARM docs described the reusable pagination parameter models, but did not show how to apply them to
ArmListBySubscriptionvia theParameterstemplate argument. This left a common authoring path undocumented and encouraged hand-rolled query models.What changed
Parametersinstead of defining raw@query("$top")/@query("$skip")properties.Documented parameter options
ArmTopParameter & ArmSkipParameterAzure.Core.StandardListQueryParametersExample