v2.2.0
New Features
-
DateTime / Carbon support — Properties typed as
Carbon,CarbonImmutable,DateTime,DateTimeImmutable, or anyDateTimeInterfaceimplementation are now rendered astype: "string", format: "date-time"with ISO 8601 examples. Previously these were incorrectly treated as nested$refobjects. -
Laravel Data
Optionalunion support — Union types containingSpatie\LaravelData\Optional(e.g.,string|Optional) are now handled correctly.Optionalis stripped from the union, the remaining type is used for the schema, and the property is excluded from therequiredarray. This matches Laravel Data's "sometimes" validation behavior for request DTOs. Union order doesn't matter (string|OptionalandOptional|stringboth work). -
Enum defaults in Optional unions —
ExampleEnum|Optionalwith a default value correctly extracts the enum's backing value for the schema default.