Skip to content

Swagger & Slate Integration consistently erroring #100

@hgg

Description

@hgg

What I'm trying achieve

I'm trying to use the integration with Swagger & Slate to generate API docs automatically.
I've followed to the letter the guidelines.

What is happening

When I run DOC=1 mix test, all the tests pass but I get the following error:

11:09:17.606 [error] GenServer #PID<0.519.0> terminating
** (Protocol.UndefinedError) protocol Enumerable not implemented for nil of type Atom. This protocol is implemented for the following type(s): DBConnection.PrepareStream, DBConnection.Stream, Date.Range, Ecto.Adapters.SQL.Stream, File.Stream, Function, GenEvent.Stream, HashDict, HashSet, IO.Stream, Jason.OrderedObject, List, Map, MapSet, Phoenix.LiveView.LiveStream, Postgrex.Stream, Range, Stream
    (elixir 1.14.5) lib/enum.ex:1: Enumerable.impl_for!/1
    (elixir 1.14.5) lib/enum.ex:166: Enumerable.reduce/3
    (elixir 1.14.5) lib/enum.ex:1150: Enum.find/3
    (bureaucrat 0.2.9) lib/bureaucrat/swagger_slate_markdown_writer.ex:236: Bureaucrat.SwaggerSlateMarkdownWriter.write_operations_for_tag/4
    (elixir 1.14.5) lib/enum.ex:975: Enum."-each/2-lists^foreach/1-0-"/2
    (elixir 1.14.5) lib/enum.ex:1662: anonymous fn/3 in Enum.map/2
    (stdlib 5.0.2) maps.erl:416: :maps.fold_1/4
    (elixir 1.14.5) lib/enum.ex:2480: Enum.map/2
    (bureaucrat 0.2.9) lib/bureaucrat/formatter.ex:22: Bureaucrat.Formatter.suite_finished/0
    (stdlib 5.0.2) gen_server.erl:1103: :gen_server.try_handle_cast/3
    (stdlib 5.0.2) gen_server.erl:1165: :gen_server.handle_msg/6
    (stdlib 5.0.2) proc_lib.erl:241: :proc_lib.init_p_do_apply/3
Last message: {:"$gen_cast", {:suite_finished, %{async: 163093, run: 509077, load: nil}}}
11:09:17.612 [error] Task #PID<0.501.0> started from #PID<0.101.0> terminating
** (stop) exited in: GenServer.stop(#PID<0.519.0>, :normal, :infinity)
    ** (EXIT) exited in: :sys.terminate(#PID<0.519.0>, :normal, :infinity)
        ** (EXIT) an exception was raised:
            ** (Protocol.UndefinedError) protocol Enumerable not implemented for nil of type Atom. This protocol is implemented for the following type(s): DBConnection.PrepareStream, DBConnection.Stream, Date.Range, Ecto.Adapters.SQL.Stream, File.Stream, Function, GenEvent.Stream, HashDict, HashSet, IO.Stream, Jason.OrderedObject, List, Map, MapSet, Phoenix.LiveView.LiveStream, Postgrex.Stream, Range, Stream
                (elixir 1.14.5) lib/enum.ex:1: Enumerable.impl_for!/1
                (elixir 1.14.5) lib/enum.ex:166: Enumerable.reduce/3
                (elixir 1.14.5) lib/enum.ex:1150: Enum.find/3
                (bureaucrat 0.2.9) lib/bureaucrat/swagger_slate_markdown_writer.ex:236: Bureaucrat.SwaggerSlateMarkdownWriter.write_operations_for_tag/4
                (elixir 1.14.5) lib/enum.ex:975: Enum."-each/2-lists^foreach/1-0-"/2
                (elixir 1.14.5) lib/enum.ex:1662: anonymous fn/3 in Enum.map/2
                (stdlib 5.0.2) maps.erl:416: :maps.fold_1/4
                (elixir 1.14.5) lib/enum.ex:2480: Enum.map/2
                (bureaucrat 0.2.9) lib/bureaucrat/formatter.ex:22: Bureaucrat.Formatter.suite_finished/0
                (stdlib 5.0.2) gen_server.erl:1103: :gen_server.try_handle_cast/3
                (stdlib 5.0.2) gen_server.erl:1165: :gen_server.handle_msg/6
                (stdlib 5.0.2) proc_lib.erl:241: :proc_lib.init_p_do_apply/3
    (elixir 1.14.5) lib/gen_server.ex:995: GenServer.stop/3
    (ex_unit 1.14.5) lib/ex_unit/event_manager.ex:22: anonymous fn/2 in ExUnit.EventManager.stop/1
    (elixir 1.14.5) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3
    (ex_unit 1.14.5) lib/ex_unit/event_manager.ex:21: ExUnit.EventManager.stop/1
    (ex_unit 1.14.5) lib/ex_unit/runner.ex:62: ExUnit.Runner.run_with_trap/2
    (ex_unit 1.14.5) lib/ex_unit/runner.ex:31: ExUnit.Runner.run/2
    (elixir 1.14.5) lib/task/supervised.ex:89: Task.Supervised.invoke_mfa/2
    (elixir 1.14.5) lib/task/supervised.ex:34: Task.Supervised.reply/4
    (stdlib 5.0.2) proc_lib.erl:241: :proc_lib.init_p_do_apply/3
Function: #Function<0.96829595/0 in ExUnit.async_run/0>
    Args: []
** (EXIT from #PID<0.101.0>) exited in: GenServer.stop(#PID<0.519.0>, :normal, :infinity)
    ** (EXIT) exited in: :sys.terminate(#PID<0.519.0>, :normal, :infinity)
        ** (EXIT) an exception was raised:
            ** (Protocol.UndefinedError) protocol Enumerable not implemented for nil of type Atom. This protocol is implemented for the following type(s): DBConnection.PrepareStream, DBConnection.Stream, Date.Range, Ecto.Adapters.SQL.Stream, File.Stream, Function, GenEvent.Stream, HashDict, HashSet, IO.Stream, Jason.OrderedObject, List, Map, MapSet, Phoenix.LiveView.LiveStream, Postgrex.Stream, Range, Stream
                (elixir 1.14.5) lib/enum.ex:1: Enumerable.impl_for!/1
                (elixir 1.14.5) lib/enum.ex:166: Enumerable.reduce/3
                (elixir 1.14.5) lib/enum.ex:1150: Enum.find/3
                (bureaucrat 0.2.9) lib/bureaucrat/swagger_slate_markdown_writer.ex:236: Bureaucrat.SwaggerSlateMarkdownWriter.write_operations_for_tag/4
                (elixir 1.14.5) lib/enum.ex:975: Enum."-each/2-lists^foreach/1-0-"/2
                (elixir 1.14.5) lib/enum.ex:1662: anonymous fn/3 in Enum.map/2
                (stdlib 5.0.2) maps.erl:416: :maps.fold_1/4
                (elixir 1.14.5) lib/enum.ex:2480: Enum.map/2
                (bureaucrat 0.2.9) lib/bureaucrat/formatter.ex:22: Bureaucrat.Formatter.suite_finished/0
                (stdlib 5.0.2) gen_server.erl:1103: :gen_server.try_handle_cast/3
                (stdlib 5.0.2) gen_server.erl:1165: :gen_server.handle_msg/6
                (stdlib 5.0.2) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

What I've tried

  • Adding the operation_id(...) to the operations in question.
    FYI this is missing from the guidelines. Let me know if you'd like me to add it.

Am I missing something? The swagger.json file seems to be being generated fine, but both the markdown and the HTML generated from it don't include any operations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions