Skip to content

Commit

Permalink
doc: update readme, add migration guide
Browse files Browse the repository at this point in the history
  • Loading branch information
DenTray committed Oct 14, 2024
1 parent 719a451 commit b0336c1
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 32 deletions.
11 changes: 11 additions & 0 deletions MIGRATION-GUIDES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# 3.0.1-beta

As package starting to work with new Open API specification, need to regenerate documentation file.

The base namespace of the package had also been changed, so you need to use new namespace in:

- `bootstrap\app.php` (`Http/Kernel.php` for Laravel <= 10), change namespace of
`\RonasIT\Support\AutoDoc\Http\Middleware\AutoDocMiddleware::class` to
`\RonasIT\AutoDoc\Http\Middleware\AutoDocMiddleware::class`;
- `tests/TestCase.php`, change namespace of `\RonasIT\Support\AutoDoc\Tests\AutoDocTestCaseTrait` to
`\RonasIT\AutoDoc\Tests\AutoDocTestCaseTrait`;
2 changes: 1 addition & 1 deletion config/auto-doc.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,5 +184,5 @@
'development',
],

'config_version' => '2.7',
'config_version' => '2.8',
];
80 changes: 49 additions & 31 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,37 +30,51 @@ passing PHPUnit tests.

1. Install the package using the following command: `composer require ronasit/laravel-swagger`

> ***Note***
>
> For Laravel 5.5 or later the package will be auto-discovered.
> For older versions add the `AutoDocServiceProvider` to the
> providers array in `config/app.php` as follow:
>
> ```php
> 'providers' => [
> // ...
> RonasIT\AutoDoc\AutoDocServiceProvider::class,
> ],
> ```
1. Run `php artisan vendor:publish`
2. Add `\RonasIT\AutoDoc\Http\Middleware\AutoDocMiddleware::class` middleware to the global HTTP middleware stack in `Http/Kernel.php`.
3. Add `\RonasIT\AutoDoc\Tests\AutoDocTestCaseTrait` trait to `tests/TestCase.php`
4. Configure documentation saving using one of the next ways:
- Add `SwaggerExtension` to the `<extensions>` block of your `phpunit.xml`.
**Please note that this way will be removed after updating**
**PHPUnit up to 10 version (https://github.com/sebastianbergmann/phpunit/issues/4676)**
```xml
<extensions>
<extension class="RonasIT\AutoDoc\Tests\PhpUnitExtensions\SwaggerExtension"/>
</extensions>
<testsuites>
<testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
</testsuites>
```
- Call `php artisan swagger:push-documentation` console command after
> ***Note***
>
> For Laravel 5.5 or later the package will be auto-discovered.
> For older versions add the `AutoDocServiceProvider` to the
> providers array in `config/app.php` as follow:
>
> ```php
> 'providers' => [
> ...
> RonasIT\AutoDoc\AutoDocServiceProvider::class,
> ],
> ```
2. Run `php artisan vendor:publish --provider=RonasIT\\AutoDoc\\AutoDocServiceProvider`
1. Add `\RonasIT\AutoDoc\Http\Middleware\AutoDocMiddleware::class` middleware to the global HTTP middleware list `bootstrap\app.php`:
```php
return Application::configure(basePath: dirname(__DIR__))
->withMiddleware(function (Middleware $middleware) {
$middleware->use([
...
\RonasIT\AutoDoc\Http\Middleware\AutoDocMiddleware::class,
]);
});
```
4. Add `\RonasIT\AutoDoc\Tests\AutoDocTestCaseTrait` trait to `tests/TestCase.php`
1. Configure documentation saving using one of the next ways:
- Add `SwaggerExtension` to the `<extensions>` block of your `phpunit.xml`.
**Please note that this way will be removed after updating**
**PHPUnit up to 10 version (https://github.com/sebastianbergmann/phpunit/issues/4676)**

```xml
<phpunit>
<extensions>
<bootstrap class="RonasIT\AutoDoc\Tests\PhpUnitExtensions\SwaggerExtension"/>
</extensions>
<testsuites>
<testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
</testsuites>
</phpunit>
```
- Call `php artisan swagger:push-documentation` console command after
the `tests` stage in your CI/CD configuration

## Usage
Expand Down Expand Up @@ -206,6 +220,10 @@ This change is reflected immediately, without the need to rebuild the documentat
The package supports the integration of the primary documentation with additional valid
OpenAPI files specified in the `additional_paths` configuration.
## Migration guides
[3.0.1-beta](MIGRATION-GUIDES.md#301-beta)
## Contributing
Thank you for considering contributing to Laravel Swagger plugin! The contribution guide
Expand Down

0 comments on commit b0336c1

Please sign in to comment.