Skip to content

Conversation

@LeanderCS
Copy link
Owner

@LeanderCS LeanderCS commented Sep 28, 2025

…n more direct

Summary by Bito

This pull request introduces significant enhancements to the declarative methods, input validation, and documentation within the Flask InputFilter library. Key improvements include refined condition handling, updated syntax for filters and validators, and comprehensive documentation updates to guide users effectively. Additionally, a suite of unit tests has been added to ensure robustness and prevent potential errors.

Copilot AI review requested due to automatic review settings September 28, 2025 21:00
@sonarqubecloud
Copy link

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request modernizes the flask-inputfilter library by introducing new declarative functions to replace the old attribute-based configuration approach. The main purpose is to provide a cleaner, more direct way to define input filter components while maintaining backward compatibility.

Key changes include:

  • Replaces attribute-based declarations (_conditions, _global_filters, etc.) with function-based declarations
  • Adds TypedDict compatibility improvements with fallback mechanisms
  • Improves model serialization with better field filtering
  • Updates documentation to reflect the new declarative approach

Reviewed Changes

Copilot reviewed 52 out of 53 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/validators/test_is_typed_dict_validator.py Adds TypedDict compatibility with import fallbacks for Python 3.7 support
tests/input_filter/test_mixed_api.py Updates imports and replaces attribute declarations with declarative functions
tests/input_filter/test_input_filter.py Removes deprecated test method for serialize functionality
tests/input_filter/test_decorator_input_filter.py Updates to use new declarative API functions and removes old attribute style
tests/filters/test_to_typed_dict_filter.py Adds TypedDict compatibility with proper fallback handling
tests/declarative/*.py New comprehensive test files for all declarative decorators
pyproject.toml Version bump to 0.7.2
flask_inputfilter/ Core implementation updates for new declarative functions and improved inheritance
docs/ Extensive documentation updates to reflect new API
examples/ Updates example code to use new declarative functions

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

from typing import TYPE_CHECKING, Any, Optional, Union

from .field_descriptor import FieldDescriptor
from flask_inputfilter.declarative import FieldDescriptor
Copy link

Copilot AI Sep 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This creates a circular import since this file is part of the flask_inputfilter.declarative module. It should import from .field_descriptor or use a relative import.

Suggested change
from flask_inputfilter.declarative import FieldDescriptor
from .field_descriptor import FieldDescriptor

Copilot uses AI. Check for mistakes.
@LeanderCS LeanderCS changed the title Add more declaratives to prevent possible errors and make constructio… Add more declaratives to prevent possible errors and make construction more direct Sep 28, 2025
Repository owner deleted a comment from Copilot AI Sep 28, 2025
Repository owner deleted a comment from Copilot AI Sep 28, 2025
@LeanderCS LeanderCS merged commit 093d149 into main Sep 28, 2025
8 checks passed
@LeanderCS LeanderCS deleted the more-declaratives branch September 28, 2025 21:11
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.

2 participants