# Dry-system documentation suggestion

**URL:** <https://discourse.dry-rb.org/t/dry-system-documentation-suggestion/208>\
**Category:** Support\
**Created:** [January 31, 2017, 7:05pm UTC](https://discourse.dry-rb.org/t/dry-system-documentation-suggestion/208 "2017-01-31T19:05:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![whisky](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dry-rb.org/whisky/32/328_2.png) [@whisky](https://discourse.dry-rb.org/u/whisky)\
**Post date:** [January 31, 2017, 7:05pm UTC](https://discourse.dry-rb.org/t/dry-system-documentation-suggestion/208/1 "2017-01-31T19:05:41Z")

</div>

When ‘auto-import’ components, one should carefully read the Documentation [here](http://dry-rb.org/gems/dry-system/auto-import/).

The paragraph that say

> `lib/api/client` resolves to `API::Client` class with identifier ‘api.client’.

Could be better illustrated with a folder structure that show a

```
 #{root}
     |- lib
        |- api
             client.rb

```

and `client.rb`

```
   Module Api
        class Client
            ...
         end
   end

```

Also it seems to me that on the last code of the `lib/persistence/user_repo.rb`  
the class should be in the `persistence` module.

as

```auto
# lib/persistence/user_repo.rb
require 'import'
module Persistence
  class UserRepo
    include Import['persistence.db']

    def find(conditions)
      db[:users].where(conditions)
    end
  end
end

```

as if someone would like to use it from somewhere else, it would be registered as `persistence.user_repo`  
but when _instantiating_ the `component.instance` it won’t find the proper `Persistent::UserRepo` constant defined.

I struggled a long moment, before finding why an ‘auto-import’ class, was reporting something like ‘constant Api not found`for a component in a`/lib/api/client.rb’ under key `'api.client'` until I wrapped the `Client` class into the proper `Api` module as the directory structure dictate it.

Or the `loader` should try harder 😉

---

<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 31, 2017, 7:48pm UTC](https://discourse.dry-rb.org/t/dry-system-documentation-suggestion/208/2 "2017-01-31T19:48:53Z")

</div>

> [@whisky](#):
>
> Also it seems to me that on the last code of the lib/persistence/user\_repo.rbthe class should be in the persistence module.

Thanks, I just fixed it.

> [@whisky](#):
>
> Or the loader should try harder

I’m actually planning to investigate if we can inspect files and see what class constants they define, but I don’t have good feelings about this 🙂

---

<div class="post-metadata">

**Author:** ![whisky](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dry-rb.org/whisky/32/328_2.png) [@whisky](https://discourse.dry-rb.org/u/whisky)\
**Post date:** [February 1, 2017, 8:04am UTC](https://discourse.dry-rb.org/t/dry-system-documentation-suggestion/208/3 "2017-02-01T08:04:32Z")

</div>

I fact, I think imposing this Folder to Module hierarchies mapping make sense.

It not a high cost to pay and it play well with the ‘namespacing’ concept.

As it on the ‘convention’ over configuration, it seems reasonable to respect it.

However, the documentation could emphasise this a little bit.
