#scrambledrop: Scramble 0.13.46
Published
Laravel Boost integration, documentation dev tools, more accurate Eloquent and API Resource schemas, and cleaner OpenAPI 3.1 output.
Since the 0.13.34 post, Scramble has shipped twelve patch releases through v0.13.46. This post covers the changes you’ll notice most in your API documentation workflow.
Upgrade:
composer require dedoc/scramble:^0.13.46One upgrade detail deserves attention: v0.13.43 changes how some schemas are serialized. The resulting OpenAPI document remains valid, but generated clients may change. See Cleaner OpenAPI 3.1 schemas below.
Laravel Boost integration for AI-assisted development
Scramble works best when the Laravel application is the source of truth for the API contract. Validation rules describe requests; resources, model types, and return values describe responses. An agent adding an endpoint should work with those types and then check what Scramble actually generated.
Starting in v0.13.44, Scramble integrates with Laravel Boost. Boost installs Scramble’s guidelines and the scramble-development skill alongside its other Laravel guidance. The skill helps agents avoid redundant schema annotations and verify their changes against the generated OpenAPI document.
If you use Boost, run its installer again and enable both guidelines and Agent Skills:
php artisan boost:installFor example, after changing a couple of endpoints, the agent can export just those named routes and inspect their contracts:
php artisan scramble:export \ --routes=users.show,users.update \ --stdout \ --fail-on-unknownThat gives the agent the actual parameters, response schemas, status codes, and diagnostics instead of leaving it to guess what the generated documentation contains. See AI-assisted development for the full setup and workflow (#1272, #1275).
Find documentation problems in the UI
When a schema does not look right, finding the cause can take longer than fixing it. Scramble now surfaces generation errors and warnings in a dev tools bar inside the documentation viewer (v0.13.42). Open the bar to see the issues and guidance for resolving them.
The bar appears by default when APP_DEBUG is enabled. You can control it with SCRAMBLE_DEV_TOOLS or the scramble.dev_tools.enabled configuration flag. v0.13.40 made generation warnings more actionable, and v0.13.45 improved the source snippets shown for issues (#1126, #1255, #1276).
For a check outside the browser, you can still run:
php artisan scramble:analyze --fail-on-unknownMore accurate Eloquent and API Resource schemas
Several releases improved how Scramble follows models into their JSON responses. v0.13.36 added analysis of eager-loaded relationships in JSON resources, inferred nullable relationships from foreign key columns, and added support for custom casts and PHPDoc property types (#1188, #1225, #1227, #1057).
This matters when a resource includes a relationship only if it was loaded, or when a model attribute gets its API-facing value from a cast. Scramble can use more of the information already in the model and resource, so the generated schema is closer to the response your application returns.
The same stretch of releases fixed nullable JSON resources and fields that were incorrectly marked required (v0.13.36). Resource collection responses now preserve pagination metadata (v0.13.41), and mixed Scout and Eloquent queries receive better pagination documentation (v0.13.39). v0.13.46 adds model accessor support and fixes type inference across chained calls. These changes are especially useful for projects that rely on inferred response schemas rather than maintaining them by hand.
Cleaner OpenAPI 3.1 schemas
v0.13.43 removes additionalItems from fixed-length array schemas. That keyword is not part of the JSON Schema version used by OpenAPI 3.1, and validators such as Redocly rejected documents containing it. Tuple length remains constrained by minItems and maxItems (#1264).
Simple unions now use a JSON Schema type array. For example, string|int becomes:
{ "type": ["string", "integer"] }Previously, Scramble emitted an anyOf with a branch for each type. It still uses anyOf when a branch has constraints such as enum or const. An int|float union becomes {"type":"number"}, since JSON Schema considers integers a subset of numbers (#1269).
These are valid OpenAPI 3.1 schemas, and they usually render the same in the documentation UI. If you generate client code from your spec, review the spec diff and regenerated clients when upgrading. Code generators may handle type arrays and anyOf differently.
Other notable changes
- Storage downloads are inferred as binary streamed responses (
v0.13.39, #1245). - PHP’s
#[Deprecated]attribute is supported (v0.13.39, #1246). - The
distinctvalidation rule emitsuniqueItemsfor arrays (v0.13.38, #1240). - Arithmetic, string concatenation, and
cloneexpressions have more accurate inferred types (v0.13.43, #1267). - Scramble PRO received fixes for Laravel Data collections, lazy and recursive properties, and Query Builder parameters. See the release notes for individual PRO versions.
Full changelog: Scramble releases.
Thanks!
Thanks to everyone who contributed fixes and improvements across these releases. Give Scramble 0.13.46 a try and let me know what you think. If you have questions, ideas, or suggestions, feel free to drop me a line at roman@dedoc.co.