Schema API Reference
Schemas in Dubhe Engine define the data structure and validation rules for components, providing type-safe data modeling for your blockchain applications.Schema Configuration
Basic Schema Definition
Supported Data Types
| Type | Move Type | Description | Example |
|---|---|---|---|
u8 | u8 | 8-bit unsigned integer | 255 |
u16 | u16 | 16-bit unsigned integer | 65535 |
u32 | u32 | 32-bit unsigned integer | 4294967295 |
u64 | u64 | 64-bit unsigned integer | 18446744073709551615 |
u128 | u128 | 128-bit unsigned integer | Large numbers |
bool | bool | Boolean value | true, false |
address | address | Sui address | 0x123... |
string | String | UTF-8 string | "Hello World" |
vector<T> | vector<T> | Dynamic array | [1, 2, 3] |
option<T> | Option<T> | Optional value | Some(value) or None |
Schema Generation API
CLI Commands
Programmatic API
Component Schema API
Component Definition
Field Types
Advanced Schema Features
Nested Structures
Enumerations
Constraints and Validation
Schema Migration
Version Management
Migration Functions
TypeScript Type Generation
Generated Types
Type Utilities
Schema Validation
Runtime Validation
Custom Validators
Best Practices
Schema Design Guidelines
- Keep schemas simple - Avoid overly complex nested structures
- Use appropriate types - Choose the smallest type that fits your data
- Plan for growth - Design schemas with future features in mind
- Version carefully - Use migration scripts for breaking changes
- Validate early - Implement validation at the schema level
Performance Considerations
Next Steps
Smart Contracts
Learn to implement schema-based contracts
Client SDK
Use generated types in your frontend