@typespec/http-specs 0.1.0-alpha.35-dev.3 → 0.1.0-alpha.35-dev.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/specs/payload/pageable/mockapi.js +27 -0
- package/dist/specs/payload/pageable/mockapi.js.map +1 -1
- package/dist/specs/payload/xml/mockapi.d.ts +16 -5
- package/dist/specs/payload/xml/mockapi.d.ts.map +1 -1
- package/dist/specs/payload/xml/mockapi.js +238 -56
- package/dist/specs/payload/xml/mockapi.js.map +1 -1
- package/manifest.json +424 -79
- package/package.json +1 -1
- package/spec-summary.md +392 -0
- package/specs/payload/pageable/main.tsp +47 -0
- package/specs/payload/pageable/mockapi.ts +28 -0
- package/specs/payload/xml/main.tsp +490 -179
- package/specs/payload/xml/mockapi.ts +323 -69
- package/temp/.tsbuildinfo +1 -1
package/package.json
CHANGED
package/spec-summary.md
CHANGED
|
@@ -2509,6 +2509,48 @@ Expected response body:
|
|
|
2509
2509
|
}
|
|
2510
2510
|
```
|
|
2511
2511
|
|
|
2512
|
+
### Payload_Pageable_ServerDrivenPagination_AlternateInitialVerb_post
|
|
2513
|
+
|
|
2514
|
+
- Endpoint: `post /payload/pageable/server-driven-pagination/link/initial-post`
|
|
2515
|
+
|
|
2516
|
+
Test case for initial POST request followed by GET for next pages using link pagination.
|
|
2517
|
+
The initial request is a POST with a filter body, and the next page is fetched using a GET request on the next link.
|
|
2518
|
+
|
|
2519
|
+
Two requests need to be tested.
|
|
2520
|
+
|
|
2521
|
+
1. Initial request (POST):
|
|
2522
|
+
Expected route: /payload/pageable/server-driven-pagination/link/initial-post
|
|
2523
|
+
Expected request body:
|
|
2524
|
+
|
|
2525
|
+
```json
|
|
2526
|
+
{ "filter": "foo eq bar" }
|
|
2527
|
+
```
|
|
2528
|
+
|
|
2529
|
+
Expected response body:
|
|
2530
|
+
|
|
2531
|
+
```json
|
|
2532
|
+
{
|
|
2533
|
+
"pets": [
|
|
2534
|
+
{ "id": "1", "name": "dog" },
|
|
2535
|
+
{ "id": "2", "name": "cat" }
|
|
2536
|
+
],
|
|
2537
|
+
"next": "http://[host]:[port]/payload/pageable/server-driven-pagination/link/initial-post/nextPage?token=abc"
|
|
2538
|
+
}
|
|
2539
|
+
```
|
|
2540
|
+
|
|
2541
|
+
2. Next page request (GET):
|
|
2542
|
+
Expected route: /payload/pageable/server-driven-pagination/link/initial-post/nextPage?token=abc
|
|
2543
|
+
Expected response body:
|
|
2544
|
+
|
|
2545
|
+
```json
|
|
2546
|
+
{
|
|
2547
|
+
"pets": [
|
|
2548
|
+
{ "id": "3", "name": "bird" },
|
|
2549
|
+
{ "id": "4", "name": "fish" }
|
|
2550
|
+
]
|
|
2551
|
+
}
|
|
2552
|
+
```
|
|
2553
|
+
|
|
2512
2554
|
### Payload_Pageable_ServerDrivenPagination_ContinuationToken_requestHeaderNestedResponseBody
|
|
2513
2555
|
|
|
2514
2556
|
- Endpoint: `get /payload/pageable/server-driven-pagination/continuationtoken/request-header-nested-response-body`
|
|
@@ -3207,6 +3249,90 @@ Expected request body:
|
|
|
3207
3249
|
</ModelWithEnum>
|
|
3208
3250
|
```
|
|
3209
3251
|
|
|
3252
|
+
### Payload_Xml_ModelWithNamespaceOnPropertiesValue_get
|
|
3253
|
+
|
|
3254
|
+
- Endpoint: `get /payload/xml/modelWithNamespaceOnProperties`
|
|
3255
|
+
|
|
3256
|
+
Expected response body:
|
|
3257
|
+
|
|
3258
|
+
```xml
|
|
3259
|
+
<smp:ModelWithNamespaceOnProperties xmlns:smp="http://example.com/schema" xmlns:ns2="http://example.com/ns2">
|
|
3260
|
+
<id>123</id>
|
|
3261
|
+
<smp:title>The Great Gatsby</smp:title>
|
|
3262
|
+
<ns2:author>F. Scott Fitzgerald</ns2:author>
|
|
3263
|
+
</smp:ModelWithNamespaceOnProperties>
|
|
3264
|
+
```
|
|
3265
|
+
|
|
3266
|
+
### Payload_Xml_ModelWithNamespaceOnPropertiesValue_put
|
|
3267
|
+
|
|
3268
|
+
- Endpoint: `put /payload/xml/modelWithNamespaceOnProperties`
|
|
3269
|
+
|
|
3270
|
+
Expected request body:
|
|
3271
|
+
|
|
3272
|
+
```xml
|
|
3273
|
+
<smp:ModelWithNamespaceOnProperties xmlns:smp="http://example.com/schema" xmlns:ns2="http://example.com/ns2">
|
|
3274
|
+
<id>123</id>
|
|
3275
|
+
<smp:title>The Great Gatsby</smp:title>
|
|
3276
|
+
<ns2:author>F. Scott Fitzgerald</ns2:author>
|
|
3277
|
+
</smp:ModelWithNamespaceOnProperties>
|
|
3278
|
+
```
|
|
3279
|
+
|
|
3280
|
+
### Payload_Xml_ModelWithNamespaceValue_get
|
|
3281
|
+
|
|
3282
|
+
- Endpoint: `get /payload/xml/modelWithNamespace`
|
|
3283
|
+
|
|
3284
|
+
Expected response body:
|
|
3285
|
+
|
|
3286
|
+
```xml
|
|
3287
|
+
<smp:ModelWithNamespace xmlns:smp="http://example.com/schema">
|
|
3288
|
+
<id>123</id>
|
|
3289
|
+
<title>The Great Gatsby</title>
|
|
3290
|
+
</smp:ModelWithNamespace>
|
|
3291
|
+
```
|
|
3292
|
+
|
|
3293
|
+
### Payload_Xml_ModelWithNamespaceValue_put
|
|
3294
|
+
|
|
3295
|
+
- Endpoint: `put /payload/xml/modelWithNamespace`
|
|
3296
|
+
|
|
3297
|
+
Expected request body:
|
|
3298
|
+
|
|
3299
|
+
```xml
|
|
3300
|
+
<smp:ModelWithNamespace xmlns:smp="http://example.com/schema">
|
|
3301
|
+
<id>123</id>
|
|
3302
|
+
<title>The Great Gatsby</title>
|
|
3303
|
+
</smp:ModelWithNamespace>
|
|
3304
|
+
```
|
|
3305
|
+
|
|
3306
|
+
### Payload_Xml_ModelWithNestedModelValue_get
|
|
3307
|
+
|
|
3308
|
+
- Endpoint: `get /payload/xml/modelWithNestedModel`
|
|
3309
|
+
|
|
3310
|
+
Expected response body:
|
|
3311
|
+
|
|
3312
|
+
```xml
|
|
3313
|
+
<ModelWithNestedModel>
|
|
3314
|
+
<nested>
|
|
3315
|
+
<name>foo</name>
|
|
3316
|
+
<age>123</age>
|
|
3317
|
+
</nested>
|
|
3318
|
+
</ModelWithNestedModel>
|
|
3319
|
+
```
|
|
3320
|
+
|
|
3321
|
+
### Payload_Xml_ModelWithNestedModelValue_put
|
|
3322
|
+
|
|
3323
|
+
- Endpoint: `put /payload/xml/modelWithNestedModel`
|
|
3324
|
+
|
|
3325
|
+
Expected request body:
|
|
3326
|
+
|
|
3327
|
+
```xml
|
|
3328
|
+
<ModelWithNestedModel>
|
|
3329
|
+
<nested>
|
|
3330
|
+
<name>foo</name>
|
|
3331
|
+
<age>123</age>
|
|
3332
|
+
</nested>
|
|
3333
|
+
</ModelWithNestedModel>
|
|
3334
|
+
```
|
|
3335
|
+
|
|
3210
3336
|
### Payload_Xml_ModelWithOptionalFieldValue_get
|
|
3211
3337
|
|
|
3212
3338
|
- Endpoint: `get /payload/xml/modelWithOptionalField`
|
|
@@ -3267,6 +3393,32 @@ Expected request body:
|
|
|
3267
3393
|
</ModelWithRenamedArrays>
|
|
3268
3394
|
```
|
|
3269
3395
|
|
|
3396
|
+
### Payload_Xml_ModelWithRenamedAttributeValue_get
|
|
3397
|
+
|
|
3398
|
+
- Endpoint: `get /payload/xml/modelWithRenamedAttribute`
|
|
3399
|
+
|
|
3400
|
+
Expected response body:
|
|
3401
|
+
|
|
3402
|
+
```xml
|
|
3403
|
+
<ModelWithRenamedAttribute xml-id="123">
|
|
3404
|
+
<title>The Great Gatsby</title>
|
|
3405
|
+
<author>F. Scott Fitzgerald</author>
|
|
3406
|
+
</ModelWithRenamedAttribute>
|
|
3407
|
+
```
|
|
3408
|
+
|
|
3409
|
+
### Payload_Xml_ModelWithRenamedAttributeValue_put
|
|
3410
|
+
|
|
3411
|
+
- Endpoint: `put /payload/xml/modelWithRenamedAttribute`
|
|
3412
|
+
|
|
3413
|
+
Expected request body:
|
|
3414
|
+
|
|
3415
|
+
```xml
|
|
3416
|
+
<ModelWithRenamedAttribute xml-id="123">
|
|
3417
|
+
<title>The Great Gatsby</title>
|
|
3418
|
+
<author>F. Scott Fitzgerald</author>
|
|
3419
|
+
</ModelWithRenamedAttribute>
|
|
3420
|
+
```
|
|
3421
|
+
|
|
3270
3422
|
### Payload_Xml_ModelWithRenamedFieldsValue_get
|
|
3271
3423
|
|
|
3272
3424
|
- Endpoint: `get /payload/xml/modelWithRenamedFields`
|
|
@@ -3305,6 +3457,178 @@ Expected request body:
|
|
|
3305
3457
|
</ModelWithRenamedFieldsSrc>
|
|
3306
3458
|
```
|
|
3307
3459
|
|
|
3460
|
+
### Payload_Xml_ModelWithRenamedNestedModelValue_get
|
|
3461
|
+
|
|
3462
|
+
- Endpoint: `get /payload/xml/modelWithRenamedNestedModel`
|
|
3463
|
+
|
|
3464
|
+
Expected response body:
|
|
3465
|
+
|
|
3466
|
+
```xml
|
|
3467
|
+
<ModelWithRenamedNestedModel>
|
|
3468
|
+
<author>
|
|
3469
|
+
<name>foo</name>
|
|
3470
|
+
</author>
|
|
3471
|
+
</ModelWithRenamedNestedModel>
|
|
3472
|
+
```
|
|
3473
|
+
|
|
3474
|
+
### Payload_Xml_ModelWithRenamedNestedModelValue_put
|
|
3475
|
+
|
|
3476
|
+
- Endpoint: `put /payload/xml/modelWithRenamedNestedModel`
|
|
3477
|
+
|
|
3478
|
+
Expected request body:
|
|
3479
|
+
|
|
3480
|
+
```xml
|
|
3481
|
+
<ModelWithRenamedNestedModel>
|
|
3482
|
+
<author>
|
|
3483
|
+
<name>foo</name>
|
|
3484
|
+
</author>
|
|
3485
|
+
</ModelWithRenamedNestedModel>
|
|
3486
|
+
```
|
|
3487
|
+
|
|
3488
|
+
### Payload_Xml_ModelWithRenamedPropertyValue_get
|
|
3489
|
+
|
|
3490
|
+
- Endpoint: `get /payload/xml/modelWithRenamedProperty`
|
|
3491
|
+
|
|
3492
|
+
Expected response body:
|
|
3493
|
+
|
|
3494
|
+
```xml
|
|
3495
|
+
<ModelWithRenamedProperty>
|
|
3496
|
+
<renamedTitle>foo</renamedTitle>
|
|
3497
|
+
<author>bar</author>
|
|
3498
|
+
</ModelWithRenamedProperty>
|
|
3499
|
+
```
|
|
3500
|
+
|
|
3501
|
+
### Payload_Xml_ModelWithRenamedPropertyValue_put
|
|
3502
|
+
|
|
3503
|
+
- Endpoint: `put /payload/xml/modelWithRenamedProperty`
|
|
3504
|
+
|
|
3505
|
+
Expected request body:
|
|
3506
|
+
|
|
3507
|
+
```xml
|
|
3508
|
+
<ModelWithRenamedProperty>
|
|
3509
|
+
<renamedTitle>foo</renamedTitle>
|
|
3510
|
+
<author>bar</author>
|
|
3511
|
+
</ModelWithRenamedProperty>
|
|
3512
|
+
```
|
|
3513
|
+
|
|
3514
|
+
### Payload_Xml_ModelWithRenamedUnwrappedModelArrayValue_get
|
|
3515
|
+
|
|
3516
|
+
- Endpoint: `get /payload/xml/modelWithRenamedUnwrappedModelArray`
|
|
3517
|
+
|
|
3518
|
+
Expected response body:
|
|
3519
|
+
|
|
3520
|
+
```xml
|
|
3521
|
+
<ModelWithRenamedUnwrappedModelArray>
|
|
3522
|
+
<ModelItem>
|
|
3523
|
+
<name>foo</name>
|
|
3524
|
+
<age>123</age>
|
|
3525
|
+
</ModelItem>
|
|
3526
|
+
<ModelItem>
|
|
3527
|
+
<name>bar</name>
|
|
3528
|
+
<age>456</age>
|
|
3529
|
+
</ModelItem>
|
|
3530
|
+
</ModelWithRenamedUnwrappedModelArray>
|
|
3531
|
+
```
|
|
3532
|
+
|
|
3533
|
+
### Payload_Xml_ModelWithRenamedUnwrappedModelArrayValue_put
|
|
3534
|
+
|
|
3535
|
+
- Endpoint: `put /payload/xml/modelWithRenamedUnwrappedModelArray`
|
|
3536
|
+
|
|
3537
|
+
Expected request body:
|
|
3538
|
+
|
|
3539
|
+
```xml
|
|
3540
|
+
<ModelWithRenamedUnwrappedModelArray>
|
|
3541
|
+
<ModelItem>
|
|
3542
|
+
<name>foo</name>
|
|
3543
|
+
<age>123</age>
|
|
3544
|
+
</ModelItem>
|
|
3545
|
+
<ModelItem>
|
|
3546
|
+
<name>bar</name>
|
|
3547
|
+
<age>456</age>
|
|
3548
|
+
</ModelItem>
|
|
3549
|
+
</ModelWithRenamedUnwrappedModelArray>
|
|
3550
|
+
```
|
|
3551
|
+
|
|
3552
|
+
### Payload_Xml_ModelWithRenamedWrappedAndItemModelArrayValue_get
|
|
3553
|
+
|
|
3554
|
+
- Endpoint: `get /payload/xml/modelWithRenamedWrappedAndItemModelArray`
|
|
3555
|
+
|
|
3556
|
+
Expected response body:
|
|
3557
|
+
|
|
3558
|
+
```xml
|
|
3559
|
+
<ModelWithRenamedWrappedAndItemModelArray>
|
|
3560
|
+
<AllBooks>
|
|
3561
|
+
<XmlBook>
|
|
3562
|
+
<title>The Great Gatsby</title>
|
|
3563
|
+
</XmlBook>
|
|
3564
|
+
<XmlBook>
|
|
3565
|
+
<title>Les Miserables</title>
|
|
3566
|
+
</XmlBook>
|
|
3567
|
+
</AllBooks>
|
|
3568
|
+
</ModelWithRenamedWrappedAndItemModelArray>
|
|
3569
|
+
```
|
|
3570
|
+
|
|
3571
|
+
### Payload_Xml_ModelWithRenamedWrappedAndItemModelArrayValue_put
|
|
3572
|
+
|
|
3573
|
+
- Endpoint: `put /payload/xml/modelWithRenamedWrappedAndItemModelArray`
|
|
3574
|
+
|
|
3575
|
+
Expected request body:
|
|
3576
|
+
|
|
3577
|
+
```xml
|
|
3578
|
+
<ModelWithRenamedWrappedAndItemModelArray>
|
|
3579
|
+
<AllBooks>
|
|
3580
|
+
<XmlBook>
|
|
3581
|
+
<title>The Great Gatsby</title>
|
|
3582
|
+
</XmlBook>
|
|
3583
|
+
<XmlBook>
|
|
3584
|
+
<title>Les Miserables</title>
|
|
3585
|
+
</XmlBook>
|
|
3586
|
+
</AllBooks>
|
|
3587
|
+
</ModelWithRenamedWrappedAndItemModelArray>
|
|
3588
|
+
```
|
|
3589
|
+
|
|
3590
|
+
### Payload_Xml_ModelWithRenamedWrappedModelArrayValue_get
|
|
3591
|
+
|
|
3592
|
+
- Endpoint: `get /payload/xml/modelWithRenamedWrappedModelArray`
|
|
3593
|
+
|
|
3594
|
+
Expected response body:
|
|
3595
|
+
|
|
3596
|
+
```xml
|
|
3597
|
+
<ModelWithRenamedWrappedModelArray>
|
|
3598
|
+
<AllItems>
|
|
3599
|
+
<SimpleModel>
|
|
3600
|
+
<name>foo</name>
|
|
3601
|
+
<age>123</age>
|
|
3602
|
+
</SimpleModel>
|
|
3603
|
+
<SimpleModel>
|
|
3604
|
+
<name>bar</name>
|
|
3605
|
+
<age>456</age>
|
|
3606
|
+
</SimpleModel>
|
|
3607
|
+
</AllItems>
|
|
3608
|
+
</ModelWithRenamedWrappedModelArray>
|
|
3609
|
+
```
|
|
3610
|
+
|
|
3611
|
+
### Payload_Xml_ModelWithRenamedWrappedModelArrayValue_put
|
|
3612
|
+
|
|
3613
|
+
- Endpoint: `put /payload/xml/modelWithRenamedWrappedModelArray`
|
|
3614
|
+
|
|
3615
|
+
Expected request body:
|
|
3616
|
+
|
|
3617
|
+
```xml
|
|
3618
|
+
<ModelWithRenamedWrappedModelArray>
|
|
3619
|
+
<AllItems>
|
|
3620
|
+
<SimpleModel>
|
|
3621
|
+
<name>foo</name>
|
|
3622
|
+
<age>123</age>
|
|
3623
|
+
</SimpleModel>
|
|
3624
|
+
<SimpleModel>
|
|
3625
|
+
<name>bar</name>
|
|
3626
|
+
<age>456</age>
|
|
3627
|
+
</SimpleModel>
|
|
3628
|
+
</AllItems>
|
|
3629
|
+
</ModelWithRenamedWrappedModelArray>
|
|
3630
|
+
```
|
|
3631
|
+
|
|
3308
3632
|
### Payload_Xml_ModelWithSimpleArraysValue_get
|
|
3309
3633
|
|
|
3310
3634
|
- Endpoint: `get /payload/xml/modelWithSimpleArrays`
|
|
@@ -3405,6 +3729,74 @@ Expected request body:
|
|
|
3405
3729
|
</ModelWithUnwrappedArray>
|
|
3406
3730
|
```
|
|
3407
3731
|
|
|
3732
|
+
### Payload_Xml_ModelWithUnwrappedModelArrayValue_get
|
|
3733
|
+
|
|
3734
|
+
- Endpoint: `get /payload/xml/modelWithUnwrappedModelArray`
|
|
3735
|
+
|
|
3736
|
+
Expected response body:
|
|
3737
|
+
|
|
3738
|
+
```xml
|
|
3739
|
+
<ModelWithUnwrappedModelArray>
|
|
3740
|
+
<items>
|
|
3741
|
+
<name>foo</name>
|
|
3742
|
+
<age>123</age>
|
|
3743
|
+
</items>
|
|
3744
|
+
<items>
|
|
3745
|
+
<name>bar</name>
|
|
3746
|
+
<age>456</age>
|
|
3747
|
+
</items>
|
|
3748
|
+
</ModelWithUnwrappedModelArray>
|
|
3749
|
+
```
|
|
3750
|
+
|
|
3751
|
+
### Payload_Xml_ModelWithUnwrappedModelArrayValue_put
|
|
3752
|
+
|
|
3753
|
+
- Endpoint: `put /payload/xml/modelWithUnwrappedModelArray`
|
|
3754
|
+
|
|
3755
|
+
Expected request body:
|
|
3756
|
+
|
|
3757
|
+
```xml
|
|
3758
|
+
<ModelWithUnwrappedModelArray>
|
|
3759
|
+
<items>
|
|
3760
|
+
<name>foo</name>
|
|
3761
|
+
<age>123</age>
|
|
3762
|
+
</items>
|
|
3763
|
+
<items>
|
|
3764
|
+
<name>bar</name>
|
|
3765
|
+
<age>456</age>
|
|
3766
|
+
</items>
|
|
3767
|
+
</ModelWithUnwrappedModelArray>
|
|
3768
|
+
```
|
|
3769
|
+
|
|
3770
|
+
### Payload_Xml_ModelWithWrappedPrimitiveCustomItemNamesValue_get
|
|
3771
|
+
|
|
3772
|
+
- Endpoint: `get /payload/xml/modelWithWrappedPrimitiveCustomItemNames`
|
|
3773
|
+
|
|
3774
|
+
Expected response body:
|
|
3775
|
+
|
|
3776
|
+
```xml
|
|
3777
|
+
<ModelWithWrappedPrimitiveCustomItemNames>
|
|
3778
|
+
<ItemsTags>
|
|
3779
|
+
<ItemName>fiction</ItemName>
|
|
3780
|
+
<ItemName>classic</ItemName>
|
|
3781
|
+
</ItemsTags>
|
|
3782
|
+
</ModelWithWrappedPrimitiveCustomItemNames>
|
|
3783
|
+
```
|
|
3784
|
+
|
|
3785
|
+
### Payload_Xml_ModelWithWrappedPrimitiveCustomItemNamesValue_put
|
|
3786
|
+
|
|
3787
|
+
- Endpoint: `put /payload/xml/modelWithWrappedPrimitiveCustomItemNames`
|
|
3788
|
+
|
|
3789
|
+
Expected request body:
|
|
3790
|
+
|
|
3791
|
+
```xml
|
|
3792
|
+
<ModelWithWrappedPrimitiveCustomItemNames>
|
|
3793
|
+
<ItemsTags>
|
|
3794
|
+
<ItemName>fiction</ItemName>
|
|
3795
|
+
<ItemName>classic</ItemName>
|
|
3796
|
+
</ItemsTags>
|
|
3797
|
+
</ModelWithWrappedPrimitiveCustomItemNames>
|
|
3798
|
+
```
|
|
3799
|
+
|
|
3408
3800
|
### Payload_Xml_SimpleModelValue_get
|
|
3409
3801
|
|
|
3410
3802
|
- Endpoint: `get /payload/xml/simpleModel`
|
|
@@ -141,6 +141,53 @@ namespace ServerDrivenPagination {
|
|
|
141
141
|
};
|
|
142
142
|
};
|
|
143
143
|
|
|
144
|
+
/** Scenario where the initial request is not a GET request. However following the next link always result in a GET request. */
|
|
145
|
+
namespace AlternateInitialVerb {
|
|
146
|
+
model Filter {
|
|
147
|
+
filter: string;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
@scenario
|
|
151
|
+
@scenarioDoc("""
|
|
152
|
+
Test case for initial POST request followed by GET for next pages using link pagination.
|
|
153
|
+
The initial request is a POST with a filter body, and the next page is fetched using a GET request on the next link.
|
|
154
|
+
|
|
155
|
+
Two requests need to be tested.
|
|
156
|
+
1. Initial request (POST):
|
|
157
|
+
Expected route: /payload/pageable/server-driven-pagination/link/initial-post
|
|
158
|
+
Expected request body:
|
|
159
|
+
```json
|
|
160
|
+
{ "filter": "foo eq bar" }
|
|
161
|
+
```
|
|
162
|
+
Expected response body:
|
|
163
|
+
```json
|
|
164
|
+
{ "pets": [
|
|
165
|
+
{ "id": "1", "name": "dog" },
|
|
166
|
+
{ "id": "2", "name": "cat" }
|
|
167
|
+
],
|
|
168
|
+
"next": "http://[host]:[port]/payload/pageable/server-driven-pagination/link/initial-post/nextPage?token=abc"
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
2. Next page request (GET):
|
|
172
|
+
Expected route: /payload/pageable/server-driven-pagination/link/initial-post/nextPage?token=abc
|
|
173
|
+
Expected response body:
|
|
174
|
+
```json
|
|
175
|
+
{ "pets": [
|
|
176
|
+
{ "id": "3", "name": "bird" },
|
|
177
|
+
{ "id": "4", "name": "fish" }
|
|
178
|
+
]
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
""")
|
|
182
|
+
@route("/link/initial-post")
|
|
183
|
+
@list
|
|
184
|
+
@post
|
|
185
|
+
op post(@body body: Filter): {
|
|
186
|
+
@pageItems pets: Pet[];
|
|
187
|
+
@nextLink next?: url;
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
|
|
144
191
|
@route("/continuationtoken")
|
|
145
192
|
namespace ContinuationToken {
|
|
146
193
|
@scenario
|
|
@@ -177,6 +177,34 @@ Scenarios.Payload_Pageable_ServerDrivenPagination_nestedLink = passOnSuccess([
|
|
|
177
177
|
},
|
|
178
178
|
]);
|
|
179
179
|
|
|
180
|
+
// POST-THEN-GET LINK PAGINATION
|
|
181
|
+
Scenarios.Payload_Pageable_ServerDrivenPagination_AlternateInitialVerb_post = passOnSuccess([
|
|
182
|
+
{
|
|
183
|
+
uri: "/payload/pageable/server-driven-pagination/link/initial-post",
|
|
184
|
+
method: "post",
|
|
185
|
+
request: {
|
|
186
|
+
body: json({ filter: "foo eq bar" }),
|
|
187
|
+
},
|
|
188
|
+
response: {
|
|
189
|
+
status: 200,
|
|
190
|
+
body: json({
|
|
191
|
+
pets: FirstPage,
|
|
192
|
+
next: dyn`${dynItem("baseUrl")}/payload/pageable/server-driven-pagination/link/initial-post/nextPage?token=abc`,
|
|
193
|
+
}),
|
|
194
|
+
},
|
|
195
|
+
kind: "MockApiDefinition",
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
uri: "/payload/pageable/server-driven-pagination/link/initial-post/nextPage",
|
|
199
|
+
method: "get",
|
|
200
|
+
request: {
|
|
201
|
+
query: { token: "abc" },
|
|
202
|
+
},
|
|
203
|
+
response: SecondResponse,
|
|
204
|
+
kind: "MockApiDefinition",
|
|
205
|
+
},
|
|
206
|
+
]);
|
|
207
|
+
|
|
180
208
|
Scenarios.Payload_Pageable_ServerDrivenPagination_ContinuationToken_requestQueryResponseBody =
|
|
181
209
|
createTests("query", "body");
|
|
182
210
|
|