dashbitco / nimble_options

A tiny library for validating and documenting high-level options. 💽
Apache License 2.0
507 stars 38 forks source link

Fix schema_to_spec by adding tuple to `type_to_spec` #110

Closed camilleryr closed 1 year ago

camilleryr commented 1 year ago

When attempting to add @type option() :: unquote(NimbleOptions.option_typespec(@definition)) to our project I was met with the following error

** (CaseClauseError) no case clause matching: {:tuple, [:string, :string]}
    (nimble_options 0.5.2) lib/nimble_options/docs.ex:180: NimbleOptions.Docs.type_to_spec/1
    (nimble_options 0.5.2) lib/nimble_options/docs.ex:250: NimbleOptions.Docs.type_to_spec/1
    (nimble_options 0.5.2) lib/nimble_options/docs.ex:173: anonymous fn/1 in NimbleOptions.Docs.schema_to_spec/1

I have added a test that failed and fixed the issue by extending type_to_spec/1 to accept the tuple spec

As always - thanks for all you do and let me know if there are any changes you would like to see to this work!

whatyouhide commented 1 year ago

Thanks @camilleryr! ❤️