Repository navigation
Add tuple overloads for Choice and System One questions - #5
Merged
Merged
Conversation
Nested Dictionary initializers made the common Choice and SystemOne call sites much noisier than Score's params form. Accept labeled pairs at those call sites, convert them to maps, and keep dictionaries as the stored/wire representation. Co-authored-by: Darío Kondratiuk <dariokondratiuk@gmail.com>
The tuple call-site overloads are a minor API addition. Raise MinVerMinimumMajorMinor so untagged packs are 0.2.0-preview.* until v0.2.0 is tagged on main. Co-authored-by: Darío Kondratiuk <dariokondratiuk@gmail.com>
kblok
marked this pull request as ready for review
September 20, 2026 19:04
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.
Yes — for the call sites. Nested
Dictionary<string, object?>/Dictionary<string, Question>initializers were the noisy part compared toQuestion.Score’sparamsform. Tuples belong at those construction sites, not as the stored model: Choice criteria and answers are maps on the wire, andGetChoice("name")still needs named lookup.What changed
Convenience overloads convert labeled pairs into dictionaries (duplicate keys throw
TypeSafeException):Question.Choice(instructions, params (string Label, object? Description)[])client.SystemOneAsync(state, params (string Name, Question Question)[])(andWithResponse)Question.Map(...)when you still need a dictionary (model, options,CancellationToken, orSystemOneRequest.Questions)Existing dictionary overloads are unchanged.
ChoiceQuestion.CriteriaremainsIReadOnlyDictionary<string, object?>.Noul criteria stay a small type (
NoulCriteria.Yes/.Noomit a side on the wire); a 2-tuple would lose that. JSON DTOs are also unchanged.Version
MinVerMinimumMajorMinoris now0.2, so untagged packs are0.2.0-preview.*. After merge, tagv0.2.0onmainto publish the stable package (per CONTRIBUTING).