Skip to content

Commit d1b4aef

Browse files
somanshreddyclaude
andcommitted
codegen: simplify pagination detection to match actual API
Only check for "next_token" (response) and "token" (query param) — the actual field names used by all HeyGen v3 endpoints. Removed speculative support for "cursor" and "page_token" that don't exist. Updated test_spec.yaml to use "next_token" (was "token"). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 5bc5f42 commit d1b4aef

2 files changed

Lines changed: 4 additions & 10 deletions

File tree

codegen/grouper.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -458,13 +458,8 @@ func detectPagination(op *openapi3.Operation, pathItem *openapi3.PathItem) bool
458458
schemasToCheck = append(schemasToCheck, dataProp.Value)
459459
}
460460
for _, schema := range schemasToCheck {
461-
for _, candidate := range []string{"next_token", "token", "cursor"} {
462-
if _, ok := schema.Properties[candidate]; ok {
463-
hasCursorField = true
464-
break
465-
}
466-
}
467-
if hasCursorField {
461+
if _, ok := schema.Properties["next_token"]; ok {
462+
hasCursorField = true
468463
break
469464
}
470465
}
@@ -482,8 +477,7 @@ func detectCursorParam(pathItem *openapi3.PathItem, op *openapi3.Operation) stri
482477
if param == nil || param.In != "query" {
483478
continue
484479
}
485-
switch param.Name {
486-
case "token", "cursor", "page_token":
480+
if param.Name == "token" {
487481
return param.Name
488482
}
489483
}

codegen/testdata/test_spec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ paths:
3737
type: array
3838
items:
3939
type: object
40-
token:
40+
next_token:
4141
type: string
4242
post:
4343
tags: [Videos]

0 commit comments

Comments
 (0)