# Dynamic Schemas in 1.x

**URL:** <https://discourse.dry-rb.org/t/dynamic-schemas-in-1-x/1184>\
**Category:** dry-validation\
**Created:** [January 14, 2021, 8:47am UTC](https://discourse.dry-rb.org/t/dynamic-schemas-in-1-x/1184 "2021-01-14T08:47:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lteyjolfur](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dry-rb.org/lteyjolfur/32/591_2.png) [@lteyjolfur](https://discourse.dry-rb.org/u/lteyjolfur)\
**Post date:** [January 14, 2021, 8:47am UTC](https://discourse.dry-rb.org/t/dynamic-schemas-in-1-x/1184/1 "2021-01-14T08:47:35Z")

</div>

In 0.x it was possible to make schemas have different form based on a rule or an option

```auto
SCHEMA = Dry::Validation.JSON do
  configure do
    option :product
    def use_outcome_hash?
      product.eql?('fizz')
    end
  end
  required(:outcome).filled
  rule(validate_outcome: [:outcome]) do |outcome|
     use_outcome_hash?.then(outcome.schema(OUTCOME))
   end
end

```

I am looking to migrate to 1.x because 0.x doesn’t seem to play nicely with ruby 2.7.  
I haven’t been able to find similar functionality in 1.x is there any way to do it or do I have to create a separate schema for each scenario?

---

<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:** [January 25, 2021, 5:44am UTC](https://discourse.dry-rb.org/t/dynamic-schemas-in-1-x/1184/2 "2021-01-25T05:44:03Z")

</div>

Hey sorry for late reply. It’s hard to say because like always, it depends on the use case. You can use custom rules based on additional conditions in dry-validation 1.x. You have access to contract’s methods within rule blocks so you can simply leverage that.
