# How to use existing schema with Contract?

**URL:** <https://discourse.dry-rb.org/t/how-to-use-existing-schema-with-contract/834>\
**Category:** dry-validation\
**Created:** [July 13, 2019, 4:43pm UTC](https://discourse.dry-rb.org/t/how-to-use-existing-schema-with-contract/834 "2019-07-13T16:43:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![shanecav](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dry-rb.org/shanecav/32/409_2.png) [@shanecav](https://discourse.dry-rb.org/u/shanecav)\
**Post date:** [July 13, 2019, 4:43pm UTC](https://discourse.dry-rb.org/t/how-to-use-existing-schema-with-contract/834/1 "2019-07-13T16:43:33Z")

</div>

I’d like to use an existing schema class as the schema for a contract. Something like:

```
class MySchema < Dry::Schema::Params
  define do
    ...
  end
end

class MyContract < Dry::Validation::Contract
  params(&MySchema)
end
```

---

<div class="post-metadata">

**Author:** ![shanecav](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dry-rb.org/shanecav/32/409_2.png) [@shanecav](https://discourse.dry-rb.org/u/shanecav)\
**Post date:** [July 13, 2019, 7:23pm UTC](https://discourse.dry-rb.org/t/how-to-use-existing-schema-with-contract/834/2 "2019-07-13T19:23:07Z")

</div>

Looks like I can do

```
class MyContract < Dry::Validation::Contract
  @ __schema__ = MySchema.new
end
```

---

<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:** [July 15, 2019, 11:42am UTC](https://discourse.dry-rb.org/t/how-to-use-existing-schema-with-contract/834/3 "2019-07-15T11:42:09Z")

</div>

Yes **BUT** this is not public API. We’ll add the official support for setting schemas eventually. Feel free to report an issue about it.
