Repository navigation
Enumerate a collection that is passed as the root object - #86
Merged
Merged
Conversation
The validator never enumerated the root object, so a List passed in directly hid its items and passed, and a root array reported its items through SyncRoot. The specs expect the items at their index with no name in front, such as "[0].Name". Co-Authored-By: Claude Opus 5.5 <[email protected]>
The EnumerateItems flag kept the root from being enumerated, and that was its only effect: an object that a property holds is never a collection here, because a property's collection takes a step of its own in the queue. Remove the flag, so any collection that the walk validates as an object is also enumerated. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
A collection passed to the validator as the root object was never enumerated.
Run(new List<Item> { ... })returned true even when an item was invalid, and a root array reported its items throughSyncRoot, asSyncRoot[0].Name. A caller who validates a list directly got a silent pass.The only job of the
EnumerateItemsflag was to keep the root from being enumerated. A collection that a property holds takes a queue step of its own, so no other object that the walk validates as an object was ever a collection that should skip enumeration. The flag was therefore dead weight, and removing it makes the rule simple: a collection that the walk validates as an object is also enumerated.This is part 1 of 3 small PRs, in this order: root collection (this one), nested class-level error path, instance properties only. The other two stack on this branch.
Summary
[1].Name.EnumerateItemsflag from the work item and the enqueue methods. An array orArrayListas the root now reports[0].Nameand notSyncRoot[0].Name.Test plan
-p:IncludeNetFramework=true)