Skip to content

fix: remove deleted schemas from dynamic routes and OpenAPI#237

Open
dcermak wants to merge 1 commit into
masterfrom
remove-deleted-schemas
Open

fix: remove deleted schemas from dynamic routes and OpenAPI#237
dcermak wants to merge 1 commit into
masterfrom
remove-deleted-schemas

Conversation

@dcermak

@dcermak dcermak commented Jan 16, 2026

Copy link
Copy Markdown
Contributor

Previously, when a schema was deleted, its corresponding API routes (/entity/{slug}) remained active and visible in the OpenAPI documentation until the application was restarted. This change updates the dynamic router logic to immediately remove routes associated with a deleted schema and prevents them from being registered during startup.

Changes:

  • backend/dynamic_routes.py: Updated create_dynamic_router to skip route creation and strictly remove existing routes if schema.deleted is True
  • backend/general_routes.py: Updated delete_schema to inject the Request object and trigger create_dynamic_router after deletion to ensure immediate cleanup
  • backend/tests/test_deleted_schema_routes.py: Added regression tests ensuring routes return 404 and vanish from OpenAPI specs upon schema deletion

This fixes #236

)

Previously, when a schema was deleted, its corresponding API
routes (/entity/{slug}) remained active and visible in the OpenAPI documentation
until the application was restarted. This change updates the dynamic router
logic to immediately remove routes associated with a deleted schema and prevents
them from being registered during startup.

Changes:
- backend/dynamic_routes.py: Updated create_dynamic_router to skip route
  creation and strictly remove existing routes if schema.deleted is True
- backend/general_routes.py: Updated delete_schema to inject the Request object
  and trigger create_dynamic_router after deletion to ensure immediate cleanup
- backend/tests/test_deleted_schema_routes.py: Added regression tests ensuring
  routes return 404 and vanish from OpenAPI specs upon schema deletion
@dcermak dcermak force-pushed the remove-deleted-schemas branch from a83fe09 to d040ac4 Compare January 16, 2026 13:57
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.

API shows deleted schemas in the openapi schema and responds to the route

1 participant