api-hogs / bureaucrat

Generate Phoenix API documentation from tests
https://hexdocs.pm/bureaucrat/api-reference.html
The Unlicense
368 stars 73 forks source link

Pls provide an updated example without slate integration | Example bug? #76

Open snackfart opened 2 years ago

snackfart commented 2 years ago

Also this test "GET /api/v1/products" do conn = conn() |> get("/api/v1/products") |> doc assert conn.status == 200 end

generates following error message after running "DOC=1 mix test":

== Compilation error in file test/backend_web/controllers/page_controller_test.exs == ** (CompileError) test/backend_web/controllers/page_controller_test.exs:16: undefined function conn/0 (elixir 1.12.2) src/elixir_locals.erl:114: anonymous fn/3 in :elixir_locals.ensure_no_undefined_local/3 (stdlib 3.15.2) erl_eval.erl:685: :erl_eval.do_apply/6 (elixir 1.12.2) lib/kernel/parallel_compiler.ex:428: Kernel.ParallelCompiler.require_file/2 (elixir 1.12.2) lib/kernel/parallel_compiler.ex:321: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/7

I´m using Elixir version "1.12.2" with Phoenix 1.5.12 and this version of bureaucrat: {:bureaucrat, git: "https://github.com/api-hogs/bureaucrat.git", only: [:dev, :test]} (but it also doesnt work with version 0.2.7)

fastjames commented 2 years ago

@snackfart I submitted a PR (which was merged) that corrects the syntax in the example you quoted above. Thanks for the heads-up!