Fireorm is tightly coupled with class-validator for model validation. To provide flexibility, we should allow the use of arbitrary validation libraries. This would involve decoupling Fireorm from class-validator and introducing a validation interface that can accommodate various validation libraries.
Steps to Reproduce
Attempt to use a validation library other than class-validator with Fireorm.
Notice the tight coupling with class-validator and the difficulty in substituting another library.
Expected Behavior
Ability to use any validation library with Fireorm by providing a custom validator through the initialization options.
Actual Behavior
Fireorm is tightly coupled with class-validator, making it challenging to use other validation libraries.
Acceptance Criteria
Introduce a validation interface that supports various validation libraries.
Modify the initialization options to accept a custom validator.
Ensure backward compatibility with the current class-validator usage.
Add unit tests to validate the functionality with different validation libraries.
Additional Context
March 16, 2022: Initial proposal to support arbitrary validation libraries.
March 16, 2022: Agreement on the idea and suggestion to use a type parameter for the validation errors.
March 17, 2022: Discussion about the tight coupling with class-validator and the complexity of decoupling.
Proposed API Changes
Introduce Validation Interface:
Define a validation interface to support various validation libraries.
Description
Fireorm is tightly coupled with
class-validator
for model validation. To provide flexibility, we should allow the use of arbitrary validation libraries. This would involve decoupling Fireorm fromclass-validator
and introducing a validation interface that can accommodate various validation libraries.Steps to Reproduce
class-validator
with Fireorm.class-validator
and the difficulty in substituting another library.Expected Behavior
Ability to use any validation library with Fireorm by providing a custom validator through the initialization options.
Actual Behavior
Fireorm is tightly coupled with
class-validator
, making it challenging to use other validation libraries.Acceptance Criteria
class-validator
usage.Additional Context
class-validator
and the complexity of decoupling.Proposed API Changes
Introduce Validation Interface:
Update Initialization Options:
Decouple Fireorm from class-validator:
class-validator
.Unit Tests:
Example Implementation
Original Issue