Commit 215d07a
committed
fix(openfeature): strict type checking for flag evaluations
Check the requested evaluation type against the flag's declared
variationType before calling mapValue(). Return TYPE_MISMATCH when
they don't match (e.g., STRING flag evaluated as Boolean).
Separately, variant values that don't match their declared type
(e.g., INTEGER flag with string variant value) now return PARSE_ERROR
instead of TYPE_MISMATCH, aligning with Go SDK (dd-trace-go#4590)
and Python's libdatadog behavior.
Type compatibility mapping:
BOOLEAN → Boolean.class
STRING → String.class
INTEGER → Integer.class
NUMERIC → Double.class
JSON → Value.class1 parent 755e6b7 commit 215d07a
File tree
2 files changed
+78
-2
lines changed- products/feature-flagging/feature-flagging-api/src
- main/java/datadog/trace/api/openfeature
- test/java/datadog/trace/api/openfeature
2 files changed
+78
-2
lines changedLines changed: 47 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
343 | 344 | | |
344 | 345 | | |
345 | 346 | | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
346 | 372 | | |
347 | 373 | | |
348 | 374 | | |
349 | 375 | | |
350 | 376 | | |
351 | 377 | | |
352 | 378 | | |
353 | | - | |
| 379 | + | |
354 | 380 | | |
355 | 381 | | |
356 | 382 | | |
| |||
371 | 397 | | |
372 | 398 | | |
373 | 399 | | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
374 | 420 | | |
375 | 421 | | |
376 | 422 | | |
| |||
Lines changed: 31 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
| 291 | + | |
291 | 292 | | |
292 | 293 | | |
293 | 294 | | |
294 | | - | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
295 | 322 | | |
296 | 323 | | |
297 | 324 | | |
| |||
551 | 578 | | |
552 | 579 | | |
553 | 580 | | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
554 | 584 | | |
555 | 585 | | |
556 | 586 | | |
| |||
0 commit comments