feat: allow required variadic flags - #21
Merged
Merged
Conversation
Closes bcdxn#20 Co-Authored-By: Claude <noreply@anthropic.com>
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The Yargs test assertion does not reliably verify the required generated action contract.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
Allows flags to be both required and variadic, updating validation, schemas, and Yargs coverage.
Changes:
- Permit required variadic flags.
- Update all schema copies.
- Add validation and Yargs generator tests.
| File | Summary |
|---|---|
web/src/spec.schema.json |
Documents required variadic flags. |
validate/validate.go |
Removes the conflicting validation rule. |
validate/validate_test.go |
Adds positive validation coverage. |
validate/spec.schema.json |
Updates validator schema documentation. |
spec.schema.json |
Updates canonical schema documentation. |
gen/cli_yargs_variadic_test.go |
Tests required variadic Yargs output; its assertion should verify the exact generated required contract. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
bcdxn
self-requested a review
September 24, 2026 02:31
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Owner
|
merged. Thanks again @bhouston! |
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.

Closes #20
A flag can now be both
required: trueandvariadic: true, meaning it must be supplied at least once and accepts multiple values. This matches YargsdemandOptionon array options, Commander mandatory variadic options, and oclifrequired + multiple. Arguments already allowed this combination.Changes
validate: remove the rule rejectingrequiredon variadic flags.spec.schema.json(and the copies invalidate/andweb/src/): document thatrequiredandvariadicmay be combined, and thatminItems/maxItemsconstrain values when the flag is supplied.type: "array"withdemandOption: true.No generator changes were needed. Yargs already demands required flags regardless of arity; cobra and urfave-cli do not currently enforce required flags at all, so they are unaffected.
go generate ./...andgo test ./...pass.