Skip to content

docs: add protovalidate to homepage, architecture, config, and interceptors howto#59

Merged
ankurs merged 3 commits intomainfrom
docs/protovalidate
Apr 6, 2026
Merged

docs: add protovalidate to homepage, architecture, config, and interceptors howto#59
ankurs merged 3 commits intomainfrom
docs/protovalidate

Conversation

@ankurs
Copy link
Copy Markdown
Member

@ankurs ankurs commented Apr 6, 2026

Summary

  • Index.md: Add "Request Validation" to features table + Proto Validate to ASCII interceptor chain diagram
  • architecture.md: Add Proto Validate to interceptor chain order table (position 3, after Trace ID)
  • config-reference.md: Add DISABLE_PROTO_VALIDATE env var
  • howto/interceptors.md: Add Proto Validation section with annotation examples, custom constraints via SetProtoValidateOptions, and disable option

Depends on: go-coldbrew/interceptors#35, go-coldbrew/core#70

Test plan

  • Playwright tests pass
  • All 4 pages render correctly

Summary by CodeRabbit

  • New Features

    • Proto-based request validation enabled by default for gRPC and HTTP; invalid requests return InvalidArgument.
    • New env var to disable proto validation when needed.
  • Documentation

    • Interceptor chain diagrams and tables updated to show validation before metrics/error reporting.
    • Added setup/how-to guidance, examples, and a protovalidate reference link.

…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
Copilot AI review requested due to automatic review settings April 6, 2026 03:31
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 6, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 561040e3-4128-473e-8c95-a06a836cc4d6

📥 Commits

Reviewing files that changed from the base of the PR and between 93779cd and f0ef013.

📒 Files selected for processing (3)
  • Index.md
  • howto/interceptors.md
  • quickstart.md
✅ Files skipped from review due to trivial changes (2)
  • howto/interceptors.md
  • quickstart.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • Index.md

📝 Walkthrough

Walkthrough

Added documentation for proto-based request validation: a new "Request Validation" feature entry, insertion of a Proto Validate interceptor into the server interceptor chain, a DISABLE_PROTO_VALIDATE env var, protovalidate integration guidance, and an example proto constraint in quickstart.

Changes

Cohort / File(s) Summary
Feature & Overview
Index.md
Added "Request Validation" to feature list and added a [Protovalidate] link reference.
Architecture / Interceptor Chain
architecture.md
Inserted a "Proto Validate" interceptor step into the Server Interceptor Chain (shifts subsequent steps) and documented that validation failures return InvalidArgument; added DISABLE_PROTO_VALIDATE toggle.
Configuration Reference
config-reference.md
Added DISABLE_PROTO_VALIDATE (bool, default false) to the gRPC server configuration reference to disable the protovalidate interceptor.
How-to / Interceptors
howto/interceptors.md
New "Proto Validation" section describing default protovalidate interceptor behavior, proto annotations, adding buf.build/bufbuild/protovalidate to buf.yaml, customizing constraints via interceptors.SetProtoValidateOptions(...), and env-var disabling.
Quickstart / Example Proto
proto/echoserver.proto
Added import "buf/validate/validate.proto"; and a min_len = 1 validation on GreetRequest.name; docs updated to state validation yields InvalidArgument for empty names.

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
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Poem

🐰 I checked each proto rule with care,

Hopped through fields and fixed the air.
Invalid names now gently say "no",
Validation helps the handlers flow.
Crunch a carrot — docs ready to go. 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main changes across all modified files: adding protovalidate documentation to the homepage (Index.md), architecture docs, configuration reference, and interceptors howto.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/protovalidate

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/interceptors and github.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

📥 Commits

Reviewing files that changed from the base of the PR and between 813fe55 and 2a6c6ed.

📒 Files selected for processing (4)
  • Index.md
  • architecture.md
  • config-reference.md
  • howto/interceptors.md

Comment thread architecture.md
Comment thread Index.md
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_VALIDATE to 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.

Comment thread Index.md Outdated
Comment on lines +103 to +106
gRPC Request ──► │ │ gateway)│ │ ► Trace ID │ │
│ └─────────┘ │ ► OpenTelemetry │ │
│ │ │ ► Prometheus │ │
│ ▼ │ ► Error Notify │ │
│ └─────────┘ │ ► Proto Validate │ │
│ │ │ ► OpenTelemetry │ │
│ ▼ │ ► Prometheus │ │
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed — removed from Index.md diagram.

Comment thread architecture.md
Comment thread howto/interceptors.md
Comment thread howto/interceptors.md
ankurs added 2 commits April 6, 2026 12:11
- 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
@ankurs ankurs merged commit 3522b11 into main Apr 6, 2026
7 checks passed
@ankurs ankurs deleted the docs/protovalidate branch April 6, 2026 05:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants