Scramble 0.12.x is here! Manual parameter docs, transformers API and more.
Learn more

Releases

Keep up with regular Scramble releases.
Latest versions:
Scramble: v0.12.16
Scramble PRO: v0.7.7
March 2025
Mar 24, 2025
v0.12.16

What’s Changed

  • Fixed uuid model key compatibility with Laravel 12.x by @sbbjss in #785

New Contributors

  • @sbbjss made their first contribution in #785
Mar 22, 2025
v0.12.15

What’s Changed

  • Fixed #[BodyParameter] attribute not adding the information to the parameter by @romalytvynenko in #781
Mar 21, 2025
v0.12.14

Enum cases description

This version adds support for enum case descriptions — a long-requested and highly upvoted feature!

Now, you can add PHPDoc comments above enum cases, and Scramble will use them as enum descriptions:

enum JobStatus: string
{
    /**
     * When the job application is available.
     */
    case OPEN = 'open';

    /**
     * When the job has been closed.
     */
    case CLOSED = 'closed';
}

This will produce the following JSON schema:

{
    "title": "JobStatus",
    "type": "string",
    "enum": ["open", "closed"],
    "description": "|---|---|\n|`open`|When the job application is available.|\n..."
}

If you use OpenAPI rendering solutions that support it, you can use the x-enumDescriptions extension for case descriptions by setting scramble.enum_cases_description_strategy to extension. In this case, the generated JSON schema will look like this:

{
    "title": "JobStatus",
    "type": "string",
    "enum": ["open", "closed"],
    "x-enumDescriptions": {
        "open": "When the job application is available.",
        "closed": "When the job has been closed."
    }
}

Woohoo!

What’s Changed

  • Added enum cases description support by @romalytvynenko in #779
  • Fix wrapping when resource instance is used in JsonResponse explicitly by @romalytvynenko in #778
Mar 18, 2025
v0.7.7 PRO

What’s Changed

  • Added toJson, toArray, and toResponse methods support on data objects
Mar 18, 2025
v0.12.13

What’s Changed

  • Fix model name detection on linebreak crlf by @canyoningdb in #771
  • Added ability to specify the types accepted by specific type by @romalytvynenko in #775
  • Prevent leaking comments from service classes into docs by @romalytvynenko in #776

New Contributors

  • @canyoningdb made their first contribution in #771
Mar 15, 2025
v0.7.6 PRO

This release adds complete only and except support on Laravel Data objects. This includes conditional only and except as well as support for onlyProperties and exceptProperties methods defined in data objects classes.

Consider the following example:

public function show(Company $company)
{
    return CompanyData::from($company)->only('id');
}

Now, Scramble will correctly document that this endpoint returns a structure containing only id property:

{
    "type": "object",
    "properties": {
        "id": {
            "type": "integer"
        }
    },
    "required": [
        "id"
    ]
}

What’s Changed

  • Added only and except support on Laravel Data objects
Mar 15, 2025
v0.12.12

This is a relatively small release, but brings support for long awaited array’s in request root and some inference improvements.

Support for arrays in request body root

Now it it possible to provide validation rules for arrays as request body root:

$request->validate([
    '*.foo' => ['required', 'string'],
    '*.bar' => ['required', 'string'],
]);

Scramble will correctly recognize that request body is an array of objects with foo and bar properties.

Type inference improvements

Now Scramble will be able to infer types originating from typed property calls. This allows you to have a correct documentation for method calls on services you inject into your controller.

// CompanyController.php
<?php

namespace App\Http\Controllers\Api;

use App\CompanyDataFactory;
use App\Http\Controllers\Controller;
use App\Models\Company;

class CompanyController extends Controller
{
    public function __construct(
        private readonly CompanyDataFactory $companyDataFactory,
    ) {}

    /**
     * Get company.
     */
    public function show(Company $company)
    {
        return $this->companyDataFactory->createTerseCompanyData($company);
    }
}

// CompanyDataFactory.php
<?php

namespace App;

use App\Data\CompanyData;

class CompanyDataFactory
{
    public function createTerseCompanyData($model): CompanyData
    {
        return CompanyData::from($model)->only('id');
    }
}

Scramble will correctly document the response from show controller’s method 🔥

What’s Changed

  • Fixed documenting validation rules when it is a root array of objects by @romalytvynenko in #766
  • Type inference improvements: preserving keyed arrays attributes, inference on typed class properties by @romalytvynenko in #769
Mar 15, 2025
v0.7.5 PRO

What’s Changed

  • Fixed breaking change in Laravel Data 4.14 (attributes class was changed)
Mar 9, 2025
v0.12.11

What’s Changed

  • Added option to hide schemas in the navigation by @ferdinandfrank in #747
  • Fixed missing required info when required was used with enum validation rule by @romalytvynenko in #758
  • Added support of date_format rule by @YournameITManoah in #748
  • Fixed handling of methods with different casing and missing methods by @romalytvynenko in #763

New Contributors

  • @YournameITManoah made their first contribution in #748
February 2025
Feb 27, 2025
v0.7.4 PRO

What’s Changed

  • Added Laravel 12.x compatibility
Feb 24, 2025
v0.12.10

What’s Changed

  • Laravel 12.x Compatibility by @laravel-shift in #739

New Contributors

  • @laravel-shift made their first contribution in #739
Feb 18, 2025
v0.7.3 PRO

What’s Changed

  • Fixed filter parameters becoming nested if dot used in a name
Feb 17, 2025
v0.7.2 PRO

What’s Changed

  • Improved exception message when normalizing data type
Feb 17, 2025
v0.12.9

What’s Changed

  • Fix constructor called methods side effects overwriting the type by @romalytvynenko in #740
Feb 12, 2025
v0.12.8

What’s Changed

  • Fixed default parameters extractors for different API versions by @romalytvynenko in #728
Feb 12, 2025
v0.12.7

What’s Changed

  • Added security implementation according OpenAPI 3.1.0 specification by @romalytvynenko in #717
  • Fixed #[PathParameter] to override inferred path parameters by @romalytvynenko in #724
  • Documenting CarbonInterface as date-time string schema by @axelrindle in #700
  • Added support for Symfony\Component\HttpKernel\Exception\* documentation when annotated in exceptions by @phpsa in #674
  • Added date rule support by @romalytvynenko in #725

New Contributors

  • @phpsa made their first contribution in #674
Feb 10, 2025
v0.7.1 PRO

What’s Changed

  • Fix arrays unpacking in arrays passed to ->allow*(...) methods of query builder
Feb 5, 2025
v0.7.0 PRO

What’s Changed

  • Added ability to explicitly name schemas
  • timacdonald/json-api support (simple features) by @romalytvynenko in #40
  • Bump Scramble to 0.12.x by @romalytvynenko in #41
January 2025
Jan 9, 2025
v0.6.24 PRO

What’s Changed

  • Bump Scramble dependency so the Collection is properly supported
Scramble PRO
Comprehensive API documentation generation for Spatie’s Laravel Data and Laravel Query Builder.