Skip to content

Fix missing validation issues in error for empty input - #4

Merged
cowboyd merged 1 commit into
mainfrom
validation-error-fix
Mar 12, 2026
Merged

cowboyd merged 1 commit into
mainfrom
validation-error-fix

Conversation

@cowboyd

@cowboyd cowboyd commented Mar 5, 2026

Copy link
Copy Markdown
Collaborator

Motivation

When a field received no input at all and failed validation, the error was missing the validation issues because the source was only pushed to the sources array on the success path. This made it hard to understand why a configuration was rejected.

Approach

Move sources.push(source) before the ok check so validation issues are always included in the error, even when no input is provided. Added a test to verify the error message contains the expected validation issue.

When a required field had no sources at all (no CLI args, env vars, or
defaults), the "none" source was not added to the sources array before
constructing the ValidationError, resulting in an empty error message.
@cowboyd
cowboyd requested review from jbolda March 5, 2026 20:29
@cowboyd
cowboyd merged commit 149c811 into main Mar 12, 2026
2 of 3 checks passed
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.

2 participants