mirror of
https://github.com/wallabag/wallabag.git
synced 2025-08-01 17:38:38 +00:00
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 …
This commit is contained in:
parent
6147736868
commit
f1c3f68e90
4 changed files with 29 additions and 9 deletions
|
@ -112,12 +112,26 @@ swiftmailer:
|
|||
fos_rest:
|
||||
param_fetcher_listener: true
|
||||
body_listener: true
|
||||
format_listener: true
|
||||
view:
|
||||
mime_types:
|
||||
csv:
|
||||
- 'text/csv'
|
||||
- 'text/plain'
|
||||
pdf:
|
||||
- 'application/pdf'
|
||||
epub:
|
||||
- 'application/epub+zip'
|
||||
mobi:
|
||||
- 'application/x-mobipocket-ebook'
|
||||
view_response_listener: 'force'
|
||||
formats:
|
||||
xml: true
|
||||
json : true
|
||||
json: true
|
||||
txt: true
|
||||
csv: true
|
||||
pdf: true
|
||||
epub: true
|
||||
mobi: true
|
||||
templating_formats:
|
||||
html: true
|
||||
force_redirects:
|
||||
|
@ -126,6 +140,15 @@ fos_rest:
|
|||
default_engine: twig
|
||||
routing_loader:
|
||||
default_format: json
|
||||
format_listener:
|
||||
enabled: true
|
||||
rules:
|
||||
- { path: "^/api/entries/([0-9]+)/export.(.*)", priorities: ['epub', 'mobi', 'pdf', 'txt', 'csv'], fallback_format: false, prefer_extension: false }
|
||||
- { path: "^/api", priorities: ['json', 'xml'], fallback_format: false, prefer_extension: false }
|
||||
- { path: "^/annotations", priorities: ['json', 'xml'], fallback_format: false, prefer_extension: false }
|
||||
# for an unknown reason, EACH REQUEST goes to FOS\RestBundle\EventListener\FormatListener
|
||||
# so we need to add custom rule for custom api export but also for all other routes of the application...
|
||||
- { path: '^/', priorities: ['text/html', '*/*'], fallback_format: html, prefer_extension: false }
|
||||
|
||||
nelmio_api_doc:
|
||||
sandbox:
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
Rest_Wallabag:
|
||||
type : rest
|
||||
resource: "@WallabagApiBundle/Resources/config/routing_rest.yml"
|
||||
|
||||
type : rest
|
||||
resource: "@WallabagApiBundle/Resources/config/routing_rest.yml"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue