FIX: Reword Excluded.OMITTED and add taxonomy sample walkthroughs - #20
Merged
Conversation
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.
Overview
Small wording fix to
Excluded.OMITTED's message, plus new sample code that walks throughpicking the right status for common validation scenarios.
Ticket(s)
N/A
Links(s)
N/A
Example(s)
test2()in the sample app randomly builds one of the 8 status groups and prints both thegroup name and the specific status name, a quick way to see the whole taxonomy in one run.
test3()/validatePhone(...)shows a realistic validation function that picks a differentstatus group depending on why the input failed: bad format (
Invalid), a reserved test value(
Rejected), or a caller-restricted number range (Restricted).Dependencies
None.
Design
Excluded.OMITTED's message changed from "The item was left out." to "Theitem was excluded from the result.", clearer and more consistent with the other
Excludedmembers' phrasing.
OMITTEDstays the first-declared, default member of the group.test2()andtest3()tosample-kotlin'sSampleApp.kt, demonstratingbuilding/matching all 8 status groups and a small
validatePhonefunction that shows how topick between
Invalid,Rejected, andRestricteddepending on the failure reason. Theoriginal
test1()demo (unchanged) is temporarily commented out ofmain()while iteratingon the new examples.
Notes
validatePhone'sRestrictedcase is keyed off an explicitcallerparameter (defaults to"guest"), sinceRestrictedis about who's asking, not what value they passed in, an earlierdraft used
Restrictedfor a value-based rule, which didn't quite fit; this version ties it toan actual identity/permission check instead.
Pending
n/a
Tests
No unit tests added, this is sample/demo code. Verified via
./gradlew :kiit-codes:jvmTestand:samples:sample-kotlin:compileKotlin, both pass.