Skip to content

json: require RFC3339 'T' separator in date-time format validator#3116

Merged
jacobmarble merged 1 commit into
masterfrom
jgm-rfc3339
Jul 3, 2026
Merged

json: require RFC3339 'T' separator in date-time format validator#3116
jacobmarble merged 1 commit into
masterfrom
jgm-rfc3339

Conversation

@jacobmarble

Copy link
Copy Markdown
Contributor

Description:

Fixes #3108. The date-time format validator silently drifted lenient when time was bumped 0.3.36 → 0.3.44 (#2302): since time-rs/time#700 the crate's RFC3339 parser accepts any byte as the date/time separator, not just a space. JSON Schema defines format: date-time as the RFC3339 ABNF rule, which permits only T (case-insensitive), so the validator now checks the separator byte explicitly before delegating to time.

Workflow steps:

No workflow change. Strings like 2022-09-11 10:31:25Z are no longer detected or validated as date-time — schema inference stops mistagging mixed-format fields, and existing write schemas declaring format: date-time reject them.

Documentation links affected:

None.

Notes for reviewers:

  • Byte index 10 is safe because RFC3339 full-date is fixed-width; lowercase t stays accepted per ABNF case-insensitivity (consistent with existing lowercase z handling).
  • Regression tests added to the test_format_cases table; cargo test -p json and cargo test -p doc --features combine pass with no snapshot fallout.

Since time 0.3.37 (time-rs/time#700), the crate's RFC3339 parser accepts
any byte as the date/time separator. JSON Schema's date-time format is
defined by the RFC3339 ABNF rule, which permits only 'T' (case-insensitive),
so check the separator explicitly before delegating to the time crate.

Fixes #3108
@jacobmarble jacobmarble marked this pull request as ready for review July 3, 2026 00:22
@jacobmarble jacobmarble requested a review from a team July 3, 2026 00:22

@williamhbaker williamhbaker left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jacobmarble jacobmarble merged commit 8b6aeec into master Jul 3, 2026
9 of 11 checks passed
@jacobmarble jacobmarble deleted the jgm-rfc3339 branch July 3, 2026 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

json: DateTime format validator silently drifted lenient (accepts space separator) via dependency bump, contradicts platform's RFC3339 stance

2 participants