Validations

Validations

Validations are a core concept within ptsq, encompassing both argument and output validation. These validations are powered by Typebox (opens in a new tab), a library known for generating JSON schemas for validation purposes.

You might wonder why Typebox is chosen over Zod for validations. The primary reason is the seamless integration with introspection. Typebox generates JSON schemas directly, simplifying the introspection process. In contrast, Zod requires conversion of its schemas into JSON schemas for introspection, adding an extra step and potentially complicating the process.

Furthermore, Typebox allows ptsq to infer TypeScript types directly from the generated JSON schemas, streamlining the development experience and ensuring type safety throughout the application.

In summary, by leveraging Typebox for validations, ptsq benefits from easier introspection, simplified development workflows, and robust type inference capabilities, enhancing the overall developer experience and productivity.