Skip to content

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
StyleCIBot committed Mar 27, 2023
1 parent 929a569 commit 2388ef0
Show file tree
Hide file tree
Showing 14 changed files with 73 additions and 3 deletions.
2 changes: 1 addition & 1 deletion blog-api/config/web/di/application.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
Yiisoft\Yii\Http\Application::class => [
'__construct()' => [
'dispatcher' => DynamicReference::to(static function (Injector $injector) use ($params) {
return ($injector->make(MiddlewareDispatcher::class))
return $injector->make(MiddlewareDispatcher::class)
->withMiddlewares($params['middlewares']);
}),
'fallbackHandler' => Reference::to(NotFoundHandler::class),
Expand Down
13 changes: 13 additions & 0 deletions blog-api/src/Auth/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,17 @@ public function __construct(
* path="/auth/",
* summary="Authenticate by params",
* description="",
*
* @OA\Response(
* response="200",
* description="Success",
*
* @OA\JsonContent(
* allOf={
*
* @OA\Schema(ref="#/components/schemas/Response"),
* @OA\Schema(
*
* @OA\Property(
* property="data",
* type="object",
Expand All @@ -58,15 +62,20 @@ public function __construct(
* },
* )
* ),
*
* @OA\Response(
* response="400",
* description="Bad request",
*
* @OA\JsonContent(ref="#/components/schemas/BadResponse")
* ),
*
* @OA\RequestBody(
* required=true,
*
* @OA\MediaType(
* mediaType="application/json",
*
* @OA\Schema(ref="#/components/schemas/AuthRequest"),
* ),
* ),
Expand All @@ -93,14 +102,18 @@ public function login(AuthRequest $request): ResponseInterface
* summary="Logout",
* description="",
* security={{"ApiKey": {}}},
*
* @OA\Response(
* response="200",
* description="Success",
*
* @OA\JsonContent(ref="#/components/schemas/Response")
* ),
*
* @OA\Response(
* response="400",
* description="Bad request",
*
* @OA\JsonContent(ref="#/components/schemas/BadResponse")
* ),
* )
Expand Down
1 change: 1 addition & 0 deletions blog-api/src/Auth/AuthRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
/**
* @OA\Schema(
* schema="AuthRequest",
*
* @OA\Property(example="Opal1144", property="login", format="string"),
* @OA\Property(example="Opal1144", property="password", format="string"),
* )
Expand Down
31 changes: 31 additions & 0 deletions blog-api/src/Blog/BlogController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
* name="blog",
* description="Blog"
* )
*
* @OA\Parameter(
*
* @OA\Schema(
* type="int",
* example="2"
Expand Down Expand Up @@ -55,22 +57,29 @@ public function __construct(
* path="/blog/",
* summary="Returns paginated blog posts",
* description="",
*
* @OA\Parameter(ref="#/components/parameters/PageRequest"),
*
* @OA\Response(
* response="200",
* description="Success",
*
* @OA\JsonContent(
* allOf={
*
* @OA\Schema(ref="#/components/schemas/Response"),
* @OA\Schema(
*
* @OA\Property(
* property="data",
* type="object",
* @OA\Property(
* property="posts",
* type="array",
*
* @OA\Items(ref="#/components/schemas/Post")
* ),
*
* @OA\Property(
* property="paginator",
* type="object",
Expand Down Expand Up @@ -105,19 +114,25 @@ public function index(PaginatorFormatter $paginatorFormatter, #[Query('page')] i
* path="/blog/{id}",
* summary="Returns a post with a given ID",
* description="",
*
* @OA\Parameter(
*
* @OA\Schema(type="int", example="2"),
* in="path",
* name="id",
* parameter="id"
* ),
*
* @OA\Response(
* response="200",
* description="Success",
*
* @OA\JsonContent(
* allOf={
*
* @OA\Schema(ref="#/components/schemas/Response"),
* @OA\Schema(
*
* @OA\Property(
* property="data",
* type="object",
Expand All @@ -131,13 +146,17 @@ public function index(PaginatorFormatter $paginatorFormatter, #[Query('page')] i
* },
* )
* ),
*
* @OA\Response(
* response="404",
* description="Not found",
*
* @OA\JsonContent(
* allOf={
*
* @OA\Schema(ref="#/components/schemas/BadResponse"),
* @OA\Schema(
*
* @OA\Property(property="error_message", example="Entity not found"),
* @OA\Property(property="error_code", nullable=true, example=404)
* ),
Expand All @@ -164,17 +183,22 @@ public function view(#[Route('id')] int $id): Response
* summary="Creates a blog post",
* description="",
* security={{"ApiKey": {}}},
*
* @OA\Response(
* response="200",
* description="Success",
*
* @OA\JsonContent(
* ref="#/components/schemas/Response"
* )
* ),
*
* @OA\RequestBody(
* required=true,
*
* @OA\MediaType(
* mediaType="application/json",
*
* @OA\Schema(ref="#/components/schemas/EditPostRequest"),
* ),
* ),
Expand All @@ -197,23 +221,30 @@ public function create(EditPostRequest $postRequest, UserRequest $userRequest):
* summary="Updates a blog post with a given ID",
* description="",
* security={{"ApiKey": {}}},
*
* @OA\Parameter(
*
* @OA\Schema(type="int", example="2"),
* in="path",
* name="id",
* parameter="id"
* ),
*
* @OA\Response(
* response="200",
* description="Success",
*
* @OA\JsonContent(
* ref="#/components/schemas/Response"
* )
* ),
*
* @OA\RequestBody(
* required=true,
*
* @OA\MediaType(
* mediaType="application/json",
*
* @OA\Schema(ref="#/components/schemas/EditPostRequest"),
* ),
* )
Expand Down
1 change: 1 addition & 0 deletions blog-api/src/Blog/EditPostRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
/**
* @OA\Schema(
* schema="EditPostRequest",
*
* @OA\Property(example="Title post", property="title", format="string"),
* @OA\Property(example="Text post", property="text", format="string"),
* @OA\Property(example=1, property="status", format="int"),
Expand Down
1 change: 1 addition & 0 deletions blog-api/src/Blog/PostFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/**
* @OA\Schema(
* schema="Post",
*
* @OA\Property(example="100", property="id", format="int"),
* @OA\Property(example="Title", property="title", format="string"),
* @OA\Property(example="Text", property="content", format="string"),
Expand Down
1 change: 1 addition & 0 deletions blog-api/src/Dto/ApiResponseData.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* allOf={
* @OA\Schema(ref="#/components/schemas/Response"),
* @OA\Schema(
*
* @OA\Property(
* property="status",
* example="failed",
Expand Down
1 change: 1 addition & 0 deletions blog-api/src/Formatter/PaginatorFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
/**
* @OA\Schema(
* schema="Paginator",
*
* @OA\Property(example="10", property="pageSize", format="int"),
* @OA\Property(example="1", property="currentPage", format="int"),
* @OA\Property(example="3", property="totalPages", format="int"),
Expand Down
4 changes: 4 additions & 0 deletions blog-api/src/InfoController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,17 @@ public function __construct(private VersionProvider $versionProvider)
* path="/",
* summary="Returns info about the API",
* description="",
*
* @OA\Response(
* response="200",
* description="Success",
*
* @OA\JsonContent(
* allOf={
*
* @OA\Schema(ref="#/components/schemas/Response"),
* @OA\Schema(
*
* @OA\Property(
* property="data",
* type="object",
Expand Down
11 changes: 11 additions & 0 deletions blog-api/src/User/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,24 @@ public function __construct(
* summary="Returns paginated users",
* description="",
* security={{"ApiKey": {}}},
*
* @OA\Response(
* response="200",
* description="Success",
*
* @OA\JsonContent(
* allOf={
*
* @OA\Schema(ref="#/components/schemas/Response"),
* @OA\Schema(
*
* @OA\Property(
* property="data",
* type="object",
* @OA\Property(
* property="users",
* type="array",
*
* @OA\Items(ref="#/components/schemas/User")
* ),
* ),
Expand Down Expand Up @@ -86,19 +91,25 @@ public function list(): ResponseInterface
* summary="Returns a user with a given ID",
* description="",
* security={{"ApiKey": {}}},
*
* @OA\Parameter(
*
* @OA\Schema(type="int", example="2"),
* in="path",
* name="id",
* parameter="id"
* ),
*
* @OA\Response(
* response="200",
* description="Success",
*
* @OA\JsonContent(
* allOf={
*
* @OA\Schema(ref="#/components/schemas/Response"),
* @OA\Schema(
*
* @OA\Property(
* property="data",
* type="object",
Expand Down
1 change: 1 addition & 0 deletions blog-api/src/User/UserFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/**
* @OA\Schema(
* schema="User",
*
* @OA\Property(example="UserName", property="login", format="string"),
* @OA\Property(example="13.12.2020 00:04:20", property="created_at", format="string"),
* )
Expand Down
4 changes: 2 additions & 2 deletions blog/config/common/routes/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
// Blog routes
Group::create('/blog')
->routes(
// Index
// Index
Route::get('[/page{page:\d+}]')
->middleware(
fn (HttpCache $httpCache, PostRepository $postRepository) => $httpCache->withLastModified(function (ServerRequestInterface $request, $params) use ($postRepository) {
Expand Down Expand Up @@ -156,7 +156,7 @@
// Archive
Group::create('/archive')
->routes(
// Index page
// Index page
Route::get('')
->action([ArchiveController::class, 'index'])
->name('blog/archive/index'),
Expand Down
1 change: 1 addition & 0 deletions blog/src/Controller/Actions/ApiInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public function __construct(DataResponseFactoryInterface $responseFactory)
/**
* @OA\Get(
* path="/api/info/v2",
*
* @OA\Response(response="200", description="Get api version")
* )
*/
Expand Down
4 changes: 4 additions & 0 deletions blog/src/User/Controller/ApiUserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public function __construct(private DataResponseFactoryInterface $responseFactor
* @OA\Get(
* path="/api/user",
* tags={"user"},
*
* @OA\Response(response="200", description="Get users list")
* )
*/
Expand All @@ -52,12 +53,15 @@ public function index(UserRepository $userRepository): ResponseInterface
* @OA\Get(
* path="/api/user/{login}",
* tags={"user"},
*
* @OA\Parameter(
*
* @OA\Schema(type="string"),
* in="path",
* name="login",
* parameter="login"
* ),
*
* @OA\Response(response="200", description="Get user info")
* )
*/
Expand Down

0 comments on commit 2388ef0

Please sign in to comment.