feat: per-entity http flag to suppress the generated controller (#93)#94
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #93.
Adds a per-entity
httpflag (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
httpresolves to false (entity.http ?? <top-level http> ?? true), the generator:TypeOrmModule.forFeature([Entity])+ the service provider/exports (so@InjectRepositoryand the service stay available);*.controller.ts/*.controller.spec.tsfiles 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-levelhttpdefault (types, parser,GeneratorConfig).generate.tscomputes the effective flag per entity, skipsgenerateController, and passesincludeControllertogenerateModule.module-rest.etaconditionalizes the controller import +controllers: [].http.Verification
http: falseentity generates entity/service/DTOs/module (withforFeature+ service, no controller import /controllers:), while a default entity keeps its controller.🤖 Generated with Claude Code