Skip to content

Implement JSON Type Definition (JTD) RFC 8927 validator #85

@simbo1905

Description

@simbo1905

Summary

Implement a JSON Type Definition (JTD) validator based on RFC 8927 in the new submodule.

What is JTD?

JSON Type Definition (JTD) is a schema language for JSON designed for:

  • Code generation from schemas
  • Portable validation with standardized error indicators
  • Simpler alternative to JSON Schema with eight mutually-exclusive forms

Implementation Requirements

Based on RFC 8927, the implementation needs to support:

Eight JTD Forms

  1. empty - Validates any JSON value
  2. ref - References a definition in the schema
  3. type - Validates primitive types (boolean, float32/64, int/uint 8/16/32, string, timestamp)
  4. enum - Validates against a set of string values
  5. elements - Validates homogeneous arrays
  6. properties - Validates objects with required/optional fields
  7. values - Validates objects with homogeneous values
  8. discriminator - Validates tagged unions

Key Features

  • Support for definitions (schema reuse)
  • Standardized error reporting with and
  • No 64-bit integers (as per RFC)
  • No nested definitions
  • RFC 8259 JSON compliance

Implementation Plan

  1. Core Types - Create sealed interfaces/records for JTD schema representation
  2. Parser - Parse JSON into JTD schema objects
  3. Validator - Implement validation logic for all eight forms
  4. Error Reporting - Implement standardized error format
  5. Tests - Comprehensive test coverage including RFC examples

Test Requirements

  • Unit tests for each JTD form
  • Integration tests with RFC example schemas
  • Error case testing
  • Performance benchmarks

References

Acceptance Criteria

  • All eight JTD forms implemented and tested
  • Standardized error reporting working
  • RFC example schemas pass validation
  • Performance acceptable for typical use cases
  • Documentation following JEP 467 format
  • Integration with existing json-java21 project structure

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