Commit fb9fcce
Cameron Custer
Fix subscription usage union selection bug for grouped responses
Add CustomMatcher support to apijson union system to properly handle
subscription usage responses where grouped and ungrouped variants both
match gjson.JSON TypeFilter.
The issue was that both SubscriptionUsageGroupedSubscriptionUsage and
SubscriptionUsageUngroupedSubscriptionUsage used identical TypeFilter
values, causing incorrect variant selection based on ordering rather
than content.
Solution:
- Extended UnionVariant with CustomMatcher function field
- Modified union decoder to check CustomMatcher before TypeFilter
- Used CustomMatcher to detect presence of metric_group field in data
- Ensures grouped responses select grouped variant, ungrouped select ungrouped
Fixes: Analytics functionality that depends on GroupBy parameter
Affects: All grouped usage requests in subscription usage API
Versions: Confirmed broken in v1.4.1 through v1.18.01 parent 120f8d3 commit fb9fcce
3 files changed
+21
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
222 | 234 | | |
223 | 235 | | |
224 | 236 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
13 | 16 | | |
14 | 17 | | |
15 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5277 | 5277 | | |
5278 | 5278 | | |
5279 | 5279 | | |
5280 | | - | |
5281 | | - | |
| 5280 | + | |
| 5281 | + | |
| 5282 | + | |
| 5283 | + | |
| 5284 | + | |
5282 | 5285 | | |
5283 | 5286 | | |
5284 | 5287 | | |
5285 | | - | |
| 5288 | + | |
5286 | 5289 | | |
5287 | 5290 | | |
5288 | 5291 | | |
| |||
0 commit comments