Skip to content

Commit

Permalink
First commit for Swagger doc support
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisameling committed May 3, 2020
1 parent a821bc1 commit 662bb0a
Show file tree
Hide file tree
Showing 5 changed files with 542 additions and 226 deletions.
1 change: 1 addition & 0 deletions app/AppKernel.php
Expand Up @@ -130,6 +130,7 @@ public function registerBundles(): array
new Ivory\OrderedFormBundle\IvoryOrderedFormBundle(),
new Noxlogic\RateLimitBundle\NoxlogicRateLimitBundle(),
new FM\ElfinderBundle\FMElfinderBundle(),
new Nelmio\ApiDocBundle\NelmioApiDocBundle(),

// Mautic Bundles
new Mautic\ApiBundle\MauticApiBundle(),
Expand Down
8 changes: 8 additions & 0 deletions app/bundles/CoreBundle/Config/config.php
Expand Up @@ -69,6 +69,14 @@
'url' => '.*/$',
],
],
'mautic_core_api_swagger' => [
'path' => '/swagger-docs',
'controller' => 'nelmio_api_doc.controller.swagger_ui',
],
'mautic_core_api_swagger_json' => [
'path' => '/swagger-docs.json',
'controller' => 'nelmio_api_doc.controller.swagger',
],
],
'api' => [
'mautic_core_api_file_list' => [
Expand Down
26 changes: 26 additions & 0 deletions app/config/config.php
Expand Up @@ -323,3 +323,29 @@
],
],
]);

// Nelmio Swagger config
$container->loadFromExtension('nelmio_api_doc', [
'areas' => [
'path_patterns' => [
'^/api(?!/doc$)',
],
],
'documentation' => [
'host' => 'your_mautic_host.local',
'schemes' => ['http', 'https'],
'info' => [
'title' => 'Mautic API docs',
'description' => 'Auto-generated Swagger documentation.',
'version' => '3.0.0',
],
'securityDefinitions' => [
'Basic' => [
'type' => 'basic',
],
],
'security' => [
['Basic' => []],
],
],
]);
3 changes: 2 additions & 1 deletion composer.json
Expand Up @@ -108,7 +108,8 @@
"leezy/pheanstalk-bundle": "^4.0",
"tightenco/collect": "^6.13",
"kamermans/guzzle-oauth2-subscriber": "^1.0",
"barryvdh/elfinder-flysystem-driver": "^0.2.1"
"barryvdh/elfinder-flysystem-driver": "^0.2.1",
"nelmio/api-doc-bundle": "^3.6"
},
"require-dev": {
"symfony/web-profiler-bundle": "~3.4.0",
Expand Down

0 comments on commit 662bb0a

Please sign in to comment.