Skip to content

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 TABLE statements (PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, H2).
  • OpenAPI / Swagger: YAML or JSON specifications (v3.0+).
  • JDL (JHipster Domain Language): Coming soon.

Generation Process

  1. Parsing: The input is parsed into an internal AST (Abstract Syntax Tree).
  2. Enrichment: Metadata is added (types, relationships, validation).
  3. Template Rendering: Jinja2/Mustache templates are rendered for the target language.
  4. 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

Released under the MIT License.