You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Tidy up: gate discriminator-only short-circuit to simple-type variants (JtdSchema.java) #180
Sub-issue 1 of 26 from the 2026-11-21 bot-review-comment audit. Parent issue: #179 (Bot review comment tidy up).
Audited origin/main HEAD: 2e5cf37. Audit date: 2026-11-21.
== Finding 1 (verbatim from the audit findings file) ==
PR Fix discriminator validation for simple type mappings #95 — Ungated discriminator-only special-case bypasses required-property validation.
Author: chatgpt-codex-connector[bot], 2025-09-28. Comment: Fix discriminator validation for simple type mappings #95 (comment)
Source: json-java21-jtd/src/main/java/json/java21/jtd/JtdSchema.java:566. Current: json-java21-jtd/src/main/java/json/java21/jtd/JtdSchema.java:482-488 (DiscriminatorSchema.validate special-case; no rename, line drift only).
Flagged: "shortcut returns success whenever a discriminator object contains only the discriminator key, regardless of what schema the key maps to... skips validation for all mappings, weakening schema enforcement and violating RFC 8927 semantics for object variants". Suggested: gate to simple-type variants.
Still applies: current code still does if (obj.asMap().size() == 1 && obj.asMap().containsKey(disc)) return Result.success() unconditionally, so {"kind":"circle"} is accepted even when the mapping variant declares required properties. TestRfc8927 only exercises the shortcut with a variant that has no required properties.
Activity