feat(canopy): typed schema::VerificationArgs for restore-verification#90
Merged
Conversation
…tion
bestool-canopy 0.4.5 (bestool#628) generates typed request structs from
canopy's OpenAPI at build time. Replace the hand-built serde_json::Value
verification body with the generated schema::VerificationArgs: the field
set is now checked against canopy's spec at compile time.
health_details stays a free-form serde_json::Value (untyped in the spec
by design) carrying { sizes, fixes, restore_duration_sec }; it's sent as
None when nothing was gathered rather than an empty object. observed_at
and outcome are strings per the generated type (outcome mapped to
canopy's lowercase wire form).
Drops the wrapper's dead hand-written restore_verification method and
generalises the sender to restore_verification_typed(impl Serialize),
POSTing via the generic request escape hatch.
Note: bestool-canopy's build.rs fetches canopy's live OpenAPI at build
time and falls back to its committed snapshot when unreachable (e.g.
CI), so this adds typify/ureq build-deps to the tree.
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.
🤖 Follow-up to #88. bestool-canopy 0.4.5 (bestool#628) generates typed
request structs from canopy's OpenAPI at build time, so the
restore-verification body no longer has to be a hand-built
serde_json::Value.Change
bestool_canopy::schema::VerificationArgsand sendthat — the field set is now checked against canopy's spec at compile
time (rename
type→type_,outcome/observed_atas strings, etc.).health_detailsstays a free-formserde_json::Value(it's untyped inthe spec by design), carrying
{ sizes, fixes, restore_duration_sec }.Sent as
Nonewhen nothing was gathered, rather than an empty object.outcomemaps to canopy's lowercase wire form (success/failure);observed_atis RFC3339.restore_verificationmethod; the sender is generalised to
restore_verification_typed(impl Serialize), still POSTing via thegeneric
requestescape hatch.Build note
bestool-canopy's
build.rsfetches canopy's OpenAPI at build time fromits public endpoint (15s timeout) — so CI regenerates against the
live spec and the types track canopy as it evolves; the committed
snapshot is only a fallback for offline / sealed builds. This pulls
typify/ureqinto the build-dependency tree; neededlog/semverto move up a little, no source impact.
Behaviour is otherwise identical to #88 — same endpoint, same fields,
same
health_detailsshape — just typed at the construction site.