docs: Add REST endpoint guidance#3031
Conversation
Signed-off-by: Kyle Felter <[email protected]>
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
Summary by CodeRabbit
WalkthroughThis PR adds a new "REST endpoint implementation patterns" subsection to rest-api/AGENTS.md. It documents reference endpoint families to mirror, handler construction and route registration conventions, and testing expectations for REST endpoint changes. No code or exported entity changes are included. ChangesAGENTS.md documentation update
Estimated code review effort: 1 (Trivial) | ~5 minutes Related issues: None referenced in the provided context. Related PRs: None referenced in the provided context. Suggested labels: documentation Suggested reviewers: None can be determined from the provided context. As a Principal Engineer, I note this change is confined entirely to documentation — a low-risk, well-structured addition that codifies existing conventions rather than altering behavior. No structural or logic concerns apply here; the prose is clear and the checklist format is appropriately actionable for future contributors.
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
This is great @kfelternv A few other things to add:
|
…-3031 Signed-off-by: Kyle Felter <[email protected]> # Conflicts: # rest-api/AGENTS.md Co-authored-by: Kyle Felter <[email protected]>
🔍 Container Scan Summary
Per-CVE detail lives in the per-service |
|
🌿 Preview your docs: https://nvidia-preview-pull-request-3031.docs.buildwithfern.com/infra-controller |
🔐 TruffleHog Secret Scan✅ No secrets or credentials found! Your code has been scanned for 700+ types of secrets and credentials. All clear! 🎉 🕐 Last updated: 2026-07-01 15:07:13 UTC | Commit: d1412af |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
rest-api/AGENTS.md (2)
270-281: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd the pagination response-header contract to the checklist.
The checklist covers paging inputs, but not the response-side pagination header required for multi-object GETs in the PR objectives. Call that out here so endpoint authors assert the full contract, not just request validation.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@rest-api/AGENTS.md` around lines 270 - 281, The endpoint testing checklist is missing the response-side pagination header contract for multi-object GETs, so update the guidance in AGENTS to explicitly require asserting the pagination header behavior as part of endpoint tests. Add this alongside the existing paging input checks so authors cover both request validation and response headers, especially in the sections covering handler tests and route/OpenAPI coverage.
267-269: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winScope the OpenAPI requirement to published routes.
This reads like every new route must update
openapi/spec.yaml, but the same section explicitly exempts system/public discovery routes fromNewAPIRoutes. Tighten it to routes that are actually part of the OpenAPI surface.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@rest-api/AGENTS.md` around lines 267 - 269, Tighten the OpenAPI update requirement in AGENTS.md so it applies only to routes that are actually published in the OpenAPI surface, not every new route. Clarify the guidance around NewAPIRoutes by explicitly exempting system/public discovery routes and any other non-OpenAPI endpoints, while still requiring openapi/spec.yaml updates for documented API routes. Keep the instruction aligned with the existing references to openapi/spec.yaml, NewAPIRoutes, and the SDK-facing naming guidance.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@rest-api/AGENTS.md`:
- Around line 270-281: The endpoint testing checklist is missing the
response-side pagination header contract for multi-object GETs, so update the
guidance in AGENTS to explicitly require asserting the pagination header
behavior as part of endpoint tests. Add this alongside the existing paging input
checks so authors cover both request validation and response headers, especially
in the sections covering handler tests and route/OpenAPI coverage.
- Around line 267-269: Tighten the OpenAPI update requirement in AGENTS.md so it
applies only to routes that are actually published in the OpenAPI surface, not
every new route. Clarify the guidance around NewAPIRoutes by explicitly
exempting system/public discovery routes and any other non-OpenAPI endpoints,
while still requiring openapi/spec.yaml updates for documented API routes. Keep
the instruction aligned with the existing references to openapi/spec.yaml,
NewAPIRoutes, and the SDK-facing naming guidance.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: af1d553a-4632-444f-9f9b-0c3153fc473c
📒 Files selected for processing (1)
rest-api/AGENTS.md
|
|
||
| Before adding REST API code, find the nearest existing endpoint family and copy | ||
| its shape. The central route list in `api/pkg/api/routes.go` already covers the | ||
| main patterns: |
There was a problem hiding this comment.
Let's add the suggestions I made in the comment here #3031 (comment)
Add some specific guidance to the agents.md file for development work against the REST api for NICo