# Using schemas, contracts with dry-rails

**URL:** <https://discourse.dry-rb.org/t/using-schemas-contracts-with-dry-rails/1187>\
**Category:** Support\
**Created:** [January 18, 2021, 8:48pm UTC](https://discourse.dry-rb.org/t/using-schemas-contracts-with-dry-rails/1187 "2021-01-18T20:48:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pmackay](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dry-rb.org/pmackay/32/133_2.png) [@pmackay](https://discourse.dry-rb.org/u/pmackay)\
**Post date:** [January 18, 2021, 8:48pm UTC](https://discourse.dry-rb.org/t/using-schemas-contracts-with-dry-rails/1187/1 "2021-01-18T20:48:20Z")

</div>

In the docs for dry-rails:

[https://dry-rb.org/gems/dry-rails/0.3/](https://dry-rb.org/gems/dry-rails/0.3/)

It talks about defining schemas to use with safe\_params, and separately about defining contracts. As the latter would also need a schema, is there a pattern for sharing the schema between the controller and a contract?

---

<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:38am UTC](https://discourse.dry-rb.org/t/using-schemas-contracts-with-dry-rails/1187/2 "2021-01-25T05:38:24Z")

</div>

Hey Paul! There’s no pattern _yet_ but I’m planning to come up with something eventually. It’s actually one of my personal pet peeves 😉 Conceptually, params received at the HTTP level is a different thing than params that your underlying app receives, but there’s obviously a lot of overlap so we definitely want to reduce code duplication. My rough idea is to be able to define an HTTP-specific schema and then have a way of translating it automatically to a contract schema. How exactly this would look like is yet to be determined.
