Skip to content

fix(java, swift): reject invalid calendar dates - #3521

Open
schani wants to merge 3 commits into
fix/swift-lowercase-rfc3339from
fix/swift-calendar-validation
Open

fix(java, swift): reject invalid calendar dates#3521
schani wants to merge 3 commits into
fix/swift-lowercase-rfc3339from
fix/swift-calendar-validation

Conversation

@schani

@schani schani commented Sep 7, 2026

Copy link
Copy Markdown
Member

Java and Swift date parsers normalized impossible calendar dates such as 2023-02-29 and 1900-02-29 instead of rejecting them. Use strict Java parsing and compare Swift's parsed date components with the input so both languages reject rollovers while retaining valid leap dates.

Swift date helpers are emitted only when generated types use dates. Shared invalid-calendar cases 9 and 11 exercise both fixes in this PR.

Production diffs:

  • Java strict parsing: 15 lines
  • Swift validation and output scoping: 24 lines

Validation:

  • baseline accepts cases 9 and 11; fixed Java and both Swift Foundation paths reject them
  • full Java/schema-Java fixtures: 145/145 pass
  • full Swift fixtures: 252/252 pass
  • build and lint pass

@schani
schani force-pushed the fix/php-invalid-date-time branch from a6a5f5a to f5f8445 Compare September 7, 2026 18:02
@schani
schani force-pushed the fix/swift-calendar-validation branch from 9b79b9f to d196c03 Compare September 7, 2026 18:02
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

Generated-output differences

374 files differ — 374 modified, 0 new, 0 deleted
4488 changed lines — +4488 / −0

Open the generated-output report →

@schani
schani changed the base branch from fix/php-invalid-date-time to fix/java-strict-calendar September 7, 2026 18:36
@schani
schani force-pushed the fix/swift-calendar-validation branch from d196c03 to 2360350 Compare September 7, 2026 18:36
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

Generated-output differences

374 files differ — 374 modified, 0 new, 0 deleted
4488 changed lines — +4488 / −0

Open the generated-output report →

@schani

schani commented Sep 8, 2026

Copy link
Copy Markdown
Member Author

This should not change every generated output. Only those that actually have those date types!

@schani
schani force-pushed the fix/java-strict-calendar branch from 3c3d4d6 to 5e404d2 Compare September 8, 2026 01:04
@schani
schani force-pushed the fix/swift-calendar-validation branch from 2360350 to 248d262 Compare September 8, 2026 01:05
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

Generated-output differences

374 files differ — 374 modified, 0 new, 0 deleted
4488 changed lines — +4488 / −0

Open the generated-output report →

@schani

schani commented Sep 8, 2026

Copy link
Copy Markdown
Member Author

Scoped the date parsing helpers to outputs whose type graph contains dates. Added a unit test covering helper presence for date-time output and absence from unrelated output. The complete fix is 24 production lines and has been approved.

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

Generated-output differences

37 files differ — 37 modified, 0 new, 0 deleted
444 changed lines — +444 / −0

Open the generated-output report →

@schani
schani force-pushed the fix/java-strict-calendar branch from 5e404d2 to 02215b0 Compare September 8, 2026 02:47
@schani
schani force-pushed the fix/swift-calendar-validation branch from d6c6d18 to 655d656 Compare September 8, 2026 02:47
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

Generated-output differences

37 files differ — 37 modified, 0 new, 0 deleted
444 changed lines — +444 / −0

Open the generated-output report →

@schani
schani changed the base branch from fix/java-strict-calendar to fix/swift-lowercase-rfc3339 September 8, 2026 03:06
@schani
schani force-pushed the fix/swift-calendar-validation branch from 655d656 to f46fd23 Compare September 8, 2026 03:06
@schani schani changed the title fix(swift): reject invalid calendar dates fix(java, swift): reject invalid calendar dates Sep 8, 2026
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

Generated-output differences

675 files differ — 675 modified, 0 new, 0 deleted
4340 changed lines — +2426 / −1914

Open the generated-output report →

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.

1 participant