Skip to content

Enhance Mongoose Schema Extraction Functionality #2

@abmercy035

Description

@abmercy035

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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions