Skip to content

chore(validator): refactor types#175

Merged
imdhemy merged 15 commits into
koala-ts:2.xfrom
EmanFateen:refactor-types
May 14, 2026
Merged

chore(validator): refactor types#175
imdhemy merged 15 commits into
koala-ts:2.xfrom
EmanFateen:refactor-types

Conversation

@EmanFateen
Copy link
Copy Markdown
Contributor

Q A
License GPLv3
Issue Closes #<issue_number>

@EmanFateen EmanFateen requested a review from imdhemy as a code owner May 14, 2026 12:49
@EmanFateen EmanFateen marked this pull request as draft May 14, 2026 12:49
@EmanFateen EmanFateen changed the title Refactor types validator: refactor types May 14, 2026
@EmanFateen EmanFateen marked this pull request as ready for review May 14, 2026 14:32
@EmanFateen EmanFateen changed the title validator: refactor types chore(validator): refactor types May 14, 2026
@imdhemy imdhemy requested a review from Copilot May 14, 2026 14:32
Copy link
Copy Markdown
Contributor

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 PR refactors the validator module’s type definitions by splitting the former types.ts into more focused type modules (payload, schema, constraint, constraint-validator, violation) and updates the validator/middleware/constraints to use the new type locations.

Changes:

  • Introduces new dedicated type modules (violation, payload, schema, constraint, constraint-validator) and removes src/validator/types.ts.
  • Moves createValidator implementation into src/validator/factory/create-validator.ts and updates middleware/constraints/tests to use the refactored type structure.
  • Updates the validator public entrypoint exports (src/validator/index.ts) to reflect the new module layout.

Reviewed changes

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

Show a summary per file
File Description
src/validator/violation.ts New standalone Violation type.
src/validator/validator.ts Now only defines the Validator function type using new type modules.
src/validator/types.ts Removes the previous consolidated types module.
src/validator/schema.ts Introduces FieldSchema/ValidationSchema types for schema DSL.
src/validator/payload.ts New standalone Payload type.
src/validator/middleware/create-validation-middleware.ts Updates middleware to accept ValidationSchema and new type imports.
src/validator/middleware/create-validation-middleware.test.ts Updates test imports to new type modules.
src/validator/index.ts Adjusts public exports to new module structure and factory entrypoint.
src/validator/flatten-violations.ts Updates Violation import path.
src/validator/flatten-violations.test.ts Updates Violation import path in tests.
src/validator/factory/create-validator.ts New home for validator creation + schema normalization logic.
src/validator/factory/create-validator.test.ts Updates test imports to new type modules and paths.
src/validator/constraints/string/slug.ts Updates imports to new constraint/violation types.
src/validator/constraints/string/slug.test.ts Updates test type imports to new modules.
src/validator/constraints/string/email.ts Updates imports to new constraint/violation types.
src/validator/constraints/string/email.test.ts Updates test type imports to new modules.
src/validator/constraints/other/compound.ts Renames/retargets nested “rules” typing to FieldSchema.
src/validator/constraints/other/compound.test.ts Updates test imports to new type modules.
src/validator/constraints/other/compound.integration.test.ts Updates createValidator import path.
src/validator/constraints/basic/not-blank.ts Updates imports to new constraint/violation types.
src/validator/constraints/basic/not-blank.test.ts Updates test type imports to new modules.
src/validator/constraint.ts Adds ConstraintOptions and ConstraintSchema types.
src/validator/constraint-validator.ts Adds ConstraintContext/ConstraintValidator types (and nested schema typing).

Comment thread src/validator/index.ts
Comment thread src/validator/factory/create-validator.ts
Comment thread src/validator/index.ts
@imdhemy imdhemy merged commit c5318d6 into koala-ts:2.x May 14, 2026
1 check passed
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.

3 participants