# Ignoring key validation completely

**URL:** <https://discourse.dry-rb.org/t/ignoring-key-validation-completely/1165>\
**Category:** dry-validation\
**Created:** [December 1, 2020, 11:49am UTC](https://discourse.dry-rb.org/t/ignoring-key-validation-completely/1165 "2020-12-01T11:49:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![adamransom](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dry-rb.org/adamransom/32/580_2.png) [@adamransom](https://discourse.dry-rb.org/u/adamransom)\
**Post date:** [December 1, 2020, 11:49am UTC](https://discourse.dry-rb.org/t/ignoring-key-validation-completely/1165/1 "2020-12-01T11:49:13Z")

</div>

I would like to be able to opt-out of key validation entirely, rather than having to decide between `required` and `optional`, because, for example, we’ve validated earlier that keys are present if they need to be.

It would work like this:

`key(:something).filled(:string)`

and whether or not the key was present, we would get back a `filled?` error if the value isn’t present (because either the key is missing or the key is there but no value is).

I’ve hacked this in myself, but it’s ugly because I need to either always define my params with `key(:something, macro: CustomKey)` or monkey patch the `DSL` class to add my own method.

It’s great that dry-schema has the ability to distinguish between missing keys and missing values (and I do use this), but sometimes you don’t care and just want the value validation to happen.

Is this something you’d consider allowing (either natively or by allowing extension of the DSL)?

---

<div class="post-metadata">

**Author:** ![solnic](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dry-rb.org/solnic/32/779_2.png) [@solnic](https://discourse.dry-rb.org/u/solnic)\
**Post date:** [December 8, 2020, 10:33am UTC](https://discourse.dry-rb.org/t/ignoring-key-validation-completely/1165/2 "2020-12-08T10:33:29Z")

</div>

@adamransom this makes sense, we’d only have to tweak `key` method in the DSL to make it simpler to use w/o any extra options. Feel free to report an issue about it 🙂

---

<div class="post-metadata">

**Author:** ![alassek](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dry-rb.org/alassek/32/314_2.png) [@alassek](https://discourse.dry-rb.org/u/alassek)\
**Post date:** [December 9, 2020, 11:57pm UTC](https://discourse.dry-rb.org/t/ignoring-key-validation-completely/1165/3 "2020-12-09T23:57:34Z")

</div>

I’ve been doing a _lot_ of schemas lately and while this specific use-case hasn’t come up, it does sound pretty useful.
