Skip to content

Make validator serialization a first-class feature#118

Open
srivastava-diya wants to merge 2 commits into
hyperjump-io:mainfrom
srivastava-diya:feature/first-class-validator-serialization
Open

Make validator serialization a first-class feature#118
srivastava-diya wants to merge 2 commits into
hyperjump-io:mainfrom
srivastava-diya:feature/first-class-validator-serialization

Conversation

@srivastava-diya
Copy link
Copy Markdown
Contributor

Description

Resolves #112

This PR introduces a first-class, high-level API for validator serialization, allowing users to cleanly serialize and restore validators without interacting directly with the low-level AST.

Changes included:

  • Attached a .serialize() method directly to the validator function returned by validate().
  • Added a new restoreValidator(json) API that deserializes the AST and reconstructs the validator by resolving its evaluation plugins.
  • Added a test suite (lib/restore-validator.spec.ts) to ensure the high-level API behaves correctly.

Copy link
Copy Markdown
Collaborator

@jdesrosiers jdesrosiers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Please add documentation to the README.

@srivastava-diya
Copy link
Copy Markdown
Contributor Author

Just pushed the README updates. Let me know if we need any other changes.

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.

Make validator serialization a first-class feature

2 participants