# \[dry-schema\] Custom types, hash map - undefined visit\_map

**URL:** <https://discourse.dry-rb.org/t/dry-schema-custom-types-hash-map-undefined-visit-map/926>\
**Category:** Uncategorized\
**Created:** [October 12, 2019, 5:49am UTC](https://discourse.dry-rb.org/t/dry-schema-custom-types-hash-map-undefined-visit-map/926 "2019-10-12T05:49:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![borowskiio](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dry-rb.org/borowskiio/32/466_2.png) [@borowskiio](https://discourse.dry-rb.org/u/borowskiio)\
**Post date:** [October 12, 2019, 5:49am UTC](https://discourse.dry-rb.org/t/dry-schema-custom-types-hash-map-undefined-visit-map/926/1 "2019-10-12T05:49:41Z")

</div>

Hi all,

I am trying to define a schema with a custom type being a dry types hash map:

```ruby
schema = Dry::Schema.Params do
  optional(:hash).filled(Dry::Types['hash'].map(Integer, Array))
end

```

And I get the following error:

```auto
NoMethodError: undefined method `visit_map' for #<Dry::Schema::PredicateInferrer::Compiler:0x0000000008711bc0>
Did you mean? visit_and
               visit_any
               visit_sum
               visit_lax
               visit_hash

```

What am I missing here?

EDIT:

It looks like I can work around this by using a constructor:

```ruby
schema = Dry::Schema.Params do
  optional(:hash).filled(Dry::Types['hash'].constructor { |values| Dry::Types['hash'].map(Integer, Array)[values] })
end

```

I admit however the form I tried to use initially would be more convenient.

---

<div class="post-metadata">

**Author:** ![flash-gordon](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dry-rb.org/flash-gordon/32/494_2.png) [@flash-gordon](https://discourse.dry-rb.org/u/flash-gordon)\
**Post date:** [October 12, 2019, 12:18pm UTC](https://discourse.dry-rb.org/t/dry-schema-custom-types-hash-map-undefined-visit-map/926/2 "2019-10-12T12:18:06Z")

</div>

This is not supported, not all types are supported. We will likely end up with adding this instead: [https://github.com/dry-rb/dry-schema/issues/37](https://github.com/dry-rb/dry-schema/issues/37)
