Skip to content

Commit 3f9e8af

Browse files
committed
Allow use of symbol for configuration top_namespace
1 parent 13ddb51 commit 3f9e8af

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/dry/schema/config.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class Config
4646
setting :backend, default: :yaml
4747
setting :namespace
4848
setting :load_paths, default: ::Set[DEFAULT_MESSAGES_PATH], constructor: :dup.to_proc
49-
setting :top_namespace, default: DEFAULT_MESSAGES_ROOT
49+
setting :top_namespace, default: DEFAULT_MESSAGES_ROOT, constructor: :to_s.to_proc
5050
setting :default_locale
5151
end
5252

spec/integration/messages/namespaced_spec.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,12 @@
8989

9090
expect(result.errors(full: true)[:post_body]).to eql(["(dry_validation) Post body must be filled"])
9191
end
92+
93+
it "allows symbol for top namespace" do
94+
schema = Dry::Schema.Params do
95+
config.messages.top_namespace = :dry_validation
96+
end
97+
assert_equal "dry_validation", schema.config.messages.top_namespace
98+
end
9299
end
93100
end

0 commit comments

Comments
 (0)