首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >NelmioApiDocBundle的渲染问题

NelmioApiDocBundle的渲染问题
EN

Stack Overflow用户
提问于 2020-01-08 10:24:01
回答 1查看 358关注 0票数 0

我对"NelmioApiDocBundle“包有个问题。

我的渲染https://localhost:8000/api/doc

渲染是原始的,当它应该是更多的设计。

代码语言:javascript
复制
***routes.yaml***

api_login_check:
        path: /api/login_check

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

我的捆绑

代码语言:javascript
复制
***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],

];

你有这种问题吗?

谢谢

EN

回答 1

Stack Overflow用户

发布于 2020-03-26 23:00:39

我刚经历了同样的问题,你有没有试过

$ composer require asset

帮我修好了。

当我注意到config/ flash /dev/nelmio_api_doc.yaml时,我闪现了一下。

代码语言:javascript
复制
# 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 }

我首先尝试将第一个块中的路径替换为/api/doc,但没有使用".json“,但这不起作用,然后我阅读了第二个块,我花了一段时间才发现实际的问题。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59643813

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档