1
0
mirror of https://framagit.org/tykayn/date-poll-api synced 2023-08-25 08:23:11 +02:00

add doc bundle to generate swagger doc

This commit is contained in:
Baptiste Lemoine 2019-11-06 10:07:07 +01:00
parent 2c2c24b1bb
commit 743a3db48b
7 changed files with 519 additions and 2 deletions

View File

@ -7,6 +7,7 @@
"ext-iconv": "*",
"friendsofsymfony/rest-bundle": "^2.6",
"jms/serializer-bundle": "^3.4",
"nelmio/api-doc-bundle": "^3.4",
"symfony/console": "4.3.*",
"symfony/dotenv": "4.3.*",
"symfony/flex": "^1.3.1",

462
composer.lock generated
View File

@ -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": "90d590c03c4ae7a72bebb838a07b2abd",
"content-hash": "927a6acf21288c4cb4bc4eb7000dddaf",
"packages": [
{
"name": "doctrine/annotations",
@ -1218,6 +1218,45 @@
],
"time": "2018-06-14T14:45:07+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": "2.6.0",
@ -2367,6 +2406,89 @@
],
"time": "2019-06-27T07:24:18+00:00"
},
{
"name": "nelmio/api-doc-bundle",
"version": "v3.4.0",
"source": {
"type": "git",
"url": "https://github.com/nelmio/NelmioApiDocBundle.git",
"reference": "279d20be784b9879ad0a12859efa3a301404f06c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nelmio/NelmioApiDocBundle/zipball/279d20be784b9879ad0a12859efa3a301404f06c",
"reference": "279d20be784b9879ad0a12859efa3a301404f06c",
"shasum": ""
},
"require": {
"exsyst/swagger": "^0.4.1",
"php": "^7.0",
"phpdocumentor/reflection-docblock": "^3.1|^4.0",
"symfony/framework-bundle": "^3.4|^4.0",
"symfony/options-resolver": "^3.4.4|^4.0",
"symfony/property-info": "^3.4|^4.0",
"zircote/swagger-php": "^2.0.9"
},
"require-dev": {
"api-platform/core": "^2.1.0",
"doctrine/annotations": "^1.2",
"doctrine/common": "^2.4",
"friendsofsymfony/rest-bundle": "^2.0",
"jms/serializer-bundle": "^2.0|^3.0",
"sensio/framework-extra-bundle": "^3.0",
"symfony/asset": "^3.4|^4.0",
"symfony/browser-kit": "^3.4|^4.0",
"symfony/cache": "^3.4|^4.0",
"symfony/config": "^3.4|^4.0",
"symfony/console": "^3.4|^4.0",
"symfony/dom-crawler": "^3.4|^4.0",
"symfony/form": "^3.4|^4.0",
"symfony/phpunit-bridge": "^3.4|^4.0",
"symfony/property-access": "^3.4|^4.0",
"symfony/stopwatch": "^3.4|^4.0",
"symfony/templating": "^3.4|^4.0",
"symfony/twig-bundle": "^3.4|^4.0",
"symfony/validator": "^3.4|^4.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.2.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": "2019-02-18T16:27:10+00:00"
},
{
"name": "ocramius/package-versions",
"version": "1.4.0",
@ -2487,6 +2609,156 @@
],
"time": "2019-08-10T08:37:15+00:00"
},
{
"name": "phpdocumentor/reflection-common",
"version": "2.0.0",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionCommon.git",
"reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/63a995caa1ca9e5590304cd845c15ad6d482a62a",
"reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"require-dev": {
"phpunit/phpunit": "~6"
},
"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": "2018-08-07T13:53:10+00:00"
},
{
"name": "phpdocumentor/reflection-docblock",
"version": "4.3.2",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
"reference": "b83ff7cfcfee7827e1e78b637a5904fe6a96698e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/b83ff7cfcfee7827e1e78b637a5904fe6a96698e",
"reference": "b83ff7cfcfee7827e1e78b637a5904fe6a96698e",
"shasum": ""
},
"require": {
"php": "^7.0",
"phpdocumentor/reflection-common": "^1.0.0 || ^2.0.0",
"phpdocumentor/type-resolver": "~0.4 || ^1.0.0",
"webmozart/assert": "^1.0"
},
"require-dev": {
"doctrine/instantiator": "^1.0.5",
"mockery/mockery": "^1.0",
"phpunit/phpunit": "^6.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.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": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
"time": "2019-09-12T14:27:41+00:00"
},
{
"name": "phpdocumentor/type-resolver",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/TypeResolver.git",
"reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/2e32a6d48972b2c1976ed5d8967145b6cec4a4a9",
"reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9",
"shasum": ""
},
"require": {
"php": "^7.1",
"phpdocumentor/reflection-common": "^2.0"
},
"require-dev": {
"ext-tokenizer": "^7.1",
"mockery/mockery": "~1",
"phpunit/phpunit": "^7.0"
},
"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": "2019-08-22T18:11:29+00:00"
},
{
"name": "psr/cache",
"version": "1.0.1",
@ -4443,6 +4715,82 @@
],
"time": "2019-08-26T08:26:39+00:00"
},
{
"name": "symfony/property-info",
"version": "v4.3.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/property-info.git",
"reference": "e91cb19058c768ed3a1a1e321f5c9e227612981d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/property-info/zipball/e91cb19058c768ed3a1a1e321f5c9e227612981d",
"reference": "e91cb19058c768ed3a1a1e321f5c9e227612981d",
"shasum": ""
},
"require": {
"php": "^7.1.3",
"symfony/inflector": "~3.4|~4.0"
},
"conflict": {
"phpdocumentor/reflection-docblock": "<3.0||>=3.2.0,<3.2.2",
"phpdocumentor/type-resolver": "<0.3.0",
"symfony/dependency-injection": "<3.4"
},
"require-dev": {
"doctrine/annotations": "~1.7",
"phpdocumentor/reflection-docblock": "^3.0|^4.0",
"symfony/cache": "~3.4|~4.0",
"symfony/dependency-injection": "~3.4|~4.0",
"symfony/serializer": "~3.4|~4.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": "4.3-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"
],
"time": "2019-10-14T12:12:55+00:00"
},
{
"name": "symfony/routing",
"version": "v4.3.6",
@ -4968,6 +5316,56 @@
"homepage": "https://symfony.com",
"time": "2019-10-30T12:58:49+00:00"
},
{
"name": "webmozart/assert",
"version": "1.5.0",
"source": {
"type": "git",
"url": "https://github.com/webmozart/assert.git",
"reference": "88e6d84706d09a236046d686bbea96f07b3a34f4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/webmozart/assert/zipball/88e6d84706d09a236046d686bbea96f07b3a34f4",
"reference": "88e6d84706d09a236046d686bbea96f07b3a34f4",
"shasum": ""
},
"require": {
"php": "^5.3.3 || ^7.0",
"symfony/polyfill-ctype": "^1.8"
},
"require-dev": {
"phpunit/phpunit": "^4.8.36 || ^7.5.13"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3-dev"
}
},
"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": "2019-08-24T08:43:50+00:00"
},
{
"name": "willdurand/jsonp-callback-validator",
"version": "v1.1.0",
@ -5166,6 +5564,68 @@
"zf2"
],
"time": "2018-04-25T15:33:34+00:00"
},
{
"name": "zircote/swagger-php",
"version": "2.0.14",
"source": {
"type": "git",
"url": "https://github.com/zircote/swagger-php.git",
"reference": "f2a00f26796e5cd08fd812275ba2db3d1e807663"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zircote/swagger-php/zipball/f2a00f26796e5cd08fd812275ba2db3d1e807663",
"reference": "f2a00f26796e5cd08fd812275ba2db3d1e807663",
"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": "2019-05-17T10:10:34+00:00"
}
],
"packages-dev": [

View File

@ -10,4 +10,5 @@ return [
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Symfony\Bundle\WebServerBundle\WebServerBundle::class => ['dev' => true],
Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true],
Nelmio\ApiDocBundle\NelmioApiDocBundle::class => ['all' => true],
];

