Repository navigation
webapi-contract: an optional param is present by its own key, not by a sibling it prefixes - #48
Merged
Merged
Conversation
…a sibling it prefixes The presence tests in FromParam (Maybe a, Either a b, lists, Set and MultiSet elements, a sum's constructor) took `submap key kvs`, a raw byte-prefix lookup: `page :: Maybe Int` saw `pageSize=20` as its own params, found no `page` and failed NotFound "page"; `ids :: Maybe [Int]` became `Just []` beside `idsFilter`; `inner :: Maybe Inner` failed NotFound "inner.x" beside `innerMost`. Callers renamed fields to dodge it (zenbridge#2241: `partnerQualifier` for `partnerAddressQualifier`, `multiFileIds` for `fileIds`). subParams key: the key itself and the keys nested under it (`key.`), the top level (the empty key) everything. Tests: the three cases above fail before the change, pass after; round trip unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
The presence tests in
FromParam(Maybe a,Either a b, lists,Set/MultiSetelements, a sum's constructor) usedsubmap key kvs, a raw byte-prefix lookup, so a sibling key the field's name prefixes made the field "present":pageSize=20page :: Maybe IntNotFound "page"NothingidsFilter=5ids :: Maybe [Int]Just []NothinginnerMost=8inner :: Maybe InnerNotFound "inner.x"NothingCallers renamed fields to dodge it (zenbridge#2241:
partnerQualifierforpartnerAddressQualifier,multiFileIdsforfileIds).The change:
subParams keyreturns the key itself plus the keys nested under it (key.). The empty key (the top level) returns everything. The record-selector narrowing (submap pfxinGFromParam (M1 S …)) is unchanged: lookups below it are exact.Branched from 57ea0eb (the commit zenbridge pins;
Param.hsis unchanged on master since then).webapi-contract-test: 30/30 pass. The three cases above fail before the change and pass after. Running the suite on GHC 9.6.7 needsallow-newerfor the test stanza's tasty/hedgehog bounds; those bounds are untouched here.🤖 Generated with Claude Code