Currently, our Mongoose schema extraction (extractRulesFromSchema) supports basic schema types and validations, but there are several Mongoose-specific features that we could better support.
Problem to Solve:
The current implementation doesn't fully capture all Mongoose validation options, custom validators, and nested schema structures.
Acceptance Criteria:
- Support for Mongoose's
validate function with custom error messages
- Better handling of nested schemas and subdocuments
- Support for Mongoose's
match regex validation
- Support for Mongoose's
enum with custom error messages
- Handle Mongoose's
unique property (as a warning, since it's not a validation rule)
- Support for array validation with
of type specification
- Add tests for all new extraction features
Implementation Suggestions:
- Extend the
extractRulesFromSchema function to recursively process nested schemas
- Add special handling for Mongoose's
validate function to convert it to a custom validator
- Map Mongoose's regex patterns to appropriate validation rules
Labels: enhancement, mongoose, schema-extraction
Currently, our Mongoose schema extraction (
extractRulesFromSchema) supports basic schema types and validations, but there are several Mongoose-specific features that we could better support.Problem to Solve:
The current implementation doesn't fully capture all Mongoose validation options, custom validators, and nested schema structures.
Acceptance Criteria:
validatefunction with custom error messagesmatchregex validationenumwith custom error messagesuniqueproperty (as a warning, since it's not a validation rule)oftype specificationImplementation Suggestions:
extractRulesFromSchemafunction to recursively process nested schemasvalidatefunction to convert it to a custom validatorLabels:
enhancement,mongoose,schema-extraction