miolo-schemas

Enforce Joi-based input validation for miolo routes and database functions.

Updated Feb 4, 2022
One-click install
npx skills add https://github.com/afialapis/miolo --skill miolo-schemas
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: miolo-schemas
Source: https://github.com/afialapis/miolo/tree/main/skills/miolo-schemas
Command: npx skills add https://github.com/afialapis/miolo --skill miolo-schemas

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill provides structured Joi validation schemas and reusable pattern components to enforce consistent input validation across miolo applications.

Core Features & Use Cases

  • Inline and wrapper schemas for routes and database functions, enabling centralized validation logic.
  • Partial schemas (reusable components) from src/server/utils/schema.mjs to promote consistency across modules.
  • Practical examples including route-level validation and database function parameter validation to reduce boilerplate and errors.

Quick Start

Define a Joi object and wrap a handler with with_miolo_schema to validate input before it reaches business logic.

Frequently Asked Questions about miolo-schemas

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce consistent Joi validation across multiple application routes?

You can enforce consistent Joi validation by defining reusable partial schemas and applying them through inline or wrapper schema components across your application routes, centralizing validation logic and reducing boilerplate errors.

How do I validate database function parameters in a Miolo app?

You validate database function parameters in a Miolo app by wrapping functions with the with_miolo_schema wrapper, ensuring Joi schema validation, defaults, and type coercion execute before business logic runs.

Do I need Joi to use reusable schema components in my Miolo application?

Yes, you need Joi installed because the reusable schema components and the with_miolo_schema wrapper depend on it to execute input validation, apply defaults, and enforce type coercion before business logic runs.

How does the with_miolo_schema wrapper handle input validation before business logic?

The with_miolo_schema wrapper intercepts incoming input, applies Joi schema validation, sets defaults, and performs type coercion automatically, ensuring only valid data reaches your core business logic.

Can I reuse partial schemas across different modules in my Miolo project?

Yes, you can reuse partial schemas across different modules in your Miolo project by importing shared reusable components from the server utils schema file, promoting consistency and reducing validation boilerplate.

What limitations exist when using inline schemas versus wrapper schemas for route validation?

Inline schemas provide direct route-level validation, while wrapper schemas using with_miolo_schema offer centralized enforcement of defaults and type coercion before business logic, reducing boilerplate but requiring wrapper integration.