Skip to content

fix(product): allow explicit false for generated boolean fields (from #83) - #94

Merged
zeekay merged 1 commit into
mainfrom
g6/product-bool-false
Nov 25, 2026
Merged

zeekay merged 1 commit into
mainfrom
g6/product-bool-false

Conversation

@zeekay

@zeekay zeekay commented Nov 25, 2026

Copy link
Copy Markdown
Member

Rebases and lands fork PR #83 onto current main (resolving formatting/line drift in src/commands/product/) with full Rust test and clippy verification.

Changes

  • Switch generated scalar Ty::Bool arguments in field_arg from ArgAction::SetTrue to ArgAction::Set with num_args(0..=1), default_missing_value("true"), and clap::value_parser!(bool).
  • Read scalar booleans via m.get_one::<bool>(f.id).copied().map(Value::Bool) so omitted flags stay absent while explicit false is sent to update endpoints.
  • Add unit test covering omitted, bare --enabled, --enabled --name ..., --enabled true/false, and --enabled=true/false.

Verification

  • cargo test --locked commands::product::: 49 passed, 0 failed (including every_coordinate_parses_and_dispatches_to_its_own_route)
  • cargo clippy --locked --all-targets -- -D warnings: 0 warnings
  • rustfmt --edition 2021 --check: clean

Supersedes #83 (with full attribution to @DivyamTalwar).

Keep bare `--flag` spelling for true while accepting explicit `--flag true`,
`--flag false`, `--flag=true`, and `--flag=false` on generated scalar
boolean fields. Omitted optional booleans remain absent from the JSON body,
preserving server defaults.

Co-authored-by: Divyam Talwar <[email protected]>

Co-authored-by: Hanzo Dev <[email protected]>
@zeekay
zeekay merged commit e877562 into main Nov 25, 2026
@zeekay
zeekay deleted the g6/product-bool-false branch November 25, 2026 10:32
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.

1 participant