Generate Artifacts
Data Models
Generating Data Models from Your API
Vaktum can automatically extract and generate data models from your API definition, providing type definitions that can be used in various programming languages and frameworks.
What are Data Models?
Data models are structured representations of the data objects used in your API, including:
- Request and response schemas
- Data transfer objects (DTOs)
- Entity definitions
- Enumeration types
These models provide developers with a clear understanding of the data structures your API uses and enables type-safe interactions.
Supported Data Model Formats
Vaktum can generate data models in various formats:
- TypeScript Interfaces
- Java Classes
- C# Classes
- Python Classes
- Go Structures
- JSON Schema
- GraphQL Types
- Protocol Buffers (protobuf)
Generating Data Models
Via Vaktum.com
- Navigate to the APIs section of Vaktum.com
- Select your API
- Go to the "Artifacts" tab
- Click "Generate Data Models"
- Select your target language and configuration options
- Click "Generate" to create the data models
- Download the generated model package
Via Vaktum API
Generate data models programmatically using the Vaktum API:
🖥️ Shell
curl -X POST "https://api.vaktum.com/v1/artifacts/models" \
-H "X-API-KEY: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"apiId": "your-api-id",
"language": "typescript",
"options": {
"includeValidators": true,
"generateConstructors": true
}
}'
Data Model Features
Generated data models include:
- Type Definitions: Strongly typed interfaces or classes
- Property Definitions: All properties with their types and descriptions
- Validation Rules: Constraints like min/max values, patterns, and required fields
- Relationships: Associations between different models
- Documentation: Inline documentation from your API specification
Customization Options
When generating data models, you can customize various aspects:
- Naming Conventions: Configure naming styles for classes, properties, etc.
- Validation: Include or exclude validation attributes/annotations
- Serialization: Add serialization metadata for JSON/XML
- Documentation: Control how API documentation is included in the models
- Inheritance: Configure how inheritance and composition are handled
Best Practices
- Regenerate After API Changes: Keep data models in sync with your API definition
- Version Control: Store generated models in your repository for consistency
- Documentation: Use the models as a reference for API documentation