Closed the-mikedavis closed 3 years ago
:wave: hello!
I have a minimal example repo here: https://github.com/the-mikedavis/nimble_example, with the schema definition here and tests that exhibit the behaviour here
Given a schema like so (similar to a snippet in the documentation):
[ foo: [ type: :keyword_list, keys: [*: [type: :atom]] ] ]
we can properly validate a set of input options:
iex(1)> NimbleOptions.validate([foo: [bar: :baz]], schema()) {:ok, [foo: [bar: :baz]]}
but trying to document this schema will fail:
iex(2)> NimbleOptions.docs(schema()) ** (Protocol.UndefinedError) protocol Enumerable not implemented for nil of type Atom. This protocol is implemented for the following type(s): Map, Stream, Range, Date.Range, List, GenEvent.Stream, Function, File.Stream, HashDict, MapSet, IO.Stream, HashSet (elixir 1.11.0) lib/enum.ex:1: Enumerable.impl_for!/1 (elixir 1.11.0) lib/enum.ex:141: Enumerable.reduce/3 (elixir 1.11.0) lib/enum.ex:3461: Enum.reduce/3 (nimble_options 0.3.5) lib/nimble_options/docs.ex:61: NimbleOptions.Docs.option_doc/2 (elixir 1.11.0) lib/enum.ex:2181: Enum."-reduce/3-lists^foldl/2-0-"/3 (nimble_options 0.3.5) lib/nimble_options/docs.ex:6: NimbleOptions.Docs.generate/2
I'm using these versions
thanks!
@the-mikedavis thanks for reporting this issue!
:wave: hello!
I have a minimal example repo here: https://github.com/the-mikedavis/nimble_example, with the schema definition here and tests that exhibit the behaviour here
Given a schema like so (similar to a snippet in the documentation):
we can properly validate a set of input options:
but trying to document this schema will fail:
I'm using these versions
thanks!