Skip to content

feat: per-entity http flag to suppress the generated controller (#93)#94

Merged
cultron merged 3 commits into
mainfrom
feat/http-controller-flag
Jun 15, 2026
Merged

feat: per-entity http flag to suppress the generated controller (#93)#94
cultron merged 3 commits into
mainfrom
feat/http-controller-flag

Conversation

@cultron

@cultron cultron commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Closes #93.

Adds a per-entity http flag (with optional top-level default) that suppresses the generated HTTP controller for an entity while keeping everything else — so a hand-written controller can own the route without a collision with the generated CRUD.

{ "name": "Product", "http": false, "fields": [ /**/ ] }

When http resolves to false (entity.http ?? <top-level http> ?? true), the generator:

  • still emits the entity, service, DTOs, and module — the module keeps TypeOrmModule.forFeature([Entity]) + the service provider/exports (so @InjectRepository and the service stay available);
  • omits the controller: it doesn't generate the *.controller.ts/*.controller.spec.ts files and drops the controller import + controllers: [] entry from the module.

REST only — GraphQL uses resolvers, so the flag doesn't apply there.

Changes

  • Entity.http + top-level http default (types, parser, GeneratorConfig).
  • generate.ts computes the effective flag per entity, skips generateController, and passes includeController to generateModule.
  • module-rest.eta conditionalizes the controller import + controllers: [].
  • MCP schema reference documents http.

Verification

  • E2E: an http: false entity generates entity/service/DTOs/module (with forFeature + service, no controller import / controllers:), while a default entity keeps its controller.
  • Build clean · lint 0 errors · jest 16/16 in the generator suite, 184 total (excl. pre-existing pglite/migrate).

Note: merging to main auto-publishes a new @apso/cli (the push-to-main release workflow).

🤖 Generated with Claude Code

cultron and others added 2 commits June 14, 2026 20:53
Add a per-entity `http` flag (with optional top-level default; effective value
`entity.http ?? <top-level http> ?? true`). When false, the generator still emits
the entity, service, DTOs, and module (TypeOrmModule.forFeature + service) but
omits the controller — neither generating the controller file nor wiring it into
`controllers: []` — so a hand-written controller can own the route without a
collision. REST only (GraphQL uses resolvers). Docs in the MCP schema reference.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The Python (FastAPI) and Go (Gin) generators wire routers differently and don't
honor includeController yet; gating the controller skip to typescript keeps the
flag a safe no-op for them (controllers still generated) instead of emitting
broken wiring. Tracked separately.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…PI no-op)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@cultron
cultron merged commit 7b116b0 into main Jun 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: per-entity flag to suppress the generated HTTP controller (keep entity/service/DTO)

1 participant