-
-
Notifications
You must be signed in to change notification settings - Fork 0
✨ add EncodeOptions.commaCompactNulls
#49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughA new Changes
Sequence DiagramsequenceDiagram
participant caller as Caller
participant qs as qs.kt
participant encoder as Encoder
participant list as List Processing
caller->>qs: encode(data, options{commaCompactNulls=true})
qs->>qs: Check if listFormat == COMMA
qs->>encoder: encode(..., commaCompactNulls=true)
encoder->>encoder: isCommaGenerator = true
encoder->>list: Materialize list items
alt commaCompactNulls enabled
list->>list: Filter null entries
list->>encoder: Filtered items
else
list->>encoder: All items (including nulls)
end
encoder->>encoder: Join with commas
alt joined result is non-empty
encoder->>encoder: Emit single "value" entry
else
encoder->>encoder: Emit Undefined
end
encoder-->>qs: Encoded result
qs-->>caller: Return encoded string
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (6)
🧰 Additional context used📓 Path-based instructions (4)README.md📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
qs-kotlin/src/main/kotlin/**/*.kt📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
**/*.kt📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
qs-kotlin/src/test/kotlin/**/*Spec.kt📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
🧠 Learnings (11)📓 Common learnings📚 Learning: 2025-10-08T06:50:18.291ZApplied to files:
📚 Learning: 2025-10-08T06:50:18.291ZApplied to files:
📚 Learning: 2025-10-08T06:50:18.291ZApplied to files:
📚 Learning: 2025-10-11T11:03:27.899ZApplied to files:
📚 Learning: 2025-10-08T06:50:18.291ZApplied to files:
📚 Learning: 2025-10-08T06:50:18.291ZApplied to files:
📚 Learning: 2025-10-08T06:50:18.291ZApplied to files:
📚 Learning: 2025-10-08T06:50:18.291ZApplied to files:
📚 Learning: 2025-10-08T06:50:18.291ZApplied to files:
📚 Learning: 2025-10-08T06:50:18.291ZApplied to files:
🧬 Code graph analysis (2)qs-kotlin/src/test/kotlin/io/github/techouse/qskotlin/unit/QsParserSpec.kt (2)
qs-kotlin/src/main/kotlin/io/github/techouse/qskotlin/internal/Encoder.kt (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
🔇 Additional comments (13)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #49 +/- ##
============================================
- Coverage 95.39% 95.05% -0.34%
- Complexity 441 444 +3
============================================
Files 15 15
Lines 1237 1255 +18
Branches 265 272 +7
============================================
+ Hits 1180 1193 +13
- Misses 9 11 +2
- Partials 48 51 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This pull request adds support for more flexible handling of
nullvalues in comma-separated lists during query string encoding. It introduces a newcommaCompactNullsoption to theEncodeOptionsmodel, allowing users to dropnullentries from lists when using the comma format. The implementation ensures that single-element lists can still round-trip correctly and that the new option is thoroughly tested.Feature enhancements: Comma-separated list encoding
commaCompactNullsoption toEncodeOptions, enabling the encoder to dropnullentries from lists when usingListFormat.COMMA. This results in more compact query strings and allows omitting keys when all values are stripped. [1] [2] [3] [4] [5]Encoder.ktto respect thecommaCompactNullsflag, filter outnullvalues from lists, and adjust key generation and round-trip marker handling accordingly. [1] [2] [3] [4] [5] [6] [7]Testing and documentation
QsParserSpec.ktto cover the newcommaCompactNullsbehavior, including edge cases like omitting keys and preserving round-trip markers.EncodeOptionsSpec.ktto verify correct copying and builder behavior for the new option. [1] [2] [3] [4] [5]README.mdto describe the new options and their effects on encoding behavior.Summary by CodeRabbit
New Features
commaCompactNullsoption: drops null entries from comma-separated lists before encoding.commaRoundTripoption: enables comma-separated list round-tripping support.Documentation
Tests