编译错误函数PhoenixSwagger.Plug.SwaggerUI.init / 1未定义Elixir v1.4

时间:2017-04-04 01:16:24

标签: phoenix

使用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`

1 个答案:

答案 0 :(得分:0)

遇到同样的问题。

更新到最新的phoenix_swagger并以这种方式定义:

forward "/", PhoenixSwagger.Plug.SwaggerUI, otp_app: :myapp, swagger_file: "swagger.json", opts: [disable_validator: true]