2

I've installed the NelmioApiDocBundle for my new API-oriented project in Symfony and I can't get rid of the .{_format} suffix that this bundle adds to all my endpoint URLs.

This is how it looks:

Screenshot from NelmioApiDocBundle with format suffix

My API does not support the _format as suffix. It does support it as a query parameter or by request headers. Because of that, if I try to do a request to this endpoint from the NelmioApiDocBundle sandbox, it gets a 404 error response.

This is my current config.yml section regarding nelmio:

yml nelmio_api_doc: name: My API doc sandbox: enabled: true endpoint: null accept_type: application/json body_format: formats: null default_format: json request_format: formats: json: application/json xml: null method: accept_header default_format: json authentication: name: bearer delivery: query cache: enabled: false file: '%kernel.cache_dir%/api-doc.cache'

Najki
  • 514
  • 6
  • 22

1 Answers1

9

I've figured it out elsewhere on stackoverflow. It seems that my problem was not related to NelmioApiDocBundle, but to FOSRestBundle. I've had to change only one FOSRest setting in config.yml:

fos_rest:
    routing_loader:
        include_format: false

I've found the solution here

Community
  • 1
  • 1
Najki
  • 514
  • 6
  • 22