You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/migrating-v2.md
+12-8Lines changed: 12 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Scribe 2: What's new, and how to migrate
2
2
3
-
Scribe 2 comes with a bunch of changes focused on making the documentation process easier and the output nicer. There aren't many "shiny" changes, mostly improvements to what works. For the most part, you won't need to do much work. We've marked required changes in the list below with a "Migration Required" label.
3
+
Scribe 2 comes with a bunch of changes focused on making the documentation process easier and the output nicer. There aren't many "shiny" changes, mostly improvements to what works. We've marked required changes in the list below with a "Migration Required" label.
4
4
5
5
This is also a release announcement for Scribe for JS! [Version 1 has now been released]()!🎉
6
6
@@ -9,14 +9,18 @@ This is also a release announcement for Scribe for JS! [Version 1 has now been r
9
9
:local:
10
10
```
11
11
12
+
Start by upgrading the package version in your composer.json to `^2.0` and running `composer update knuckleswtf/scribe`. Next, make a copy of your config file before publishing the new one (`php artisan vendor:publish --tag=scribe-config`). Then, when you're done applying the changes described here, copy in any custom config for your setup.
13
+
12
14
## Changes in the output
13
15
14
16
### "Try It Out": interactive documentation with (probably) zero config ⚡💥
15
17
Big news: Your docs will now include a "Try t Out" button that allows users to test out an endpoint, right from their browser.
16
18
17
19

18
20
19
-
To enable this, set `interactive` to true. Don't forget to enable CORS headers in your API! Here's the [full doc](./generating-documentation.html#configuring-interactive-documentation).
21
+
To enable this, set `interactive` to true. Don't forget to enable CORS headers for your domain in your API! Here's the [full doc](./generating-documentation.html#configuring-interactive-documentation).
22
+
23
+
**Note**: If you've published the views previously, you may need to re- publish them to get the included "Try It Out" functionality.
20
24
21
25
### Object fields are now represented better in the docs
22
26
Object fields are now wrapped in a `<details>` element, so you can expand the dropdown to see fields within an object. This way, it's clearer that these are subfields within a parent.
@@ -27,7 +31,7 @@ Object fields are now wrapped in a `<details>` element, so you can expand the dr
27
31
## Changes to the config file
28
32
29
33
### Specify the default auth status of endpoints with `auth.default`
30
-
Previously, if you had an API with all endpoints authenticated, you had to set `auth.enabled` to true, AND use `@authenticated` on every endpoint. Pain in the ass. Now you can mark all endpoints as authenticated, by setting `auth.default` to true (don't forget to set `uaht.enabled` to true as well). You can also remove auth from specific endpoints with `@unauthenticated`.
34
+
Previously, if you had an API with all endpoints authenticated, you had to set `auth.enabled` to true AND use `@authenticated` on every endpoint. Pain in the ass. Now you can mark all endpoints as authenticated, by setting `auth.default` to true (don't forget to set `auth.enabled` to true as well). You can also remove auth from specific endpoints with `@unauthenticated`.
In 1.6.0, we added a `description` config item, where you can add a description of your API. This field is used as the `info.description` field in the Postman collection and OpenAPI spec, and as the first paragraph under the "Introduction" section on the docs webpage, before the `intro_text`. We've now removed `postman.description`.
@@ -90,17 +94,17 @@ Previously, you couldn't specify types for URL and query parameters. The idea wa
90
94
- In custom strategies: Update any custom strategies you've written so they return a `type` field for each URL and query parameter
When you use `laravel` type docs and have `add_routes` set to `true`, you get three routes added to your Laravel app: one for the webpage, one for the Postman collection and one for the OpenAPI spec. The route for the Postman collection was previously `/docs.json`, but has now been renamed to `/docs.postman`, to bring it in line with the OpenAPI route, which is `/docs.openapi`.
99
+
93
100
### `@responseFile` supports other directories
94
101
You can now specify a file located anywhere on your machine with `@responseFile`. The file path can either be an absolute path, a path relative to your project root, or a path relative to the Laravel storage directory.
When you use `laravel` type docs and have `add_routes` set to `true`, you get three routes added to your Laravel app: one for the webpage, one for the Postman collection and one for the OpenAPI spec. The route for the Postman collection was previously named `scribe.json`, but has now been renamed to `scribe.postman`, to bring it in line with the OpenAPI route, which is named `scribe.openapi`.
98
-
99
103
### Postman base URL now uses Postman variables
100
-
Postman collection base URL now uses a `{{baseUrl}}` variable, so you can change the base URL for all endpoints in your collection easier.
104
+
Postman collection base URL now uses a `{{baseUrl}}`Postman variable, so you can easily change the base URL for all endpoints in your collection from within Postman.
101
105
102
106
### [Migration Required] Plugin API changes: include 'name' in parameter details
103
-
This only applies if you have custom strategies. All strategies that return URL, query or body parameters or response fields must now include the name of the field as a `name` field in the returned array. This means that the parameter name is going to be mentioned twice in the result from the strategy:
107
+
This only applies if you have created any custom strategies. All strategies that return URL, query or body parameters or response fields must now include the name of the field as a `name` field in the returned array. This means that the parameter name is going to be mentioned twice in the result from the strategy:
0 commit comments