Skip to content

Tidy up: make validator and interpreter agree on discriminator tag-only objects (Jtd.java) #181

Open

Description

@simbo1905

Sub-issue 2 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 2 (verbatim from the audit findings file) ==

  1. PR tidy up #101 — Interpreter/recursive validator paths disagree on discriminator variants.
    Author: chatgpt-codex-connector[bot], 2025-09-28. Comment: tidy up #101 (comment)
    Source: json-java21-jtd/src/main/java/json/java21/jtd/Jtd.java#L230-L239. Current: json-java21-jtd/src/main/java/json/java21/jtd/Jtd.java:259-272 (frame path always pushes variant Frame); counterpart special-case only in JtdSchema.java:482-488.
    Flagged: "restore the guard before enqueuing the variant frame or remove the special-case in DiscriminatorSchema.validate so both paths agree".
    Still applies: Jtd.validate() (main API) uses the stack path and always pushes the variant frame (tag-only objects fail for simple-type mappings), while the recursive JtdSchema.validate path short-circuits to success (tag-only objects pass) — the two shipped validation paths still disagree.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions