diff --git a/composer.json b/composer.json index fcb912d..27d582b 100644 --- a/composer.json +++ b/composer.json @@ -16,6 +16,7 @@ "doctrine/annotations": "^1.10", "friendsofsymfony/rest-bundle": "dev-master#3.0.0-beta2", "jms/serializer-bundle": "^3.6", + "nelmio/api-doc-bundle": "^3.6", "ocramius/package-versions": "1.8", "ocramius/proxy-manager": "2.8", "sensio/framework-extra-bundle": "^5.5", diff --git a/composer.lock b/composer.lock index 9986b54..4bd8f25 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "38db59ccf60864920d7d74a4d503107e", + "content-hash": "65d11184e60eb43f8ee7c48e6216d9e4", "packages": [ { "name": "doctrine/annotations", @@ -1152,6 +1152,45 @@ ], "time": "2020-03-27T11:06:43+00:00" }, + { + "name": "exsyst/swagger", + "version": "v0.4.1", + "source": { + "type": "git", + "url": "https://github.com/GuilhemN/swagger.git", + "reference": "a02984db5edacdce2b4e09dae5ba8fe17a0e449e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/GuilhemN/swagger/zipball/a02984db5edacdce2b4e09dae5ba8fe17a0e449e", + "reference": "a02984db5edacdce2b4e09dae5ba8fe17a0e449e", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "EXSyst\\Component\\Swagger\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ener-Getick", + "email": "egetick@gmail.com" + } + ], + "description": "A php library to manipulate Swagger specifications", + "time": "2018-07-27T06:40:00+00:00" + }, { "name": "friendsofsymfony/rest-bundle", "version": "dev-master", @@ -2571,6 +2610,94 @@ ], "time": "2019-12-20T14:22:59+00:00" }, + { + "name": "nelmio/api-doc-bundle", + "version": "v3.6.1", + "source": { + "type": "git", + "url": "https://github.com/nelmio/NelmioApiDocBundle.git", + "reference": "ab014fe032beb1a7875939ff4162e8d05ad778ab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nelmio/NelmioApiDocBundle/zipball/ab014fe032beb1a7875939ff4162e8d05ad778ab", + "reference": "ab014fe032beb1a7875939ff4162e8d05ad778ab", + "shasum": "" + }, + "require": { + "exsyst/swagger": "^0.4.1", + "php": "^7.1", + "phpdocumentor/reflection-docblock": "^3.1|^4.0|^5.0", + "symfony/framework-bundle": "^3.4|^4.0|^5.0", + "symfony/options-resolver": "^3.4.4|^4.0|^5.0", + "symfony/property-info": "^3.4|^4.0|^5.0", + "zircote/swagger-php": "^2.0.9" + }, + "conflict": { + "symfony/framework-bundle": "4.2.7" + }, + "require-dev": { + "api-platform/core": "^2.1.2", + "doctrine/annotations": "^1.2", + "doctrine/common": "^2.4", + "friendsofsymfony/rest-bundle": "^2.0", + "jms/serializer": "^1.14|^3.0", + "jms/serializer-bundle": "^2.3|^3.0", + "sensio/framework-extra-bundle": "^3.0.13|^4.0|^5.0", + "symfony/asset": "^3.4|^4.0|^5.0", + "symfony/browser-kit": "^3.4|^4.0|^5.0", + "symfony/cache": "^3.4|^4.0|^5.0", + "symfony/config": "^3.4|^4.0|^5.0", + "symfony/console": "^3.4|^4.0|^5.0", + "symfony/dom-crawler": "^3.4|^4.0|^5.0", + "symfony/form": "^3.4|^4.0|^5.0", + "symfony/phpunit-bridge": "^3.4.24|^4.0|^5.0", + "symfony/property-access": "^3.4|^4.0|^5.0", + "symfony/routing": "^3.4|^4.0|^5.0", + "symfony/stopwatch": "^3.4|^4.0|^5.0", + "symfony/templating": "^3.4|^4.0|^5.0", + "symfony/twig-bundle": "^3.4|^4.0|^5.0", + "symfony/validator": "^3.4|^4.0|^5.0", + "willdurand/hateoas-bundle": "^1.0|^2.0" + }, + "suggest": { + "api-platform/core": "For using an API oriented framework.", + "friendsofsymfony/rest-bundle": "For using the parameters annotations." + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "3.6.x-dev" + } + }, + "autoload": { + "psr-4": { + "Nelmio\\ApiDocBundle\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nelmio", + "homepage": "http://nelm.io" + }, + { + "name": "Symfony Community", + "homepage": "https://github.com/nelmio/NelmioApiDocBundle/contributors" + } + ], + "description": "Generates documentation for your REST API from annotations", + "keywords": [ + "api", + "doc", + "documentation", + "rest" + ], + "time": "2020-03-31T10:05:08+00:00" + }, { "name": "ocramius/package-versions", "version": "1.8.0", @@ -2717,6 +2844,154 @@ ], "time": "2020-04-13T14:42:16+00:00" }, + { + "name": "phpdocumentor/reflection-common", + "version": "2.1.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "6568f4687e5b41b054365f9ae03fcb1ed5f2069b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/6568f4687e5b41b054365f9ae03fcb1ed5f2069b", + "reference": "6568f4687e5b41b054365f9ae03fcb1ed5f2069b", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "time": "2020-04-27T09:25:28+00:00" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "5.1.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", + "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", + "shasum": "" + }, + "require": { + "ext-filter": "^7.1", + "php": "^7.2", + "phpdocumentor/reflection-common": "^2.0", + "phpdocumentor/type-resolver": "^1.0", + "webmozart/assert": "^1" + }, + "require-dev": { + "doctrine/instantiator": "^1", + "mockery/mockery": "^1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + }, + { + "name": "Jaap van Otterdijk", + "email": "account@ijaap.nl" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2020-02-22T12:28:44+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "7462d5f123dfc080dfdf26897032a6513644fc95" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/7462d5f123dfc080dfdf26897032a6513644fc95", + "reference": "7462d5f123dfc080dfdf26897032a6513644fc95", + "shasum": "" + }, + "require": { + "php": "^7.2", + "phpdocumentor/reflection-common": "^2.0" + }, + "require-dev": { + "ext-tokenizer": "^7.2", + "mockery/mockery": "~1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "time": "2020-02-18T18:59:58+00:00" + }, { "name": "psr/cache", "version": "1.0.1", @@ -4150,6 +4425,78 @@ "homepage": "https://symfony.com", "time": "2020-04-28T18:53:25+00:00" }, + { + "name": "symfony/inflector", + "version": "v5.0.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/inflector.git", + "reference": "70c25c66427e2bb6ba0827d668366d60b0a90cbf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/inflector/zipball/70c25c66427e2bb6ba0827d668366d60b0a90cbf", + "reference": "70c25c66427e2bb6ba0827d668366d60b0a90cbf", + "shasum": "" + }, + "require": { + "php": "^7.2.5", + "symfony/polyfill-ctype": "~1.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Inflector\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Inflector Component", + "homepage": "https://symfony.com", + "keywords": [ + "inflection", + "pluralize", + "singularize", + "string", + "symfony", + "words" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-03-27T16:56:45+00:00" + }, { "name": "symfony/mime", "version": "v5.0.8", @@ -4342,6 +4689,60 @@ ], "time": "2019-11-13T13:11:14+00:00" }, + { + "name": "symfony/options-resolver", + "version": "v5.0.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/options-resolver.git", + "reference": "3707e3caeff2b797c0bfaadd5eba723dd44e6bf1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/3707e3caeff2b797c0bfaadd5eba723dd44e6bf1", + "reference": "3707e3caeff2b797c0bfaadd5eba723dd44e6bf1", + "shasum": "" + }, + "require": { + "php": "^7.2.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\OptionsResolver\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony OptionsResolver Component", + "homepage": "https://symfony.com", + "keywords": [ + "config", + "configuration", + "options" + ], + "time": "2020-04-06T10:40:56+00:00" + }, { "name": "symfony/orm-pack", "version": "v1.0.8", @@ -4590,6 +4991,96 @@ ], "time": "2020-02-27T09:26:54+00:00" }, + { + "name": "symfony/property-info", + "version": "v5.0.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/property-info.git", + "reference": "e9e40f14a2d2d163fb603f8646a76a6ff4b9426e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/property-info/zipball/e9e40f14a2d2d163fb603f8646a76a6ff4b9426e", + "reference": "e9e40f14a2d2d163fb603f8646a76a6ff4b9426e", + "shasum": "" + }, + "require": { + "php": "^7.2.5", + "symfony/inflector": "^4.4|^5.0" + }, + "conflict": { + "phpdocumentor/reflection-docblock": "<3.2.2", + "phpdocumentor/type-resolver": "<0.3.0", + "symfony/dependency-injection": "<4.4" + }, + "require-dev": { + "doctrine/annotations": "~1.7", + "phpdocumentor/reflection-docblock": "^3.0|^4.0", + "symfony/cache": "^4.4|^5.0", + "symfony/dependency-injection": "^4.4|^5.0", + "symfony/serializer": "^4.4|^5.0" + }, + "suggest": { + "phpdocumentor/reflection-docblock": "To use the PHPDoc", + "psr/cache-implementation": "To cache results", + "symfony/doctrine-bridge": "To use Doctrine metadata", + "symfony/serializer": "To use Serializer metadata" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\PropertyInfo\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kévin Dunglas", + "email": "dunglas@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Property Info Component", + "homepage": "https://symfony.com", + "keywords": [ + "doctrine", + "phpdoc", + "property", + "symfony", + "type", + "validator" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-04-06T10:40:56+00:00" + }, { "name": "symfony/routing", "version": "v5.0.8", @@ -5714,6 +6205,54 @@ ], "time": "2020-03-21T15:49:08+00:00" }, + { + "name": "webmozart/assert", + "version": "1.8.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "ab2cb0b3b559010b75981b1bdce728da3ee90ad6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/ab2cb0b3b559010b75981b1bdce728da3ee90ad6", + "reference": "ab2cb0b3b559010b75981b1bdce728da3ee90ad6", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0", + "symfony/polyfill-ctype": "^1.8" + }, + "conflict": { + "vimeo/psalm": "<3.9.1" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.36 || ^7.5.13" + }, + "type": "library", + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "time": "2020-04-18T12:12:48+00:00" + }, { "name": "willdurand/jsonp-callback-validator", "version": "v1.1.0", @@ -5805,6 +6344,68 @@ "negotiation" ], "time": "2017-05-14T17:21:12+00:00" + }, + { + "name": "zircote/swagger-php", + "version": "2.0.16", + "source": { + "type": "git", + "url": "https://github.com/zircote/swagger-php.git", + "reference": "a25c1bfe508e5f27d5f618648449593a79cbe406" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zircote/swagger-php/zipball/a25c1bfe508e5f27d5f618648449593a79cbe406", + "reference": "a25c1bfe508e5f27d5f618648449593a79cbe406", + "shasum": "" + }, + "require": { + "doctrine/annotations": "*", + "php": ">=5.6", + "symfony/finder": ">=2.2" + }, + "require-dev": { + "phpunit/phpunit": ">=4.8.35 <=5.6", + "squizlabs/php_codesniffer": ">=2.7", + "zendframework/zend-form": "<2.8" + }, + "bin": [ + "bin/swagger" + ], + "type": "library", + "autoload": { + "psr-4": { + "Swagger\\": "src" + }, + "files": [ + "src/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Robert Allen", + "email": "zircote@gmail.com", + "homepage": "http://www.zircote.com" + }, + { + "name": "Bob Fanger", + "email": "bfanger@gmail.com", + "homepage": "http://bfanger.nl" + } + ], + "description": "Swagger-PHP - Generate interactive documentation for your RESTful API using phpdoc annotations", + "homepage": "https://github.com/zircote/swagger-php/", + "keywords": [ + "api", + "json", + "rest", + "service discovery" + ], + "time": "2020-05-10T13:42:24+00:00" } ], "packages-dev": [ @@ -7065,60 +7666,6 @@ ], "time": "2020-04-21T19:17:25+00:00" }, - { - "name": "symfony/options-resolver", - "version": "v5.0.8", - "source": { - "type": "git", - "url": "https://github.com/symfony/options-resolver.git", - "reference": "3707e3caeff2b797c0bfaadd5eba723dd44e6bf1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/3707e3caeff2b797c0bfaadd5eba723dd44e6bf1", - "reference": "3707e3caeff2b797c0bfaadd5eba723dd44e6bf1", - "shasum": "" - }, - "require": { - "php": "^7.2.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\OptionsResolver\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony OptionsResolver Component", - "homepage": "https://symfony.com", - "keywords": [ - "config", - "configuration", - "options" - ], - "time": "2020-04-06T10:40:56+00:00" - }, { "name": "symfony/phpunit-bridge", "version": "v5.0.8", diff --git a/config/bundles.php b/config/bundles.php index da391ba..e5c3891 100644 --- a/config/bundles.php +++ b/config/bundles.php @@ -16,4 +16,5 @@ Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true], JMS\SerializerBundle\JMSSerializerBundle::class => ['all' => true], FOS\RestBundle\FOSRestBundle::class => ['all' => true], + Nelmio\ApiDocBundle\NelmioApiDocBundle::class => ['all' => true], ]; diff --git a/config/packages/nelmio_api_doc.yaml b/config/packages/nelmio_api_doc.yaml new file mode 100644 index 0000000..4e68479 --- /dev/null +++ b/config/packages/nelmio_api_doc.yaml @@ -0,0 +1,9 @@ +nelmio_api_doc: + documentation: + info: + title: My App + description: This is an awesome app! + version: 1.0.0 + areas: # to filter documented areas + path_patterns: + - ^/api(?!/doc$) # Accepts routes under /api except /api/doc diff --git a/config/routes/nelmio_api_doc.yaml b/config/routes/nelmio_api_doc.yaml new file mode 100644 index 0000000..364b4af --- /dev/null +++ b/config/routes/nelmio_api_doc.yaml @@ -0,0 +1,12 @@ +# Expose your documentation as JSON swagger compliant +app.swagger: + path: /api/doc.json + methods: GET + defaults: { _controller: nelmio_api_doc.controller.swagger } + +## Requires the Asset component and the Twig bundle +## $ composer require twig asset +#app.swagger_ui: +# path: /api/doc +# methods: GET +# defaults: { _controller: nelmio_api_doc.controller.swagger_ui } diff --git a/symfony.lock b/symfony.lock index 4ae5e57..cc5e266 100644 --- a/symfony.lock +++ b/symfony.lock @@ -108,6 +108,9 @@ "doctrine/reflection": { "version": "1.2.1" }, + "exsyst/swagger": { + "version": "v0.4.1" + }, "friendsofphp/php-cs-fixer": { "version": "2.2", "recipe": { @@ -206,6 +209,19 @@ "monolog/monolog": { "version": "2.0.2" }, + "nelmio/api-doc-bundle": { + "version": "3.0", + "recipe": { + "repo": "github.com/symfony/recipes-contrib", + "branch": "master", + "version": "3.0", + "ref": "c8e0c38e1a280ab9e37587a8fa32b251d5bc1c94" + }, + "files": [ + "./config/packages/nelmio_api_doc.yaml", + "./config/routes/nelmio_api_doc.yaml" + ] + }, "nikic/php-parser": { "version": "v4.4.0" }, @@ -221,6 +237,15 @@ "php-cs-fixer/diff": { "version": "v1.3.0" }, + "phpdocumentor/reflection-common": { + "version": "2.1.0" + }, + "phpdocumentor/reflection-docblock": { + "version": "5.1.0" + }, + "phpdocumentor/type-resolver": { + "version": "1.1.0" + }, "phpstan/phpstan": { "version": "0.12.18" }, @@ -386,6 +411,9 @@ "symfony/http-kernel": { "version": "v5.0.7" }, + "symfony/inflector": { + "version": "v5.0.8" + }, "symfony/maker-bundle": { "version": "1.0", "recipe": { @@ -451,6 +479,9 @@ "symfony/profiler-pack": { "version": "v1.0.4" }, + "symfony/property-info": { + "version": "v5.0.8" + }, "symfony/routing": { "version": "4.2", "recipe": { @@ -577,6 +608,9 @@ "webimpress/safe-writer": { "version": "2.0.1" }, + "webmozart/assert": { + "version": "1.8.0" + }, "willdurand/jsonp-callback-validator": { "version": "v1.1.0" }, @@ -588,5 +622,8 @@ }, "zendframework/zend-eventmanager": { "version": "3.2.1" + }, + "zircote/swagger-php": { + "version": "2.0.16" } }