0

I have a problem with the bundle "NelmioApiDocBundle".

my rendering https://localhost:8000/api/doc

The rendering is raw when it should be much more design.

***routes.yaml***

api_login_check:
        path: /api/login_check

    app.swagger:
        path: /api/doc
        methods: GET
        defaults: { _controller: nelmio_api_doc.controller.swagger }

my bundles

***bundles.php***

return [
    Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
    Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
    Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
    Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
    Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
    Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
    Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
    Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
    Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
    Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true],
    Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
    Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true],
    Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle::class => ['all' => true],
    Nelmio\ApiDocBundle\NelmioApiDocBundle::class => ['all' => true],

];

Did you have this kind of problem?

Thanks

ivan
  • 1

1 Answers1

1

I just went through the same issue, have you tried

$ composer require asset ?

That fixed it for me.

I had a flash when I noticed in config/routes/dev/nelmio_api_doc.yaml

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

I first tried to replace the path in the first block by /api/doc without the ".json" but that didn't work, then I read the second block, it took me a while to spot the actual problem.

Patronics
  • 1,351
  • 1
  • 16
  • 27
johnnyBoy
  • 115
  • 2
  • 12