Conversation
…ng with composable validators Signed-off-by: Kenny Pflug <[email protected]>
…T> instead of Check<T> Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
10 tasks
There was a problem hiding this comment.
Pull request overview
This PR completes the child-validation and collection-validation refactor in Light.PortableResults.Validation, introducing explicit child-scope helpers on Check<T> and a unified fluent API for sync/async nested and collection validation, with updated docs/tests/benchmarks to match.
Changes:
- Added
Check<T>child-context helpers and newCheckExtensionsAPIs (ValidateChild*,ValidateItems*) with sync/async parity. - Refactored collection validation semantics to require explicit null-guarding (throw on null unless short-circuited) and added delegate-based + transforming overloads.
- Updated validators, tests, benchmarks, and README/documentation to reflect the new API and semantics.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Light.PortableResults.Validation.Tests/ValidatorTests.cs | Updates existing tests to the new fluent child/item validation APIs and result semantics. |
| tests/Light.PortableResults.Validation.Tests/CheckExtensionsTests.cs | Adds extensive coverage for child/context target ownership, collection semantics, delegate-based item validation, transformations, and async parity. |
| src/Light.PortableResults.Validation/Validator.cs | Switches root validation to use the new child-validation pipeline entry (ValidateChildValue) and makes it public with docs. |
| src/Light.PortableResults.Validation/ValidatedValue.cs | Adjusts nullability annotations for TryGetValue. |
| src/Light.PortableResults.Validation/CheckExtensions.cs | Introduces the new fluent child and collection validation extension methods (sync/async, validator/delegate, transforming overloads). |
| src/Light.PortableResults.Validation/Check.cs | Adds child-context creation helpers and refines target normalization/composition behavior. |
| src/Light.PortableResults.Validation/BaseValidator.cs | Removes legacy child-validation helper methods in favor of CheckExtensions. |
| src/Light.PortableResults.Validation/AsyncValidator.cs | Aligns async validation pipeline with the new child-validation entry and updates XML docs. |
| benchmarks/Benchmarks/ValidationEndpointBenchmarks.cs | Updates benchmark code to compile and use the new child-validation API surface. |
| ai-plans/0028-child-validation-refactoring.md | Adds the completion plan/acceptance criteria and design notes for the refactor. |
| README.md | Adds a “Validation Quick Start” section and updates examples to the new patterns (null-guarding, items/child, async). |
| Light.PortableResults.slnx | Includes the new plan document in solution items. |
| AGENTS.md | Minor phrasing update. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Signed-off-by: Kenny Pflug <[email protected]>
Minimum allowed line rate is |
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.
This pull request completes and documents the child-validation and collection-validation refactoring for the validation package, ensuring a consistent, robust, and easy-to-use API for both synchronous and asynchronous validation scenarios. It introduces new helpers for child context creation, improves collection validation semantics, and updates documentation and usage examples to reflect the new design.
Validation API and Implementation Improvements:
Check<T>to preserve target ownership and normalization state, preventing duplicate path segments in nested validation.List<T>, andImmutableArray<T>.ValidateChildAsyncandValidateItemsAsyncwithValueTaskandCancellationTokensupport [1] [2] [3] [4] [5].Documentation and Example Updates:
README.mdwith a comprehensive "Validation Quick Start" section, including code samples for both synchronous and asynchronous validation flows, and clarified collection validation best practices [1] [2].AsyncValidator.csfor improved clarity and to reflect new method semantics [1] [2] [3].Project and Benchmark Adjustments:
0028-child-validation-refactoring.md) to track the completion criteria, technical details, and rationale for the refactoring [1] [2].Minor Edits and Cleanups:
BaseValidator.cs.These changes collectively make the validation package more consistent, extensible, and easier to use, especially in complex nested and asynchronous scenarios.