php - NelmioApiDocBundle 的渲染问题
问题描述
我对“NelmioApiDocBundle”包有疑问。
我的渲染 https://localhost:8000/api/doc
当它应该是更多的设计时,渲染是原始的。
***routes.yaml***
api_login_check:
path: /api/login_check
app.swagger:
path: /api/doc
methods: GET
defaults: { _controller: nelmio_api_doc.controller.swagger }
我的包裹
***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],
];
你有过这样的问题吗?
谢谢
解决方案
我刚遇到同样的问题,你试过了吗
$ composer require asset
?
那为我修好了。
当我注意到 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 }
我首先尝试用不带“.json”的 /api/doc 替换第一个块中的路径,但这不起作用,然后我阅读了第二个块,我花了一段时间才发现实际问题。
推荐阅读
- javascript - 为什么打字稿编译器会在服务器启动时更改我的 tsconfig.json 文件?
- apache-kafka - Kafka 中的内部和外部通信
- c++ - 在 OpenCV 4 (c++) 中设置颜色限制轴,类似于 Matlab 的 CAXIS
- c++ - 如何使用 C++ 独立 ASIO 库
- angular - Angular 6 搜索引擎优化路由
- git - 使用 Git 搜索特定用户修改的给定文件夹中的文件
- php - seo 友好的 url 使用西里尔字符 х 字符,它总是得到 404。如何修复它?
- python - 我可以在 MacOS 上使用 Keras ImageDataGenerator().flow_from_directory 跳过文件吗?
- scala - 斯卡拉
.reduce 泛型类型的奇怪行为 - java - Spring Boot 测试 HttpMessageNotReadableException