Repository navigation
v0.1.0-Beta.5 🚀
Pre-releaseWelcome to v0.1.0-beta.5 of the ZCore Framework! This release represents a significant architectural evolution, centering on Engineered Simplicity (KISS). We have deprecated complex, reflection-based configuration variables and brittle runtime hacks, replacing them with standard Object-Oriented patterns, native Pydantic V2 integrations, and cleaner dependency structures.
🚀 Core Features & Enhancements
🛡️ Unified Schema Security (Zchema)
We have completely overhaulled our data pruning and shielding mechanisms. Previously, data masking was handled globally in the web layer via a generic resource.* prefix, which was prone to namespace collisions.
- The
ZchemaClass: All schemas now inherit fromZchema(extendingBaseModel). - Domain-Specific Namespacing: You now define a class-level
__db_name__attribute (e.g.,__db_name__ = "user"). - 3-Tier Protection:
Zchemahandles security natively within Pydantic boundaries:- Dynamic Schemas (
?schema=true): Automatically prunes restricted fields from the exposed JSON Schema. - Input Filtering: Automatically strips restricted fields from incoming payloads, defending against Mass Assignment.
- Response Pruning: Automatically masks fields during serialization.
- Dynamic Schemas (
🚦 Template Method Service Hooks
To guarantee that business-critical pre_ and post_ lifecycle hooks and transaction boundaries are never skipped, we separated orchestration from execution.
- Custom Database Operations: Developers now override dedicated
on_create,on_update, andon_deletecallback hooks instead of overriding the publiccreate()orchestrator. - The orchestrator guarantees that validation, hooks, and transaction commits (
_safe_commit) are executed in the exact correct order.
🔗 FastAPI-Native Route Dependencies
We have conceptually renamed the routing security layer from "Permissions" to "Dependencies", matching FastAPI's design.
- Removed 8 static class variables (
DEFAULT_PERMISSIONS,POST_PERMISSIONS, etc.). - Introduced a single, elegant factory method:
get_route_dependencies(self, route_key: RouteKey, action: str) -> list[Any]. - Developers can now use standard Python inheritance and
super()to customize specific endpoints while maintaining default scopes for others.
📦 Robust Modular Monolith Imports
Resolved ModuleNotFoundError across nested modules (such as importing from shared/ within modules/identity/) using a 3-layer approach:
- CLI: Auto-injects the root into
PYTHONPATHduringzc run. - Runtime: Bootstraps
sys.pathdynamically at the top ofmain.py. - IDE: Generates
PYTHONPATH=.in.envto eliminate warning lines in VSCode/PyCharm.
⚠️ Breaking Changes & Migration Guide
1. Schema Base Class Update
You must replace BaseModel with Zchema and define __db_name__ on your schemas.
- Old:
from pydantic import BaseModel class UserResponse(BaseModel): email: str
- New:
from zcore import Zchema class UserResponse(Zchema): __db_name__ = "user" email: str
2. Router Security Configuration
Static permission variables have been deprecated. Move your custom security logic to the new factory method.
- Old:
class ProductRouter(BaseRouter): DEFAULT_PERMISSIONS = "AUTO" DELETE_PERMISSIONS = [AdminOnly()]
- New:
class ProductRouter(BaseRouter): def get_route_dependencies(self, route_key: RouteKey, action: str): if route_key == RouteKey.DELETE: return [AdminOnly()] return super().get_route_dependencies(route_key, action)
3. Service Overrides
If you previously overrode create, update, or delete directly, move that database logic to the corresponding on_ hook.
- Old:
async def create(self, schema: ProductCreate): return await self.repository.create(schema)
- New:
async def on_create(self, schema: ProductCreate) -> Product: return await self.repository.create(schema)