Skip to content

v2.2.0

Choose a tag to compare

@hcuadra811 hcuadra811 released this 08 Apr 01:45
· 68 commits to main since this release

New Features

  • DateTime / Carbon support — Properties typed as Carbon, CarbonImmutable, DateTime, DateTimeImmutable, or any DateTimeInterface implementation are now rendered as type: "string", format: "date-time" with ISO 8601 examples. Previously these were incorrectly treated as nested $ref objects.

  • Laravel Data Optional union support — Union types containing Spatie\LaravelData\Optional (e.g., string|Optional) are now handled correctly. Optional is stripped from the union, the remaining type is used for the schema, and the property is excluded from the required array. This matches Laravel Data's "sometimes" validation behavior for request DTOs. Union order doesn't matter (string|Optional and Optional|string both work).

  • Enum defaults in Optional unionsExampleEnum|Optional with a default value correctly extracts the enum's backing value for the schema default.