API Versioning

Enforces semantic versioning on endpoints based on the X-API-Version header using the @version decorator.

Constraint Syntax

Supports standard comparison operators: >=, <=, >, <, ==, !=.

routes/api.py
from jec_api.decorators import version

class Api(Route):
    # Available for version 1.0.0 and above
    @version(">=1.0.0")
    async def get(self):
        return {"v": 1}
        
    # Replaced in version 2.0.0
    @version("<2.0.0")
    async def post(self):
        return "Legacy Endpoint"

Need strict version enforcement, deprecation headers, or sunset dates? Check the Advanced Usage guide.