Repository navigation
Give a nested error of a whole object the path of the object - #87
Merged
Merged
Conversation
3 of 4 tasks
Base automatically changed from
tgh-20261002-enumerate-root-collection
to
master
October 2, 2026 20:48
A nested result with no member names, such as one from a class-level attribute or IValidatableObject, had no member names once nested, so a caller could not tell which object failed. A null or empty member name gave the path with a dot and nothing after it. The specs expect the path of the object as the only member name, such as "Ranges[0]". Co-Authored-By: Claude Opus 5.5 <[email protected]>
A nested result with no member names now gets the path of the object as its only member name, and a null or empty member name becomes the path alone. Before, the first had no path and the second ended in a dot. MVC keys a model-level error by the model's prefix the same way. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
tgharold
force-pushed
the
tgh-20261002-nested-class-level-error-path
branch
from
October 2, 2026 20:56
f7f755e to
7d4e840
Compare
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 nested error that belongs to a whole object lost its location. Such an error comes from a class-level attribute or from
IValidatableObject.Validatewith no member names. Once the object was nested, the result had no member names, so a caller who maps errors to fields or paths could not tell which object failed. A null or empty member name was worse: it gave the path with a dot and nothing after it, such asValue[0]..The path of the object is the natural member name for these errors, and an error of the root object has no path, so it keeps the names it has. This changes member names that callers might parse, so it is marked BREAKING in the changelog.
This is part 2 of 3 small PRs, in this order: root collection (#86), nested class-level error path (this one), instance properties only. This PR is stacked on #86 and targets its branch, so the diff shows only this change. Merge #86 first. After it merges, GitHub retargets this PR to master.
Summary
RangeorItems[1].Value[0].is nowValue[0]. Named members are unchanged. An error of the root object keeps its member names.Test plan
-p:IncludeNetFramework=true)