From f2d1887a499f117df1886089463ce1ab5b72c67d Mon Sep 17 00:00:00 2001 From: Steve <34465153+xxl4@users.noreply.github.com> Date: Thu, 21 Nov 2024 17:03:00 +0800 Subject: [PATCH] fix docs --- .github/workflows/test.yml | 5 +- src/Config/l5-swagger.php | 48 +++++++++++++++ .../V1/Apps/Controllers/AppsController.php | 59 +++++++++++++++++++ src/Docs/V1/Apps/Controllers/Controller.php | 28 +++++++++ src/Providers/AppsServiceProvider.php | 5 ++ 5 files changed, 143 insertions(+), 2 deletions(-) create mode 100644 src/Config/l5-swagger.php create mode 100644 src/Docs/V1/Apps/Controllers/AppsController.php create mode 100644 src/Docs/V1/Apps/Controllers/Controller.php diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 500c919..448007d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 @@ -86,3 +86,4 @@ jobs: # Run phpunit tests - name: Run tests run: ./vendor/bin/phpunit + diff --git a/src/Config/l5-swagger.php b/src/Config/l5-swagger.php new file mode 100644 index 0000000..d74b8c7 --- /dev/null +++ b/src/Config/l5-swagger.php @@ -0,0 +1,48 @@ + [ + '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'), + + ], + + ], + ] +]; \ No newline at end of file diff --git a/src/Docs/V1/Apps/Controllers/AppsController.php b/src/Docs/V1/Apps/Controllers/AppsController.php new file mode 100644 index 0000000..7f7e2b0 --- /dev/null +++ b/src/Docs/V1/Apps/Controllers/AppsController.php @@ -0,0 +1,59 @@ +mergeConfigFrom( dirname(__DIR__) . '/Config/Apps.php', 'Apps' ); + + // api docs + $this->mergeConfigFrom( + dirname(__DIR__) . '/Config/l5-swagger.php', 'l5-swagger.documentations' + ); }