When to and when not to use return validators
Blog post from Convex
Mike Cann discusses the evolving guidance on using return validators in Convex queries and mutations, highlighting the shift from always recommending their use to a more nuanced approach. Initially, return validators were advised to mitigate TypeScript circular type issues and enforce runtime correctness, but the "always" rule led to problems such as verbosity, increased token usage, and potential schema errors due to the limitations of Large Language Models (LLMs). The article explains that while return validators are beneficial for enforcing exact runtime contracts, especially in scenarios like static codegen and OpenAPI generation, their blanket use can lead to inefficiencies and complications in refactoring. Therefore, the new guideline encourages relying on TypeScript types and inference by default, reserving return validators for specific cases where runtime exactness is essential. Convex offers a comprehensive backend platform for building full-stack AI projects, integrating functionalities like cloud functions, databases, and real-time updates.
| Trend | Post Mentions | Total Month Mentions | Posts | Companies | MoM |
|---|---|---|---|---|---|
| LLM | 3 | 5,138 | 781 | 181 | +34% |
| Real-time | 1 | 5,046 | 1,089 | 214 | +11% |
| Vector Search | 1 | 2,212 | 422 | 133 | +33% |
Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.