Laravel 13.x: Multi-Type-Unions in Illuminate\JsonSchema
Illuminate\JsonSchema kann nun Schemas mit einem Array als type (z. B. ['string', 'number', 'boolean']) abbilden, die zuvor eine Exception auslösten, und bietet dafür auch JsonSchema::union().
Pull request by @pushpak1300
Illuminate\JsonSchema can now represent multi-type union schemas - schemas where the type field is an array like ['string', 'number', 'boolean']. This comes up frequently with third-party MCP tool schemas where mixed types are common. Previously these would throw an exception; now they deserialize, serialize, and round-trip correctly.
// Now works where it used to throw
JsonSchema::fromArray(['type' => ['string', 'number', 'boolean']]);
// Or build one directly
JsonSchema::union(['string', 'number'])->nullable();