ant generate api creates a complete, ready-to-run Flask project from a template or a JSON spec.
Syntax
Arguments
| Argument | Description |
|---|---|
project_name | Name of the directory to create (e.g. my-api, shop) |
Options
| Option | Description |
|---|---|
--json <spec> | JSON string or path to a spec file. Generates routes from the spec. If omitted, only the base template is copied. |
--verbose, -v | Print step-by-step generation progress. No effect in --report mode. |
--dry-run | Validate the spec and show what would be generated — no files are created. |
Examples
Bare scaffold
my-api/ with the full project template and a single default route at GET /.
From a spec file
From an inline JSON string
Validate without generating
With verbose progress
Machine-readable output
What gets generated
Runningant generate api my-api --json api-spec.json creates:
Success output
Error cases
| Error | Cause |
|---|---|
Error: Directory 'shop' already exists. | Project folder already exists |
Error: Template directory '...' does not exist. | CLI installation issue |
JSON validation failed: ... | Spec format error — see validation messages |