Skip to content

fix(api): v3 TypeScript sdk datetime validation#4728

Merged
tothandras merged 1 commit into
mainfrom
fix/javascript-sdk-schema
Jul 16, 2026
Merged

fix(api): v3 TypeScript sdk datetime validation#4728
tothandras merged 1 commit into
mainfrom
fix/javascript-sdk-schema

Conversation

@tothandras

@tothandras tothandras commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Bug Fixes

    • Timestamp validation now accepts RFC 3339 values with numeric UTC offsets, such as +02:00 and -07:00.
    • Timestamps continue to support standard Z notation and are correctly converted to their corresponding instants.
    • Malformed timestamp values are rejected with validation errors.
  • Tests

    • Added coverage for offset-based, standard, and invalid timestamp formats.

Greptile Summary

This PR allows RFC 3339 numeric offsets in the TypeScript SDK’s strict datetime validation. The main changes are:

  • Emits datetime({ offset: true }) for wire schemas.
  • Regenerates the JavaScript client schema.
  • Tests numeric offsets, Z timestamps, malformed input, and Date conversion.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.
  • The generated schema matches the emitter output.
  • The configured Zod version supports the option, and the strict validation path converts offsets to the correct instant.

Important Files Changed

Filename Overview
api/spec/packages/typespec-typescript/src/zodBaseSchema.tsx Updates wire-mode datetime generation to accept RFC 3339 numeric offsets while keeping the public Date schema unchanged.
api/spec/packages/aip-client-javascript/src/models/schemas.ts Regenerates dateTimeWire with the offset-enabled Zod datetime option.
api/spec/packages/typespec-typescript/templates/tests/validation.spec.ts Adds source conformance tests for offset timestamps, Z, malformed values, and instant conversion.
api/spec/packages/aip-client-javascript/tests/validation.spec.ts Mirrors the template tests in the generated SDK test suite.

Reviews (1): Last reviewed commit: "fix(api): v3 TypeScript sdk datetime val..." | Re-trigger Greptile

Context used (3)

  • Context used - CLAUDE.md (source)
  • Context used - AGENTS.md (source)
  • Context used - api/spec/AGENTS.md (source)

@tothandras tothandras added the release-note/bug-fix Release note: Bug Fixes label Jul 16, 2026
@tothandras
tothandras requested a review from a team as a code owner July 16, 2026 15:12
@tothandras
tothandras enabled auto-merge (squash) July 16, 2026 15:13
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 62fd48a7-746a-424d-b8d9-40c3a1961f49

📥 Commits

Reviewing files that changed from the base of the PR and between 601784b and f8688d5.

📒 Files selected for processing (4)
  • api/spec/packages/aip-client-javascript/src/models/schemas.ts
  • api/spec/packages/aip-client-javascript/tests/validation.spec.ts
  • api/spec/packages/typespec-typescript/src/zodBaseSchema.tsx
  • api/spec/packages/typespec-typescript/templates/tests/validation.spec.ts

📝 Walkthrough

Walkthrough

RFC 3339 wire datetime schemas now accept numeric timezone offsets. Generated template tests and JavaScript client tests verify offset parsing, UTC timestamps, instant conversion, and malformed timestamp rejection.

Changes

RFC 3339 Offset Validation

Layer / File(s) Summary
Wire schema offset support
api/spec/packages/typespec-typescript/src/zodBaseSchema.tsx, api/spec/packages/aip-client-javascript/src/models/schemas.ts
Wire-mode Zod datetime validators now use { offset: true } to accept numeric timezone offsets.
Strict validation coverage
api/spec/packages/typespec-typescript/templates/tests/validation.spec.ts, api/spec/packages/aip-client-javascript/tests/validation.spec.ts
Tests verify numeric offsets and Z timestamps are accepted and converted to correct instants, while malformed values raise ValidationError.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: fixing v3 SDK datetime validation to accept offset timestamps.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/javascript-sdk-schema

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@tothandras
tothandras disabled auto-merge July 16, 2026 15:14
@tothandras
tothandras enabled auto-merge (squash) July 16, 2026 15:15
@tothandras
tothandras merged commit fe22548 into main Jul 16, 2026
29 of 31 checks passed
@tothandras
tothandras deleted the fix/javascript-sdk-schema branch July 16, 2026 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note/bug-fix Release note: Bug Fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants