Skip to content

Commit 686bc3c

Browse files
iscai-msftiscai-msft
and
iscai-msft
authoredMar 26, 2025··
[docs] add docs for parameterized next link (#2446)
fixes #2445 --------- Co-authored-by: iscai-msft <isabellavcai@gmail.com>
1 parent bc55ca2 commit 686bc3c

File tree

4 files changed

+65
-0
lines changed

4 files changed

+65
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
changeKind: internal
3+
packages:
4+
- "@azure-tools/typespec-azure-core"
5+
---
6+
7+
Add more documentation for parameterized next links

‎packages/typespec-azure-core/lib/legacy.tsp

+14
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@ namespace Azure.Core.Legacy;
44

55
/**
66
* A scalar type representing a next link that requires formatting with parameters to be used.
7+
*
8+
* @example
9+
* ```typespec
10+
* model ListCertificateOptions {
11+
* includePending?: string;
12+
* }
13+
* model Certificate {
14+
* name: string;
15+
* }
16+
* model Page {
17+
* @items items: Certificate[];
18+
* @nextLink nextLink: Azure.Core.Legacy.parameterizedNextLink<[ListCertificateOptions.includePending]>;
19+
* }
20+
* ```
721
*/
822
@Azure.Core.Foundations.Private.parameterizedNextLinkConfig(TypeSpec.Reflection.ModelProperty[])
923
scalar parameterizedNextLink<ParameterizedParams extends TypeSpec.Reflection.ModelProperty[]>

‎website/src/content/docs/docs/howtos/Generate client libraries/13pagingOperations.mdx

+27
Original file line numberDiff line numberDiff line change
@@ -287,3 +287,30 @@ NOT_SUPPORTED
287287
```
288288

289289
</ClientTabs>
290+
291+
## Advanced
292+
293+
### Parameterized next links (against guidelines)
294+
295+
:::danger
296+
Parameterized next links are against guidelines. Please don't follow this unless explicitly told to do so
297+
:::
298+
299+
In very rare cases, there are cases of next links that require parameterization. These cases exist outside of the Azure guidelines for paging, but must be supported for legacy reasons.
300+
301+
In cases like this, you may use the special scalar type `Azure.Core.Legacy.parameterizedNextLink`. You can specify which parameters must be reformatted into the next link. Your emitted SDK will handle the reformatting based on the tsp definition
302+
303+
```tsp
304+
model ListCertificateOptions {
305+
includePending?: string;
306+
}
307+
model Certificate {
308+
name: string;
309+
}
310+
model Page {
311+
@items items: Certificate[];
312+
@nextLink nextLink: Azure.Core.Legacy.parameterizedNextLink<[
313+
ListCertificateOptions.includePending
314+
]>;
315+
}
316+
```

‎website/src/content/docs/docs/libraries/azure-core/reference/data-types.md

+17
Original file line numberDiff line numberDiff line change
@@ -1032,6 +1032,23 @@ A scalar type representing a next link that requires formatting with parameters
10321032
scalar Azure.Core.Legacy.parameterizedNextLink
10331033
```
10341034

1035+
#### Examples
1036+
1037+
```typespec
1038+
model ListCertificateOptions {
1039+
includePending?: string;
1040+
}
1041+
model Certificate {
1042+
name: string;
1043+
}
1044+
model Page {
1045+
@items items: Certificate[];
1046+
@nextLink nextLink: Azure.Core.Legacy.parameterizedNextLink<[
1047+
ListCertificateOptions.includePending
1048+
]>;
1049+
}
1050+
```
1051+
10351052
## Azure.Core.Traits
10361053

10371054
### `ListQueryParametersTrait` {#Azure.Core.Traits.ListQueryParametersTrait}

0 commit comments

Comments
 (0)
Please sign in to comment.