This repository was archived by the owner on Aug 29, 2026. It is now read-only.
feat(0.2.1): reflect advanced Clap argument relationships - #13
Closed
zerosnacks wants to merge 4 commits into
Closed
zerosnacks wants to merge 4 commits into
zerosnacks wants to merge 4 commits into
Conversation
zerosnacks
marked this pull request as ready for review
August 19, 2026 15:53
zerosnacks
marked this pull request as draft
August 19, 2026 15:54
zerosnacks
marked this pull request as ready for review
August 19, 2026 16:09
zerosnacks
commented
Aug 19, 2026
Comment on lines
+165
to
+166
| # Temporary until clap-rs/clap#6494 is merged and released. | ||
| clap = { git = "https://github.com/zerosnacks/clap", rev = "2883a7f13718bb4c3cf0456cf831176d20a2ae14", version = "4.6.6", default-features = false, features = ["std"] } |
zerosnacks
commented
Aug 19, 2026
Comment on lines
+54
to
+56
| allow-git = [ | ||
| "https://github.com/zerosnacks/clap", # Temporary for clap-rs/clap#6494 | ||
| ] |
zerosnacks
commented
Aug 19, 2026
| let facade = repository_root().to_string_lossy().replace('\\', "/"); | ||
| let manifest = format!( | ||
| "[package]\nname = \"clap_schema-ui-{fixture}\"\nversion = \"0.0.0\"\nedition = \"2024\"\npublish = false\n\n[dependencies]\nclap = {{ version = \"4.6.6\", features = [\"derive\"] }}\nclap_schema = {{ path = \"{facade}\" }}\n" | ||
| "[package]\nname = \"clap_schema-ui-{fixture}\"\nversion = \"0.0.0\"\nedition = \"2024\"\npublish = false\n\n[dependencies]\nclap = {{ git = \"https://github.com/zerosnacks/clap\", rev = \"2883a7f13718bb4c3cf0456cf831176d20a2ae14\", version = \"4.6.6\", features = [\"derive\"] }}\nclap_schema = {{ path = \"{facade}\" }}\n" |
2 tasks done
Member
Author
|
Per clap-rs/clap#6497 (comment) it has been decided that the reflection API clap_schema relies on is not intentionally exposed, will not be expanded and it is unlikely that a breaking release will offer the functionality we rely on during migration. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
This PR completes the advanced argument relationship reflection deferred from
clap_schema0.2.0.It builds on the 0.2 invocation contract by exposing additional Clap semantics that affect whether a constructed invocation is valid, without changing the meaning of the existing 0.2 fields.
Relationship reflection
The contract now additionally exposes:
These relationships are reflected from Clap's built command model rather than inferred through synthetic parsing.
Argument and group targets are represented by their stable Clap IDs so consumers can reason about relationships independently of display names or aliases.
Conditional defaults retain Clap's value-source semantics: values originating only from defaults do not satisfy
defaultIfpredicates. For group targets, equality predicates compare against the stable ID of the selected member.Argument groups
Groups are now retained not only when they directly constrain cardinality, but also when referenced by another representable relationship.
Group requirements and conflicts are surfaced alongside membership, requiredness, and multiplicity.
Compatibility
This is an additive update to the 0.2 contract.
The new relationship properties are optional, and the 0.2 wire-format compatibility rules require consumers to tolerate additional optional fields. Existing 0.2.0 fields retain their meaning.
Dependency
This functionality depends on the read-only relationship reflection APIs introduced by clap-rs/clap#6494.
Edit: upstream PR has been closed, ticket has been opened for discussion: clap-rs/clap#6497