Skip to content

fix(nestjs-crud): skip CrudContextOverlay on non-CRUD controllers#461

Open
tnramalho wants to merge 1 commit intobtwld:feature/version-8from
tnramalho:fix/crud-context-overlay-skip-non-crud
Open

fix(nestjs-crud): skip CrudContextOverlay on non-CRUD controllers#461
tnramalho wants to merge 1 commit intobtwld:feature/version-8from
tnramalho:fix/crud-context-overlay-skip-non-crud

Conversation

@tnramalho
Copy link
Copy Markdown
Collaborator

Summary

  • CrudContextOverlay (global APP_INTERCEPTOR) was throwing CRUD_CONTEXT_ERROR on any controller without CRUD metadata
  • Normal REST controllers could not coexist with CrudModule.forRoot({}) in the same application
  • Fix: check for CRUD entity metadata before processing context — skip silently if not a CRUD controller

Test plan

  • Added e2e test: plain @Controller with CrudModule.forRoot({}) — verifies 200 response without errors
  • Existing 6 interceptor tests still pass
  • Verified in rockets sample-server: /me (MeController) now works alongside CRUD-generated /pets controller

🤖 Generated with Claude Code

The CrudContextOverlay is registered as a global APP_INTERCEPTOR by
CrudModule.forRoot(). It was throwing CRUD_CONTEXT_ERROR on any
controller that does not have CRUD metadata (@CrudController or
@CrudEntity), making it impossible to have normal REST controllers
coexist with CRUD-generated controllers in the same application.

The fix checks for CRUD entity metadata on the controller before
attempting to resolve the CRUD context. If the controller has no
entity metadata, the interceptor skips silently.

Added e2e tests that register a plain @controller alongside
CrudModule.forRoot({}) and verify it responds 200 without errors.

Also fixed pre-existing markdown lint errors in nestjs-crud,
nestjs-invitation, and nestjs-repository README files.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@docs-page
Copy link
Copy Markdown

docs-page bot commented Apr 9, 2026

To view this pull requests documentation preview, visit the following URL:

docs.page/btwld/nestjs-modules~461

Documentation is deployed and generated using docs.page.

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.

1 participant