Repository navigation
feat(spec): support page_index params in the request body - #526
BlueLabelscotch wants to merge 2 commits into
Conversation
| endpoint: | ||
| method: POST | ||
| path: /gitops/api/v1/repocreds | ||
| items_expr: it.content ?? [] |
There was a problem hiding this comment.
items_expr passes each credential object through unchanged, and the API response schema includes passwords and private keys. JSON and JSONL output ignore columns, so any secret values the API returns would be written unredacted to stdout or the output file.
Severity: high
🤖 Was this useful? React with 👍 or 👎
| return fmt.Errorf("command %q: paging requires page_size_param", command) | ||
| } | ||
| } | ||
| switch pg.PageParamsIn { |
There was a problem hiding this comment.
validatePaging returns early for flat_list, so this switch never rejects page_params_in: body or an invalid value on that strategy. A POST flat_list spec can therefore register successfully with body paging enabled even though it never sends the paging parameters.
Severity: medium
🤖 Was this useful? React with 👍 or 👎
| req.QueryParams[indexParam] = strconv.Itoa(pageIndex) | ||
| if pg.PageSizeParam != "" && pageSize > 0 { | ||
| req.QueryParams[pg.PageSizeParam] = strconv.Itoa(pageSize) | ||
| if pg.PageParamsIn == spec.PageParamsInBody { |
There was a problem hiding this comment.
InjectPaging has no regression test that checks both sides of a page boundary and verifies that body paging overwrites only the paging keys. That leaves stale page values or dropped filters undetected by the existing suite; AGENTS.md calls for focused tests of request-body transformations and boundary cases.
Severity: medium
🤖 Was this useful? React with 👍 or 👎
| searchTerm: 'flags.search != "" ? flags.search : nil' | ||
| agentIdentifier: 'flags.agent != "" ? flags.agent : nil' | ||
| paging: | ||
| paging_strategy: page_index |
There was a problem hiding this comment.
list gitops_repocred declares a documented API total but leaves countable off, so the CLI rejects both --all and --count. Users who need the full list still have to walk pages manually.
Severity: medium
🤖 Was this useful? React with 👍 or 👎
| agentIdentifier: 'flags.agent != "" ? flags.agent : nil' | ||
| paging: | ||
| paging_strategy: page_index | ||
| page_params_in: body |
There was a problem hiding this comment.
list gitops_repocred adopts the new core paging feature in the same PR, but AGENTS.md requires a separate module PR unless the change is needed for compatibility. Is there a compatibility reason to bundle it here, rather than following the split described in #509 and previously noted in #511?
Severity: low
🤖 Was this useful? React with 👍 or 👎
ef20ff6 to
09a134b
Compare
|
cosmos review |
| if err := validatePaging(cs.Command, ep.Paging); err != nil { | ||
| return err | ||
| } | ||
| if ep.Paging.PageParamsIn == spec.PageParamsInBody { |
There was a problem hiding this comment.
validateEndpointConstraints accepts body paging with body_fn, but the paging path builds the request without calling that function. A POST list spec can therefore silently drop filters from body_fn, and a raw or array body returned by the function never reaches the new type check.
Severity: medium
🤖 Was this useful? React with 👍 or 👎
| body = map[string]any{} | ||
| req.Body = body | ||
| } | ||
| body[indexParam] = pageIndex |
There was a problem hiding this comment.
HTTPFetchFn runs validators_endpoint before InjectPaging inserts or overwrites the page index and size in the body. A validator can reject a request whose final body would be valid, or approve a body whose paging values are replaced before it is sent.
Severity: medium
🤖 Was this useful? React with 👍 or 👎
Closes #509
What
paging.page_params_in: body(defaultquery). Withpage_index, the index and size params are merged into the JSON request body instead of the query string, leaving other body keys intact.pkg/registry/checks.go: onlypage_index, and only POST/PUT/PATCH.Testing
No unit tests yet. Checked manually against a live account:
list gitops_repocredsentpageIndex/pageSizein the body and got a 200 at project, org and account scope.list gitops_repositorywith body paging and page size 2 fetchedpageIndex0 then 1 and returned all 3 items; a hard-coded bodypageSizewas overridden.go testpasses forpkg/endpoint,pkg/registry,pkg/spec.Follow-up
Module PR to adopt it in
list gitops_repocred(replacing the fixedpageSize: "1000"), after this lands.