# How to access meta fields in structs

**URL:** <https://discourse.dry-rb.org/t/how-to-access-meta-fields-in-structs/989>\
**Category:** dry-types\
**Created:** [January 26, 2020, 4:37am UTC](https://discourse.dry-rb.org/t/how-to-access-meta-fields-in-structs/989 "2020-01-26T04:37:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![laertispappas](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dry-rb.org/laertispappas/32/352_2.png) [@laertispappas](https://discourse.dry-rb.org/u/laertispappas)\
**Post date:** [January 26, 2020, 4:37am UTC](https://discourse.dry-rb.org/t/how-to-access-meta-fields-in-structs/989/1 "2020-01-26T04:37:39Z")

</div>

Hello,

Thank you for the great libs so far.

Quick question regarding the `meta` feature in Dry::Types. Can someone please let me know how to access the meta properties in the example below.

example:

```auto
class MyClass < Dry::Struct
  attribute :age, Types::Integer.meta(foo: :bar)
end

```

So in the example above I need to have access to the meta :foo prop.

Thank you in advance.  
LP

---

<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 27, 2020, 8:18am UTC](https://discourse.dry-rb.org/t/how-to-access-meta-fields-in-structs/989/2 "2020-01-27T08:18:22Z")

</div>

Hey!

You can get it like this:

```ruby
MyClass.schema.key(:age).meta
# => {:foo=>:bar}

```

---

<div class="post-metadata">

**Author:** ![laertispappas](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dry-rb.org/laertispappas/32/352_2.png) [@laertispappas](https://discourse.dry-rb.org/u/laertispappas)\
**Post date:** [January 31, 2020, 12:03am UTC](https://discourse.dry-rb.org/t/how-to-access-meta-fields-in-structs/989/3 "2020-01-31T00:03:48Z")

</div>

> [@laertispappas](#):
>
> class MyClass \< Dry::Struct attribute :age, Types::Integer.meta(foo: :bar) end

Thank you mate!
