# dry-types

**URL:** https://discourse.dry-rb.org/c/support/dry-types/6.md?page=2

[Latest](https://discourse.dry-rb.org/latest.md) · [Categories](https://discourse.dry-rb.org/categories.md)

**Page:** 3

---

## [How to create custom types with validation, contraints and/or coercion?](https://discourse.dry-rb.org/t/how-to-create-custom-types-with-validation-contraints-and-or-coercion/128)

<div class="topic-metadata">

**Author:** [@davidpelaez](https://discourse.dry-rb.org/u/davidpelaez)\
**Replies:** 3\
**Last updated:** [October 16, 2016, 7:57pm UTC](https://discourse.dry-rb.org/t/how-to-create-custom-types-with-validation-contraints-and-or-coercion/128 "2016-10-16T19:57:45Z")

</div>

I have been digging trying to find a way to define my own types (custom coercion and validity checks and constraints). For example I want a type that checks that a given value is\_a? MyClass. I found a way to do coercions…

---

## [Dry::Types::Struct non-empty string attribute](https://discourse.dry-rb.org/t/dry-types-struct-non-empty-string-attribute/104)

<div class="topic-metadata">

**Author:** [@pvmeerbe](https://discourse.dry-rb.org/u/pvmeerbe)\
**Replies:** 2\
**Last updated:** [August 25, 2016, 9:47am UTC](https://discourse.dry-rb.org/t/dry-types-struct-non-empty-string-attribute/104 "2016-08-25T09:47:20Z")

</div>

Hi All, I was wondering how one could ensure that a Dry::Types::Struct attribute is a non-blank string. I was able to get this behavior with class MyClass \< Dry::Types::Struct attribute :name, Types::Strict::…

---

## [Validation approach for Domain Objects](https://discourse.dry-rb.org/t/validation-approach-for-domain-objects/73)

<div class="topic-metadata">

**Author:** [@Kukunin](https://discourse.dry-rb.org/u/Kukunin)\
**Replies:** 8\
**Last updated:** [August 11, 2016, 11:49pm UTC](https://discourse.dry-rb.org/t/validation-approach-for-domain-objects/73 "2016-08-11T23:49:56Z")

</div>

Hello. Thanks for great gems set for better architecture. I have a common question about best practices for Domain entities and value objects. The main question: should I include validation rules to the object itsel…

---

## [Brazilian currency (Real) to Decimal coercion type](https://discourse.dry-rb.org/t/brazilian-currency-real-to-decimal-coercion-type/61)

<div class="topic-metadata">

**Author:** [@abinoam](https://discourse.dry-rb.org/u/abinoam)\
**Replies:** 2\
**Last updated:** [July 22, 2016, 4:07pm UTC](https://discourse.dry-rb.org/t/brazilian-currency-real-to-decimal-coercion-type/61 "2016-07-22T16:07:46Z")

</div>

Hi all, This is my first try on dry-types and I'm really enjoying it! require 'dry-types' module Types include Dry::Types.module DecimalFromCurrencyReal = Types::Strict::Decimal.constructor do |value| …

---

## [Coercing to domain model](https://discourse.dry-rb.org/t/coercing-to-domain-model/69)

<div class="topic-metadata">

**Author:** [@graf0](https://discourse.dry-rb.org/u/graf0)\
**Replies:** 1\
**Last updated:** [July 21, 2016, 4:40pm UTC](https://discourse.dry-rb.org/t/coercing-to-domain-model/69 "2016-07-21T16:40:03Z")

</div>

Hi, I'm struggling to solve following problem: client sends uuid of domain model to my app. I'd like to coerce this to AR record (query database for uuid column), or nil - if no record found. How to approch that proble…

[Previous page](https://discourse.dry-rb.org/c/support/dry-types/6.md?page=1)
