CRUD Schema Command
Thecrud-schema command generates JSON schema and TypeScript interface definitions for a model in your zopio project. This helps ensure type safety and data validation across your application.
Usage
Options
| Option | Description |
|---|---|
-m, --model <name> | Model name |
-f, --fields <fields> | Fields in format “name:type,age:number” |
-o, --output <directory> | Output directory for generated schemas |
-h, --help | Display help for command |
Examples
Generate schema for a User model
Generate schema with a custom output directory
Generated Files
When you run thecrud-schema command, the following files will be generated:
- TypeScript Interface: A TypeScript interface for the model
- JSON Schema: A JSON schema definition for validation
- Schema Utils: Helper functions for working with the schema
Example TypeScript Interface
Example JSON Schema
Related Commands
crud- Generate basic CRUD operationscrud-unified- Generate a complete CRUD setupcrud-validation- Generate validation schemas