View File

@ -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

View File

@ -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 }

View File

@ -24,7 +24,7 @@ class Poll {
* @ORM\Column(type="string", length=255)
* @Serializer\Expose
*/
private $title;
public $title;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Serializer\Expose

View File

@ -93,6 +93,9 @@
"doctrine/reflection": {
"version": "v1.0.0"
},
"exsyst/swagger": {
"version": "v0.4.1"
},
"friendsofsymfony/rest-bundle": {
"version": "2.2",
"recipe": {
@ -167,6 +170,19 @@
"config/packages/prod/jms_serializer.yaml"
]
},
"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.2.4"
},
@ -176,6 +192,15 @@
"ocramius/proxy-manager": {
"version": "2.2.3"
},
"phpdocumentor/reflection-common": {
"version": "2.0.0"
},
"phpdocumentor/reflection-docblock": {
"version": "4.3.2"
},
"phpdocumentor/type-resolver": {
"version": "1.0.1"
},
"psr/cache": {
"version": "1.0.1"
},
@ -316,6 +341,9 @@
"symfony/property-access": {
"version": "v4.3.5"
},
"symfony/property-info": {
"version": "v4.3.6"
},
"symfony/routing": {
"version": "4.2",
"recipe": {
@ -370,6 +398,9 @@
"symfony/yaml": {
"version": "v4.3.5"
},
"webmozart/assert": {
"version": "1.5.0"
},
"willdurand/jsonp-callback-validator": {
"version": "v1.1.0"
},
@ -381,5 +412,8 @@
},
"zendframework/zend-eventmanager": {
"version": "3.2.1"
},
"zircote/swagger-php": {
"version": "2.0.14"
}
}