使用PhoenixSwagger会导致编译错误 使用凤凰招摇
# mix file
{:phoenix_swagger, "~> 0.4.0"}
# router.ex
use PhoenixSwagger
..
scope "/api/swagger" do
forward "/", PhoenixSwagger.Plug.SwaggerUI, otp_app: :http, swagger_file: "swagger.json"
end
`== Compilation error on file web/router.ex ==
** (UndefinedFunctionError) function PhoenixSwagger.Plug.SwaggerUI.init/1 is undefined (module PhoenixSwagger.Plug.SwaggerUI is not available`
答案 0 :(得分:0)
遇到同样的问题。
更新到最新的phoenix_swagger
并以这种方式定义:
forward "/", PhoenixSwagger.Plug.SwaggerUI, otp_app: :myapp, swagger_file: "swagger.json", opts: [disable_validator: true]