Skip to content

Commit

Permalink
fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
xxl4 committed Nov 21, 2024
1 parent 693b750 commit f2d1887
Show file tree
Hide file tree
Showing 5 changed files with 143 additions and 2 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ jobs:
coverage: none

# Configure NPM
- uses: actions/setup-node@v1
- uses: actions/setup-node@v3
with:
node-version: '16.x'
node-version: '20.x'

# Install PHP dependencies
- name: Install Composer dependencies
Expand All @@ -86,3 +86,4 @@ jobs:
# Run phpunit tests
- name: Run tests
run: ./vendor/bin/phpunit

48 changes: 48 additions & 0 deletions src/Config/l5-swagger.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php
return [
'apps' => [
'api' => [
'title' => 'Apps API Documentation',
],

'routes' => [
/*
* Route for accessing api documentation interface
*/
'api' => 'api/apps/documentation',
'docs' => storage_path('api-docs/apps'),
'oauth2_callback' => 'api/apps/oauth2-callback',
],
'paths' => [
/*
* Edit to include full URL in ui for assets
*/
'use_absolute_path' => env('L5_SWAGGER_USE_ABSOLUTE_PATH', true),

/*
* File name of the generated json documentation file
*/
'docs_json' => 'api-apps-docs.json',

/*
* File name of the generated YAML documentation file
*/
'docs_yaml' => 'api-apps-docs.yaml',

/*
* Set this to `json` or `yaml` to determine which documentation file to use in UI
*/
'format_to_use_for_docs' => env('L5_FORMAT_TO_USE_FOR_DOCS', 'json'),

/*
* Absolute paths to directory containing the swagger annotations are stored.
*/
'annotations' => [
base_path('vendor/nexa-merchant/apps/src/Docs/V1/Apps'),
//base_path('vendor/nexa-merchant/Upselling/src/Docs/V1/Upselling'),

],

],
]
];
59 changes: 59 additions & 0 deletions src/Docs/V1/Apps/Controllers/AppsController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php

namespace NexaMerchant\Apps\Http\Controllers\Api\V1\Apps\Controllers;

class AppsController extends Controller
{
/**
* @OA\Post(
* path="/api/v1/apps/publish",
* summary="Publish an app",
* description="Upload a zip file and publish the app",
* operationId="publishApp",
* tags={"Apps"},
* @OA\RequestBody(
* required=true,
* @OA\MediaType(
* mediaType="multipart/form-data",
* @OA\Schema(
* @OA\Property(
* property="file",
* type="string",
* format="binary",
* description="Zip file to upload"
* ),
* @OA\Property(
* property="name",
* type="string",
* description="Name of the app"
* ),
* @OA\Property(
* property="version",
* type="string",
* description="Version of the app"
* ),
* @OA\Property(
* property="token",
* type="string",
* description="Authentication token"
* ),
* required={"file", "name", "version", "token"}
* )
* )
* ),
* @OA\Response(
* response=200,
* description="App published successfully",
* @OA\JsonContent(
* @OA\Property(property="success", type="boolean"),
* @OA\Property(property="message", type="string")
* )
* ),
* @OA\Response(
* response=400,
* description="Bad request"
* )
* )
*/
public function public(){}
}
28 changes: 28 additions & 0 deletions src/Docs/V1/Apps/Controllers/Controller.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
namespace NexaMerchant\Apps\Docs\Controllers\Api\V1\Apps\Controllers;

/**
* @OA\Info(
* version="1.0.4",
* title="NexaMerchant Admin Rest API Documentation",
* description="NexaMerchant Admin Rest API Documentation",
*
* @OA\Contact(
* email="nice.lizhi@gmail.com"
* )
* )
*
* @OA\Server(
* url=APP_URL,
* description="NexaMerchant Admin End Rest API"
* )
*
* @OA\Tag(
* name="APPS",
* description="APPS Endpoints of Admin User"
* )
*/

class Controller
{
}
5 changes: 5 additions & 0 deletions src/Providers/AppsServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ protected function registerConfig()
$this->mergeConfigFrom(
dirname(__DIR__) . '/Config/Apps.php', 'Apps'
);

// api docs
$this->mergeConfigFrom(
dirname(__DIR__) . '/Config/l5-swagger.php', 'l5-swagger.documentations'
);

}

Expand Down

0 comments on commit f2d1887

Please sign in to comment.