aboutsummaryrefslogtreecommitdiffhomepage
path: root/app
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-10-15 16:46:42 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-10-15 16:46:42 +0200
commitf1c3f68e909e51f071f3f4b2ef9430163bbfd7a4 (patch)
tree20a6ebbd686d76d1907dc17af8eeeb963d7a27e9 /app
parent61477368687e048f3001336327923f5c87fa2592 (diff)
downloadwallabag-f1c3f68e909e51f071f3f4b2ef9430163bbfd7a4.tar.gz
wallabag-f1c3f68e909e51f071f3f4b2ef9430163bbfd7a4.tar.zst
wallabag-f1c3f68e909e51f071f3f4b2ef9430163bbfd7a4.zip
ApiDoc & Route annotation were conflicted
The generated error was “Unable to guess how to get a Doctrine instance from the request information.”. I haven’t checked deeper in Doctrine (I know it was coming from the DoctrineParamConverter). Anyway, I check for FosRest possiblity to add extra format without allowing them for every route (like it was done in the first place). I finally found a way but it then seems all request goes to the FormatListener of FosRest so I needed to add a custom rules to match all request to be sure we don’t get a 406 error from FosRest. Should be ok now …
Diffstat (limited to 'app')
-rw-r--r--app/config/config.yml27
-rw-r--r--app/config/routing_rest.yml5
2 files changed, 27 insertions, 5 deletions
diff --git a/app/config/config.yml b/app/config/config.yml
index 2f102c45..b4760073 100644
--- a/app/config/config.yml
+++ b/app/config/config.yml
@@ -112,12 +112,26 @@ swiftmailer:
112fos_rest: 112fos_rest:
113 param_fetcher_listener: true 113 param_fetcher_listener: true
114 body_listener: true 114 body_listener: true
115 format_listener: true
116 view: 115 view:
116 mime_types:
117 csv:
118 - 'text/csv'
119 - 'text/plain'
120 pdf:
121 - 'application/pdf'
122 epub:
123 - 'application/epub+zip'
124 mobi:
125 - 'application/x-mobipocket-ebook'
117 view_response_listener: 'force' 126 view_response_listener: 'force'
118 formats: 127 formats:
119 xml: true 128 xml: true
120 json : true 129 json: true
130 txt: true
131 csv: true
132 pdf: true
133 epub: true
134 mobi: true
121 templating_formats: 135 templating_formats:
122 html: true 136 html: true
123 force_redirects: 137 force_redirects:
@@ -126,6 +140,15 @@ fos_rest:
126 default_engine: twig 140 default_engine: twig
127 routing_loader: 141 routing_loader:
128 default_format: json 142 default_format: json
143 format_listener:
144 enabled: true
145 rules:
146 - { path: "^/api/entries/([0-9]+)/export.(.*)", priorities: ['epub', 'mobi', 'pdf', 'txt', 'csv'], fallback_format: false, prefer_extension: false }
147 - { path: "^/api", priorities: ['json', 'xml'], fallback_format: false, prefer_extension: false }
148 - { path: "^/annotations", priorities: ['json', 'xml'], fallback_format: false, prefer_extension: false }
149 # for an unknown reason, EACH REQUEST goes to FOS\RestBundle\EventListener\FormatListener
150 # so we need to add custom rule for custom api export but also for all other routes of the application...
151 - { path: '^/', priorities: ['text/html', '*/*'], fallback_format: html, prefer_extension: false }
129 152
130nelmio_api_doc: 153nelmio_api_doc:
131 sandbox: 154 sandbox:
diff --git a/app/config/routing_rest.yml b/app/config/routing_rest.yml
index 52d395dd..29f4ab14 100644
--- a/app/config/routing_rest.yml
+++ b/app/config/routing_rest.yml
@@ -1,4 +1,3 @@
1Rest_Wallabag: 1Rest_Wallabag:
2 type : rest 2 type : rest
3 resource: "@WallabagApiBundle/Resources/config/routing_rest.yml" 3 resource: "@WallabagApiBundle/Resources/config/routing_rest.yml"
4