Skip to content

Adds fix for chaining text prompt validations and tests#1973

Closed
akinsmosu wants to merge 2 commits into
spectreconsole:mainfrom
akinsmosu:allow-validate-chaining
Closed

Adds fix for chaining text prompt validations and tests#1973
akinsmosu wants to merge 2 commits into
spectreconsole:mainfrom
akinsmosu:allow-validate-chaining

Conversation

@akinsmosu

Copy link
Copy Markdown

fixes #1742

  • [ x] I have read the Contribution Guidelines
  • [x ] I have commented on the issue above and discussed the intended changes
  • A maintainer has signed off on the changes and the issue was assigned to me
  • [ x] All newly added code is adequately covered by tests
  • [ x] All existing tests are still running without errors
  • [ x] The documentation was modified to reflect the changes OR no documentation changes are required.

Changes

This PR updates Validate overloads on TextPromptExtensions to short‑circuit based on the ValidationResult.Successful value in order to allow chaining of calls to the Validate method.

Modified file: src/Spectre.Console/Prompts/TextPromptExtensions.cs — both Validate<T>(Func<T,bool>, string?) and Validate<T>(Func<T,ValidationResult>) updated.

Tests added: src/Spectre.Console.Tests/Prompts/TextPromptExtensionsTests.cs — verifies chaining, registration order, and short‑circuit behavior for both overloads.

@patriksvensson

Copy link
Copy Markdown
Contributor

Hi!

Thanks so much for taking the time to submit this PR.
I really appreciate the contribution!

Unfortunately, I haven’t had the capacity to review this in a timely manner, and since it was opened, the repository has changed significantly. Because of that, this PR is no longer in a state where it can be reviewed or merged as-is. This is not your fault, but mine, and I'm sorry about this.

I’m going to close it for now to help keep things tidy. That said, if you’re still interested in contributing, please feel free to open a new pull request that’s up to date with the current state of the repository, and I’ll be happy to take a look when I can. I'll promise I'll do better this time around.

Thanks again for your work and for your interest in the project!

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.

TextPrompt.Validate does not chain

2 participants