Skip to content

Refactor integer validation to use pydantic conint for simple constraints #1246

@coderabbitai

Description

@coderabbitai

Description

Consider refactoring integer fields with simple constraints (like >0) to use pydantic's conint instead of manual validators for cleaner, more declarative validation.

Context

During review of PR #1234, it was suggested to use conint(gt=0) instead of manual validators for the rate_limit_max field in the WebUi class. This pattern could be applied to other similar fields throughout the codebase.

Examples of fields that could benefit

  • rate_limit_max in WebUi class (components/clp-py-utils/clp_py_utils/clp_config.py)
  • retention_period fields with >0 constraints
  • Other integer fields with simple positive value constraints

Benefits

  • More declarative validation
  • Cleaner code by removing manual validators
  • Consistent validation approach across the codebase

References

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions