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

Compare commits

...

2 Commits

Author SHA1 Message Date
6c9905318b up routes debug 2021-06-14 12:48:46 +02:00
ed8c603329 add nelmioAPIdocbundle to have a swagger description in api/doc.json 2021-06-14 10:34:03 +02:00
7 changed files with 502 additions and 35 deletions

View File

@ -2,45 +2,63 @@
REST backend in symfony 5 for Funky framadate frontend.
https://framagit.org/framasoft/framadate/funky-framadate-front
------------------------------------ -------------- -------- ------ ----------------------------------------------------
Name Method Scheme Host Path
------------------------------------ -------------- -------- ------ ----------------------------------------------------
_preview_error ANY ANY ANY /_error/{code}.{_format}
admin_homepage_get_default GET ANY ANY /admin/
admin_homepage_clean_expired_polls GET ANY ANY /admin/polls/clean/{token}
admin_homepage_migrate_framadate GET ANY ANY /admin/polls/migrate
home_sweet_home GET ANY ANY /
admin_homepage_migrate_from_v1 GET ANY ANY /migration-from-v1/{unique_key}
user_homepageget_default GET ANY ANY /user/
user_homepage_polls_send_by_email GET ANY ANY /user/{email}/polls/send-by-email
poll_index GET ANY ANY /poll/
poll_new GET|POST ANY ANY /poll/new
poll_show GET ANY ANY /poll/{id}
poll_edit GET|POST ANY ANY /poll/{id}/edit
poll_delete DELETE ANY ANY /poll/{id}
api_get_poll_comment GET ANY ANY /api/v1/comment/poll/{id}/comments
api_new_comment POST ANY ANY /api/v1/comment/poll/{id}/comment
api_poll_comments_delete DELETE ANY ANY /api/v1/comment/poll/{id}/comments
api_get_all_polls GET ANY ANY /api/v1/poll/
api_get_poll GET ANY ANY /api/v1/poll/{customUrl}
api_get_protected_poll GET ANY ANY /api/v1/poll/{customUrl}/pass/{md5}
api_get_admin_poll GET ANY ANY /api/v1/polladmin/{admin_key}
api_update_poll PUT ANY ANY /api/v1/poll/{customUrl}/{token}
api_new_poll POST ANY ANY /api/v1/poll/
api_test-mail-poll GET ANY ANY /api/v1/poll/mail/test-mail-poll/{emailChoice}
api_poll_delete DELETE ANY ANY /api/v1/poll/{customUrl}
api_check_slug_is_unique GET ANY ANY /api/v1/poll/slug/{customUrl}
api_get_admin_config GET ANY ANY /api/v1/poll/admin/{token}
api_new_vote_stack POST|OPTIONS ANY ANY /api/v1/vote/poll/{custom_url}/answer
api_update_vote_stack PATCH ANY ANY /api/v1/vote/vote-stack/{id}/token/{modifierToken}
api_poll_votes_delete DELETE ANY ANY /api/v1/vote/poll/{id}/votes/{accessToken}
------------------------------------ -------------- -------- ------ ----------------------------------------------------
------------------------------------ --------------- -------- ------ --------------------------------------------------
Name Method Scheme Host Path
------------------------------------ --------------- -------- ------ --------------------------------------------------
_preview_error ANY ANY ANY /_error/{code}.{_format}
_wdt ANY ANY ANY /_wdt/{token}
_profiler_home ANY ANY ANY /_profiler/
_profiler_search ANY ANY ANY /_profiler/search
_profiler_search_bar ANY ANY ANY /_profiler/search_bar
_profiler_phpinfo ANY ANY ANY /_profiler/phpinfo
_profiler_search_results ANY ANY ANY /_profiler/{token}/search/results
_profiler_open_file ANY ANY ANY /_profiler/open
_profiler ANY ANY ANY /_profiler/{token}
_profiler_router ANY ANY ANY /_profiler/{token}/router
_profiler_exception ANY ANY ANY /_profiler/{token}/exception
_profiler_exception_css ANY ANY ANY /_profiler/{token}/exception.css
admin_homepage_get_default GET ANY ANY /admin/
admin_homepage_clean_expired_polls GET ANY ANY /admin/polls/clean/{token}
admin_homepage_migrate_framadate GET ANY ANY /admin/polls/migrate
home_sweet_home GET ANY ANY /
admin_homepage_migrate_from_v1 GET ANY ANY /migration-from-v1/{unique_key}
user_homepageget_default GET ANY ANY /user/
user_homepage_polls_send_by_email GET ANY ANY /user/{email}/polls/send-by-email
poll_index GET ANY ANY /poll/
poll_new GET|POST ANY ANY /poll/new
poll_show GET ANY ANY /poll/{id}
poll_edit GET|POST ANY ANY /poll/{id}/edit
poll_delete DELETE ANY ANY /poll/{id}
api_get_poll_comment GET ANY ANY /api/v1/comment/poll/{id}/comments
api_new_comment POST ANY ANY /api/v1/comment/poll/{id}/comment
api_poll_comments_delete DELETE ANY ANY /api/v1/comment/poll/{id}/comments
api_get_all_polls GET ANY ANY /api/v1/poll/
api_get_poll GET ANY ANY /api/v1/poll/{customUrl}
api_get_owner_poll GET ANY ANY /api/v1/poll/owner/{owner_email}/
api_get_protected_poll GET ANY ANY /api/v1/poll/{customUrl}/pass/{md5}
api_get_admin_poll GET ANY ANY /api/v1/polladmin/{admin_key}
api_update_poll PUT ANY ANY /api/v1/poll/{customUrl}/update/{token}
api_new_poll POST ANY ANY /api/v1/poll/
api_test-mail-poll GET ANY ANY /api/v1/poll/mail/test-mail-poll/{emailChoice}
api_poll_delete DELETE ANY ANY /api/v1/poll/{admin_key}
api_check_slug_is_unique GET ANY ANY /api/v1/poll/slug/{customUrl}
api_get_admin_config GET ANY ANY /api/v1/poll/admin/{token}
api_clean_expired_polls GET ANY ANY /api/v1/poll/admin/clean_expired_polls/{token}
api_new_vote_stack POST|OPTIONS ANY ANY /api/v1/vote-stack/
api_update_vote_stack PATCH|OPTIONS ANY ANY /api/v1/vote-stack/{id}/token/{modifierToken}
api_delete_vote_stack DELETE ANY ANY /api/v1/vote-stack/{id}/token/{modifierToken}
api_poll_votes_delete DELETE ANY ANY /api/v1/vote-stack/poll/{id}/votes/{accessToken}
app.swagger GET ANY ANY /api/doc.json
------------------------------------ --------------- -------- ------ --------------------------------------------------
## TODO:
https://framagit.org/tykayn/date-poll-api/-/boards
* coordinate properties and paths to be more restful.
return stack of votes when we want to get the configuration of one poll (see [doc/examples.md](doc/examples.md))
see [doc/examples.md](doc/examples.md)
***
### Requirements

View File

@ -48,6 +48,7 @@
"friendsofsymfony/rest-bundle": "^3.0",
"gedmo/doctrine-extensions": "^3.0",
"jms/serializer-bundle": "^3.9",
"nelmio/api-doc-bundle": "^4.3",
"nelmio/cors-bundle": "^2.1",
"sensio/framework-extra-bundle": "^6.1",
"symfony/asset": "5.2.*",

400
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": "9f35ffaf799b2f21e80284cb4800a791",
"content-hash": "682b7694b3126ace6a8951fae3fbf436",
"packages": [
{
"name": "behat/transliterator",
@ -2271,6 +2271,117 @@
],
"time": "2021-02-25T21:54:58+00:00"
},
{
"name": "nelmio/api-doc-bundle",
"version": "v4.3.0",
"source": {
"type": "git",
"url": "https://github.com/nelmio/NelmioApiDocBundle.git",
"reference": "40dfcf418475998c6541431711b5476b249627d3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nelmio/NelmioApiDocBundle/zipball/40dfcf418475998c6541431711b5476b249627d3",
"reference": "40dfcf418475998c6541431711b5476b249627d3",
"shasum": ""
},
"require": {
"doctrine/annotations": "^1.11",
"ext-json": "*",
"php": ">=7.1.3",
"phpdocumentor/reflection-docblock": "^3.1|^4.4|^5.0",
"psr/cache": "^1.0|^2.0|^3.0",
"psr/container": "^1.0",
"psr/log": "^1.0",
"symfony/config": "^4.4|^5.0",
"symfony/console": "^4.4|^5.0",
"symfony/dependency-injection": "^4.4|^5.0",
"symfony/framework-bundle": "^4.4|^5.0",
"symfony/http-foundation": "^4.4|^5.0",
"symfony/http-kernel": "^4.4|^5.0",
"symfony/options-resolver": "^4.4|^5.0",
"symfony/routing": "^4.4|^5.0",
"zircote/swagger-php": "^3.0"
},
"conflict": {
"symfony/framework-bundle": "4.2.7"
},
"require-dev": {
"api-platform/core": "^2.4",
"friendsofsymfony/rest-bundle": "^2.8|^3.0",
"jms/serializer": "^1.14|^3.0",
"jms/serializer-bundle": "^2.3|^3.0",
"sensio/framework-extra-bundle": "^4.4|^5.0|^6.0",
"symfony/asset": "^4.4|^5.0",
"symfony/browser-kit": "^4.4|^5.0",
"symfony/cache": "^4.4|^5.0",
"symfony/dom-crawler": "^4.4|^5.0",
"symfony/form": "^4.4|^5.0",
"symfony/phpunit-bridge": "^5.2",
"symfony/property-access": "^4.4|^5.0",
"symfony/property-info": "^4.4|^5.0",
"symfony/serializer": "^4.4|^5.0",
"symfony/stopwatch": "^4.4|^5.0",
"symfony/templating": "^4.4|^5.0",
"symfony/twig-bundle": "^4.4|^5.0",
"symfony/validator": "^4.4|^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.",
"jms/serializer-bundle": "For describing your models.",
"symfony/asset": "For using the Swagger UI.",
"symfony/cache": "For using a PSR-6 compatible cache implementation with the API doc generator.",
"symfony/form": "For describing your form type models.",
"symfony/monolog-bundle": "For using a PSR-3 compatible logger implementation with the API PHP describer.",
"symfony/property-info": "For describing your models.",
"symfony/serializer": "For describing your models.",
"symfony/validator": "For describing the validation constraints in your models.",
"twig/twig-bundle": "For using the Swagger UI.",
"willdurand/hateoas-bundle": "For extracting HATEOAS metadata."
},
"type": "symfony-bundle",
"extra": {
"branch-alias": {
"dev-master": "4.x-dev"
}
},
"autoload": {
"psr-4": {
"Nelmio\\ApiDocBundle\\": ""
},
"exclude-from-classmap": [
"Tests/"
]
},
"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"
],
"support": {
"issues": "https://github.com/nelmio/NelmioApiDocBundle/issues",
"source": "https://github.com/nelmio/NelmioApiDocBundle/tree/v4.3.0"
},
"time": "2021-06-07T17:09:58+00:00"
},
{
"name": "nelmio/cors-bundle",
"version": "2.1.1",
@ -2332,6 +2443,164 @@
},
"time": "2021-04-20T08:27:05+00:00"
},
{
"name": "phpdocumentor/reflection-common",
"version": "2.2.0",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionCommon.git",
"reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b",
"reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b",
"shasum": ""
},
"require": {
"php": "^7.2 || ^8.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-2.x": "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"
],
"support": {
"issues": "https://github.com/phpDocumentor/ReflectionCommon/issues",
"source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x"
},
"time": "2020-06-27T09:03:43+00:00"
},
{
"name": "phpdocumentor/reflection-docblock",
"version": "5.2.2",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
"reference": "069a785b2141f5bcf49f3e353548dc1cce6df556"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556",
"reference": "069a785b2141f5bcf49f3e353548dc1cce6df556",
"shasum": ""
},
"require": {
"ext-filter": "*",
"php": "^7.2 || ^8.0",
"phpdocumentor/reflection-common": "^2.2",
"phpdocumentor/type-resolver": "^1.3",
"webmozart/assert": "^1.9.1"
},
"require-dev": {
"mockery/mockery": "~1.3.2"
},
"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.",
"support": {
"issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues",
"source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/master"
},
"time": "2020-09-03T19:13:55+00:00"
},
{
"name": "phpdocumentor/type-resolver",
"version": "1.4.0",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/TypeResolver.git",
"reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0",
"reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0",
"shasum": ""
},
"require": {
"php": "^7.2 || ^8.0",
"phpdocumentor/reflection-common": "^2.0"
},
"require-dev": {
"ext-tokenizer": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-1.x": "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",
"support": {
"issues": "https://github.com/phpDocumentor/TypeResolver/issues",
"source": "https://github.com/phpDocumentor/TypeResolver/tree/1.4.0"
},
"time": "2020-09-17T18:55:26+00:00"
},
{
"name": "phpstan/phpdoc-parser",
"version": "0.5.4",
@ -6643,6 +6912,64 @@
],
"time": "2021-05-16T12:14:13+00:00"
},
{
"name": "webmozart/assert",
"version": "1.10.0",
"source": {
"type": "git",
"url": "https://github.com/webmozarts/assert.git",
"reference": "6964c76c7804814a842473e0c8fd15bab0f18e25"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25",
"reference": "6964c76c7804814a842473e0c8fd15bab0f18e25",
"shasum": ""
},
"require": {
"php": "^7.2 || ^8.0",
"symfony/polyfill-ctype": "^1.8"
},
"conflict": {
"phpstan/phpstan": "<0.12.20",
"vimeo/psalm": "<4.6.1 || 4.6.2"
},
"require-dev": {
"phpunit/phpunit": "^8.5.13"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.10-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"
],
"support": {
"issues": "https://github.com/webmozarts/assert/issues",
"source": "https://github.com/webmozarts/assert/tree/1.10.0"
},
"time": "2021-03-09T10:59:23+00:00"
},
{
"name": "willdurand/jsonp-callback-validator",
"version": "v1.1.0",
@ -6742,6 +7069,77 @@
"source": "https://github.com/willdurand/Negotiation/tree/3.0.0"
},
"time": "2020-09-25T08:01:41+00:00"
},
{
"name": "zircote/swagger-php",
"version": "3.2.1",
"source": {
"type": "git",
"url": "https://github.com/zircote/swagger-php.git",
"reference": "eef1dd98e6f6071573908fd7007270510051e5f9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zircote/swagger-php/zipball/eef1dd98e6f6071573908fd7007270510051e5f9",
"reference": "eef1dd98e6f6071573908fd7007270510051e5f9",
"shasum": ""
},
"require": {
"doctrine/annotations": "^1.7",
"ext-json": "*",
"php": ">=7.2",
"symfony/finder": ">=2.2",
"symfony/yaml": ">=3.3"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.16",
"phpunit/phpunit": ">=8"
},
"bin": [
"bin/openapi"
],
"type": "library",
"autoload": {
"psr-4": {
"OpenApi\\": "src"
},
"files": [
"src/functions.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Robert Allen",
"email": "zircote@gmail.com"
},
{
"name": "Bob Fanger",
"email": "bfanger@gmail.com",
"homepage": "https://bfanger.nl"
},
{
"name": "Martin Rademacher",
"email": "mano@radebatz.net",
"homepage": "https://radebatz.net"
}
],
"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"
],
"support": {
"issues": "https://github.com/zircote/swagger-php/issues",
"source": "https://github.com/zircote/swagger-php/tree/3.2.1"
},
"time": "2021-05-20T21:46:24+00:00"
}
],
"packages-dev": [

View File

@ -14,4 +14,5 @@ return [
Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true],
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true],
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::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

@ -150,6 +150,19 @@
"laminas/laminas-zendframework-bridge": {
"version": "1.2.0"
},
"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"
]
},
"nelmio/cors-bundle": {
"version": "1.5",
"recipe": {
@ -168,6 +181,15 @@
"php": {
"version": "8.0"
},
"phpdocumentor/reflection-common": {
"version": "2.2.0"
},
"phpdocumentor/reflection-docblock": {
"version": "5.2.2"
},
"phpdocumentor/type-resolver": {
"version": "1.4.0"
},
"phpstan/phpdoc-parser": {
"version": "0.4.14"
},
@ -454,10 +476,16 @@
"twig/twig": {
"version": "v3.3.0"
},
"webmozart/assert": {
"version": "1.10.0"
},
"willdurand/jsonp-callback-validator": {
"version": "v1.1.0"
},
"willdurand/negotiation": {
"version": "3.0.0"
},
"zircote/swagger-php": {
"version": "3.2.1"
}
}