docs: add protovalidate to homepage, architecture, config, and interceptors howto#59
docs: add protovalidate to homepage, architecture, config, and interceptors howto#59
Conversation
…rs howto - Index.md: add Request Validation to features table and ASCII diagram - architecture.md: add Proto Validate to interceptor chain table (position 3) - config-reference.md: add DISABLE_PROTO_VALIDATE env var - howto/interceptors.md: add Proto Validation section with annotation examples, custom constraints, and disable option
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdded documentation for proto-based request validation: a new "Request Validation" feature entry, insertion of a Proto Validate interceptor into the server interceptor chain, a Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Server
participant ProtoValidate as "Proto\nValidate"
participant Interceptors as "Metrics / Error\nNotification / OTEL"
participant Handler
Client->>Server: gRPC/HTTP request
Server->>ProtoValidate: validate message annotations
alt validation fails
ProtoValidate-->>Server: InvalidArgument error
Server-->>Client: return InvalidArgument
else validation succeeds
ProtoValidate-->>Interceptors: pass to next interceptors
Interceptors->>Handler: invoke service handler
Handler-->>Server: response
Server-->>Client: response
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
howto/interceptors.md (1)
161-167: Make the custom-constraints snippet copy-paste complete.Consider adding the import block (at least
github.com/go-coldbrew/interceptorsandgithub.com/bufbuild/protovalidate-go) so readers can apply the example without guessing dependencies.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@howto/interceptors.md` around lines 161 - 167, The snippet is missing required imports so it isn't copy-paste runnable; add an import block that at minimum imports "github.com/go-coldbrew/interceptors" and "github.com/bufbuild/protovalidate-go" (plus any local package that defines myConstraints) and then keep the shown init() that calls interceptors.SetProtoValidateOptions(protovalidate.WithCustomConstraints(myConstraints...)) so readers can paste and compile immediately; reference the init function, interceptors.SetProtoValidateOptions, and protovalidate.WithCustomConstraints to locate where to add the imports.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@architecture.md`:
- Around line 203-207: The Request Lifecycle diagram and the interceptor list
are inconsistent: the interceptor list shows "Proto Validate" as position 3
while the earlier Request Lifecycle diagram lists "Prometheus" as `#3` and omits
"Proto Validate"; update the Request Lifecycle diagram so its ordered chain
matches the interceptor table (include "Proto Validate" at the same position and
ensure "Prometheus", "Error Notification", "New Relic", and "Panic Recovery"
appear in the same relative order as the table), and verify both the diagram
text and any captions reflect the identical interceptor order.
In `@Index.md`:
- Around line 104-108: The diagram currently lists "OpenTelemetry" as an
interceptor bullet alongside "Proto Validate" which is misleading because OTEL
is attached via the stats handler, not the interceptor chain; update the diagram
text so it no longer implies OTEL is an interceptor—either remove
"OpenTelemetry" from the interceptor bullet list and place a separate
"OpenTelemetry (stats handler)" or relabel the bullet (e.g., "Metrics / Stats
(OpenTelemetry)") near the stats handler box; adjust the ASCII block that
contains "Proto Validate" and the interceptor bullets accordingly so the visual
matches the documented architecture.
---
Nitpick comments:
In `@howto/interceptors.md`:
- Around line 161-167: The snippet is missing required imports so it isn't
copy-paste runnable; add an import block that at minimum imports
"github.com/go-coldbrew/interceptors" and "github.com/bufbuild/protovalidate-go"
(plus any local package that defines myConstraints) and then keep the shown
init() that calls
interceptors.SetProtoValidateOptions(protovalidate.WithCustomConstraints(myConstraints...))
so readers can paste and compile immediately; reference the init function,
interceptors.SetProtoValidateOptions, and protovalidate.WithCustomConstraints to
locate where to add the imports.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: f125577f-9a57-49f1-80e3-6f964cc5d679
📒 Files selected for processing (4)
Index.mdarchitecture.mdconfig-reference.mdhowto/interceptors.md
There was a problem hiding this comment.
Pull request overview
Adds documentation for automatic request validation using Protovalidate across the docs site (homepage, architecture, config reference, and interceptors how-to), aligning docs with the new default interceptor chain behavior referenced in dependent core/interceptors PRs.
Changes:
- Document Protovalidate as a built-in request validation feature on the homepage and in the interceptor-chain diagram.
- Update the architecture interceptor order table to include Proto Validate (and document the disable env var).
- Add
DISABLE_PROTO_VALIDATEto the configuration reference and document usage/configuration in the interceptors how-to.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
Index.md |
Adds “Request Validation” feature and inserts Proto Validate into the homepage interceptor-chain diagram; adds Protovalidate link reference. |
architecture.md |
Updates the interceptor chain order table to include Proto Validate and notes the disable env var. |
config-reference.md |
Documents the new DISABLE_PROTO_VALIDATE environment variable. |
howto/interceptors.md |
Adds a new “Proto Validation” section with proto annotations, custom constraints, and disable instructions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| gRPC Request ──► │ │ gateway)│ │ ► Trace ID │ │ | ||
| │ └─────────┘ │ ► OpenTelemetry │ │ | ||
| │ │ │ ► Prometheus │ │ | ||
| │ ▼ │ ► Error Notify │ │ | ||
| │ └─────────┘ │ ► Proto Validate │ │ | ||
| │ │ │ ► OpenTelemetry │ │ | ||
| │ ▼ │ ► Prometheus │ │ |
There was a problem hiding this comment.
The interceptor-chain diagram lists “OpenTelemetry” as part of the chain, but elsewhere in the docs (e.g., architecture.md) OpenTelemetry span creation is described as coming from the otelgrpc stats handler, not an interceptor. This diagram should be updated to avoid implying OpenTelemetry is an interceptor (e.g., label it as stats handler/outside the chain).
There was a problem hiding this comment.
Fixed — removed from Index.md diagram.
…bullets, add buf dep note
- quickstart.md: add Request Validation to "What's Built In" list, add min_len annotation to Greet example - Index.md: mention both gRPC and HTTP in features table - howto/interceptors.md: note validation covers both transports
Summary
DISABLE_PROTO_VALIDATEenv varSetProtoValidateOptions, and disable optionDepends on: go-coldbrew/interceptors#35, go-coldbrew/core#70
Test plan
Summary by CodeRabbit
New Features
Documentation