Scramble Docs
#scrambledrop: Scramble 0.6.0

#scrambledrop: Scramble 0.6.0

January 6, 2023

Added error responses support, resource collections support, and improved type inference.

Hey Laravel community!

Really happy to announce a new version of Scramble. Scramble is Laravel API docs generator that generates doc without requiring you to write PHPDoc annotations: https://scramble.dedoc.co/introduction.

0.6.0 is out: https://github.com/dedoc/scramble/releases/tag/v0.6.0

Here are few cool things added in this release.

Error responses support

Starting from this version Scramble documents not only OK responses, but error ones as well. It works by analyzing exceptions that can possibly happen during code execution. For example, if you do some validation, Scramble knows that ValidationException can happen, so it documents it as possible 422 response.

Calls to authorize and route model binding will be documented as corresponding error responses as well.

Simply calling authorize in contoller’s method will result in 403 error response documentation in you API docs.
Simply calling authorize in contoller’s method will result in 403 error response documentation in you API docs.

Resources collections support

Resource collections are useful concept that allows to return a collection of resources from the controller. From this version Scramble is able to correctly understand and document them. Also this feature brings an improvement in understanding of how resources are wrapped in response.

Notice how adding additional data is documented as well.
Notice how adding additional data is documented as well.

Improved type inferring

Now Scramble understands that true and false are boolean 🫣 This is a small thing but important one. It allows to understand the code better, hence new things can be added on top of it. For example, when you return true from authorize method of custom FormRequest, Scramble will understand that your endpoint won’t return 403 response.

Other fixes

  • Added literals support to PHPDoc types in #59
  • Fixed an error that happened when combining responses with empty body and the same status in #60
  • Fixed flawed path param aliasing to the var name #63
Share
Hosted docs
Beautiful and searchable documentation for your API, seamlessly integrated with CI.