Skip to content

Conversation

@Amanbig
Copy link
Owner

@Amanbig Amanbig commented Jan 30, 2026

PR Title

Fix CodeRabbit code quality issues across repository, schema, auth, and core modules


Description

This PR addresses multiple code quality issues identified by CodeRabbit across several modules.

repository.py

  • Replaced deprecated datetime.utcnow() with datetime.now(timezone.utc) for Python 3.12+ compatibility
  • Fixed _to_dict() fallback to safely handle non-Pydantic models using __dict__ instead of failing dict(model) call

schemas.py

  • Added None checks for spec_from_file_location() and spec.loader before use
  • Removed deprecated json_encoders from ConfigDict (Pydantic v2 handles datetime serialization natively)
  • Fixed create_update_model() to properly set field defaults by adding values to the namespace dictionary
  • Added a warning when registering schema short names that shadow existing schemas

auth.py

  • Replaced deprecated datetime.utcnow() with datetime.now(timezone.utc)
  • Changed require_roles() and require_permissions() from async to sync methods
    (they return async checker functions, not coroutines)
  • Fixed get_current_active_user dependency injection that was incorrectly creating new AuthDependencies instances

core.py

  • Fixed module name construction to avoid double dots when prefix is empty (e.g. routes..name)
  • Added None checks for spec_from_file_location() and spec.loader

Related Issue

Closes #13
(Remove or update this line if not applicable)


Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Tests
  • Refactor

How Has This Been Tested?

  • Unit tests (existing 20 tests pass)
  • Manual testing
  • Not tested (explain why)

Checklist

  • My code follows the project style guidelines
  • I have added tests (if applicable)
  • I have updated documentation (if needed)
  • I have linked the related issue

@Amanbig Amanbig merged commit 46c984b into main Jan 30, 2026
10 checks passed
@Amanbig Amanbig deleted the dev branch January 30, 2026 17:38
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