Skip to content

collection-response-only-value-and-next-link

Id
@azure-tools/typespec-azure-resource-manager/collection-response-only-value-and-next-link

ARM collection GET response models must declare only the value and nextLink properties.

ARM collection GET responses must use a predictable envelope containing exactly value and nextLink. Additional top-level properties or a missing envelope property make generated clients and pagination tooling handle list operations inconsistently.

  • Area: API

Collection response envelopes with other shapes violate the ARM RPC contract and can produce inconsistent generated client pagination behavior.

model WidgetListResult {
value: Widget[];
nextLink?: string;
totalCount?: int32;
}
@route("/subscriptions/{subscriptionId}/providers/Contoso.Widgets/widgets")
@get
op listWidgets(@path subscriptionId: string): WidgetListResult;
model WidgetListResult {
value: Widget[];
nextLink?: string;
}
@route("/subscriptions/{subscriptionId}/providers/Contoso.Widgets/widgets")
@get
op listWidgets(@path subscriptionId: string): WidgetListResult;

This rule corresponds to the Swagger validator rule GetCollectionOnlyHasValueAndNextLink.

Suppress this rule only when compatibility requirements prevent the response envelope from containing exactly value and nextLink.