From e7ed4c95ea219a988286bc04378fe70620abab1a Mon Sep 17 00:00:00 2001 From: Vadim Tsvetkov Date: Fri, 4 Apr 2025 17:31:10 +0300 Subject: [PATCH] Fix ignoring schema when wildcard-key is defined --- lib/nimble_options.ex | 2 +- test/nimble_options_test.exs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/nimble_options.ex b/lib/nimble_options.ex index 4c00ad3..1653f0f 100644 --- a/lib/nimble_options.ex +++ b/lib/nimble_options.ex @@ -898,7 +898,7 @@ defmodule NimbleOptions do keys schema_opts -> - Enum.map(opts, fn {k, _} -> {k, schema_opts} end) + keys ++ Enum.map(opts, fn {k, _} -> {k, schema_opts} end) end end diff --git a/test/nimble_options_test.exs b/test/nimble_options_test.exs index 72c487e..39d319b 100644 --- a/test/nimble_options_test.exs +++ b/test/nimble_options_test.exs @@ -93,6 +93,11 @@ defmodule NimbleOptionsTest do assert NimbleOptions.validate([context: :given], schema) == {:ok, [context: :given]} end + test "is used when wildcard-key is defined" do + schema = [context: [default: :ok], *: [type: :any]] + assert NimbleOptions.validate([], schema) == {:ok, [context: :ok]} + end + test "is validated" do schema = [ processors: [