feat(api-docs): extract API docs viewer into standalone module
Move the Swagger UI viewer from core (pages/admin/api-docs/) into modules/api-docs/ as a self-contained module. Create module manifest with routes, permission, sidebar.admin_nav_item slot, asset group, and authorization policy. Remove API docs ability from core OperationsAuthorizationPolicy and UiCapabilityMap. Remove hardcoded sidebar nav item — now contributed via module slot. Add admin-automation group meta to sidebar template for module nav items. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
66
modules/api-docs/module.php
Normal file
66
modules/api-docs/module.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* API Docs module manifest.
|
||||
*
|
||||
* Provides a Swagger UI viewer for the project's OpenAPI specification.
|
||||
*/
|
||||
return [
|
||||
'id' => 'api-docs',
|
||||
'version' => '1.0.0',
|
||||
'enabled_by_default' => false,
|
||||
'load_order' => 20,
|
||||
'requires' => [],
|
||||
|
||||
'routes' => [
|
||||
['path' => 'admin/api-docs', 'target' => 'api-docs'],
|
||||
['path' => 'admin/api-docs/spec', 'target' => 'api-docs/spec'],
|
||||
],
|
||||
'public_paths' => [],
|
||||
'container_registrars' => [
|
||||
\MintyPHP\Module\ApiDocs\ApiDocsContainerRegistrar::class,
|
||||
],
|
||||
|
||||
'ui_slots' => [
|
||||
'sidebar.admin_nav_item' => [
|
||||
[
|
||||
'key' => 'api-docs',
|
||||
'group' => 'admin-automation',
|
||||
'label' => 'API docs',
|
||||
'path' => 'admin/api-docs',
|
||||
'permission' => 'api_docs.view',
|
||||
'order' => 300,
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
'authorization_policies' => [
|
||||
\MintyPHP\Module\ApiDocs\ApiDocsAuthorizationPolicy::class,
|
||||
],
|
||||
|
||||
'search_resources' => [],
|
||||
|
||||
'asset_groups' => [
|
||||
'api-docs' => [
|
||||
'modules/api-docs/css/vendor-overrides/swagger-ui.css',
|
||||
],
|
||||
],
|
||||
|
||||
'scheduler_jobs' => [],
|
||||
'layout_context_providers' => [],
|
||||
'session_providers' => [],
|
||||
|
||||
'permissions' => [
|
||||
[
|
||||
'key' => 'api_docs.view',
|
||||
'description' => 'Can view API documentation',
|
||||
'active' => true,
|
||||
'is_system' => true,
|
||||
],
|
||||
],
|
||||
|
||||
'event_listeners' => [],
|
||||
'deactivation_handler' => null,
|
||||
'migrations_path' => null,
|
||||
'i18n_path' => 'i18n',
|
||||
];
|
||||
Reference in New Issue
Block a user