Skip to content

Commit

Permalink
Confess map types are not supported (ref dry-rb/dry-schema#467)
Browse files Browse the repository at this point in the history
  • Loading branch information
flash-gordon committed Sep 6, 2023
1 parent f2dcc91 commit 04c6660
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/dry/types/predicate_inferrer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,11 @@ def visit_predicate(node)
end
end

# @api private
def visit_map(_node)
raise NotImplementedError, "map types are not supported yet"
end

private

# @api private
Expand Down
6 changes: 6 additions & 0 deletions spec/dry/types/predicate_inferrer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -188,4 +188,10 @@ def type(*args)
expect(inferrer[custom_type]).to eql([type?: custom_type.primitive])
end
end

it "tells that map types are not supported" do
expect {
inferrer[type(:hash).map("integer", "string")]
}.to raise_error(NotImplementedError, /map types are not supported/)
end
end

0 comments on commit 04c6660

Please sign in to comment.