Code Generation
APiGen's core strength lies in its ability to generate production-ready code from database schemas or OpenAPI specifications.
Supported Inputs
- SQL Schema:
CREATE TABLEstatements (PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, H2). - OpenAPI / Swagger: YAML or JSON specifications (v3.0+).
- JDL (JHipster Domain Language): Coming soon.
Generation Process
- Parsing: The input is parsed into an internal AST (Abstract Syntax Tree).
- Enrichment: Metadata is added (types, relationships, validation).
- Template Rendering: Jinja2/Mustache templates are rendered for the target language.
- Post-Processing: Code formatting and optimization.
Configuration
Configuration is handled via apigen.yml or CLI arguments.
yaml
project:
groupId: com.example
artifactId: my-api
version: 1.0.0
features:
audit: true
softDelete: true
security: true