Azure / Azure/typespec-azure

Allow Legacy.markAsPageable to specify the page item property

Open
#4,729 1 comment 0 reactions 1 assignee Claimed by @ArcturusZhang View on GitHub
lib:tcgc
Dominant language
TypeScript
Stars
27
Forks
90
Avg merge
1d 22h
Merged PRs (30d)
156

Description

### Clear and concise description of the problem

`Legacy.markAsPageable` currently infers the page item property only from `@pageItems` or from a property named `value`.

This does not work for response models whose array property uses a different name, such as `items`, `keys`, `results`, or another service-specific property name.

In SDK migration scenarios, `@@pageItems(...)` is sometimes not suitable because it applies to the shared TypeSpec model and cannot be scoped to a specific emitter/language. In those cases, `@@markAsPageable(...)` would be the natural language-scoped customization point, but it cannot currently specify which array property should be used as the page items.

It would be useful for `markAsPageable` to accept an additional parameter or options object to specify the page item property, for example by property name or by model property reference.

### Checklist

- [x] Follow our [Code of Conduct](https://github.com/azure/typespec-azure/blob/main/CODE_OF_CONDUCT.md)
- [x] Check that this issue is about the Azure libraries for typespec. For feature request in the typespec language or core libraries file it in the [TypeSpec repo](https://github.com/Microsoft/TypeSpec/issues/new/choose)
- [x] Read the [docs](https://azure.github.io/typespec-azure/).
- [x] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.