Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert middleware to request handler #79

Merged
merged 10 commits into from
Aug 2, 2023
Merged

Convert middleware to request handler #79

merged 10 commits into from
Aug 2, 2023

Conversation

xepozz
Copy link
Member

@xepozz xepozz commented Jun 17, 2023

Q A
Is bugfix? ✔️
New feature?
Breaks BC? ✔️

@what-the-diff
Copy link

what-the-diff bot commented Jun 17, 2023

PR Summary

  • Changed interface for SwaggerJson class
    The SwaggerJson class now implements RequestHandlerInterface instead of MiddlewareInterface, to better align with its purpose.

  • Renamed process() method to handle() and removed parameter
    The process() method was renamed to handle() and the second parameter $handler is removed, simplifying the function's signature.

use Psr\Http\Server\RequestHandlerInterface;
use Yiisoft\Cache\CacheInterface;
use Yiisoft\DataResponse\DataResponseFactoryInterface;
use Yiisoft\Swagger\Service\SwaggerService;

final class SwaggerJson implements MiddlewareInterface
final class SwaggerJson implements RequestHandlerInterface
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. What's the benefit?
  2. It's still in the Middleware namespace.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll move it outside of the middleware folder

@xepozz
Copy link
Member Author

xepozz commented Jun 21, 2023

@codecov
Copy link

codecov bot commented Jun 21, 2023

Codecov Report

Patch coverage: 85.71% and project coverage change: -26.20% ⚠️

Comparison is base (aa3de81) 92.85% compared to head (0196008) 66.66%.

Additional details and impacted files
@@              Coverage Diff              @@
##             master      #79       +/-   ##
=============================================
- Coverage     92.85%   66.66%   -26.20%     
- Complexity       20       28        +8     
=============================================
  Files             5        7        +2     
  Lines            70      105       +35     
=============================================
+ Hits             65       70        +5     
- Misses            5       35       +30     
Files Changed Coverage Δ
src/Middleware/SwaggerJson.php 33.33% <ø> (-66.67%) ⬇️
src/Middleware/SwaggerUi.php 13.33% <ø> (-86.67%) ⬇️
src/Action/SwaggerJson.php 75.00% <75.00%> (ø)
src/Action/SwaggerUi.php 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@vjik vjik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need fix readme

@samdark
Copy link
Member

samdark commented Jun 26, 2023

@xepozz readme should be adjusted. Afterwards, it's good to merge.

@xepozz
Copy link
Member Author

xepozz commented Aug 1, 2023

Done

Copy link
Member

@vjik vjik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need add configuration of new actions to di-web.php.

@xepozz xepozz merged commit 250ffe2 into master Aug 2, 2023
23 of 25 checks passed
@xepozz xepozz deleted the cors-swagger branch August 2, 2023 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants