Skip to content

docs: clarify ValidationStrategy object behavior#415

Merged
DMartens merged 2 commits intomainfrom
test/validation-strategy-object-behavior
Mar 25, 2026
Merged

docs: clarify ValidationStrategy object behavior#415
DMartens merged 2 commits intomainfrom
test/validation-strategy-object-behavior

Conversation

@Pixel998
Copy link
Copy Markdown
Contributor

Prerequisites checklist

AI acknowledgment

  • I did not use AI to generate this PR.
  • (If the above is not checked) I have reviewed the AI-generated content before submitting.

What is the purpose of this pull request?

To make the current ValidationStrategy contract explicit in tests. In particular, object and object? currently accept any non-null object values, including arrays and other object instances such as Date, and that behavior was not clearly covered before.

What changes did you make? (Give an overview)

Added unit tests showing that ValidationStrategy.object() and ValidationStrategy["object?"]() accept arrays and Date instances.

Related Issues

Closes #404

Is there anything you'd like reviewers to focus on?

Comment thread packages/object-schema/tests/validation-strategy.test.js Outdated
@DMartens
Copy link
Copy Markdown

DMartens commented Mar 25, 2026

Changes except the pre-existing test description LGTM, thanks.
Maybe we should also add a note to the descriptions in the README.md as I would also have assumed that only plain objects are allowed.

@Pixel998 Pixel998 changed the title test: clarify ValidationStrategy object behavior docs: clarify ValidationStrategy object behavior Mar 25, 2026
@eslint-github-bot eslint-github-bot Bot added the documentation Improvements or additions to documentation label Mar 25, 2026
@Pixel998
Copy link
Copy Markdown
Contributor Author

I updated the README to make it clear that object and object? are not limited to plain objects.

Copy link
Copy Markdown
Member

@nzakas nzakas left a comment

Choose a reason for hiding this comment

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

LGTM. Would like @DMartens to verify before merging.

@nzakas nzakas moved this from Needs Triage to Second Review Needed in Triage Mar 25, 2026
@DMartens
Copy link
Copy Markdown

Changes LGTM, thanks.

@DMartens DMartens merged commit b281abb into main Mar 25, 2026
32 checks passed
@DMartens DMartens deleted the test/validation-strategy-object-behavior branch March 25, 2026 21:53
@github-project-automation github-project-automation Bot moved this from Second Review Needed to Complete in Triage Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore documentation Improvements or additions to documentation

Projects

Status: Complete

Development

Successfully merging this pull request may close these issues.

Bug: ValidationStrategy.object() accepts arrays

3 participants