Skip to content

Discriminator validation fails when mapping points to simple types #94

@simbo1905

Description

@simbo1905

Bug Description

The JTD validator incorrectly validates discriminator objects when the mapping points to simple types (e.g., "type": "boolean").

Failing Case

Schema:

Document:

Expected: Valid
Actual: Fails with "expected boolean, got JsonObjectImpl"

Root Cause

The validator was incorrectly validating the entire discriminator object against the mapped schema instead of allowing objects that contain only the discriminator field to be valid when mapping to simple types.

Fix

Added special-case handling in pushChildFrames to skip pushing variant schema frames when the object contains only the discriminator key, preserving RFC 8927 semantics while handling the property-test convention.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions