feat: Custom named schemas in Documentation#3133
Conversation
📝 WalkthroughWalkthroughZod schema metadata IDs ( Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Route as Route (Zod schema)
participant DocHelper as DocumentationHelpers
participant DocImpl as Documentation (rootDoc)
participant Registry as SchemaRegistry
Note over Route,DocHelper: Route schema may include .meta({ id })
Route->>DocHelper: provide jsonSchema (includes .meta.id)
DocHelper->>DocImpl: ctx.makeRef(key, value, proposedName=jsonSchema.id)
DocImpl->>Registry: resolveOrCreateName(key, proposedName)
alt proposedName unused
Registry-->>DocImpl: name = proposedName
else name conflict
Registry-->>DocImpl: name = proposedName + counter
end
DocImpl->>Registry: addSchema(name, value)
DocImpl-->>DocHelper: ReferenceObject { $ref: "#/components/schemas/" + name }
DocHelper-->>Route: attach reference in OpenAPI output
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧠 Learnings (4)📓 Common learnings📚 Learning: 2025-05-27T20:08:50.699ZApplied to files:
📚 Learning: 2025-05-27T19:27:13.492ZApplied to files:
📚 Learning: 2025-08-05T14:43:24.702ZApplied to files:
🔇 Additional comments (1)
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 |
Related to #1393 (comment)
Summary by CodeRabbit
New Features
Documentation
Tests
Refactor
✏️ Tip: You can customize this high-level summary in your review settings.