These are chat archives for dry-rb/chat

29th
Aug 2016
Yuji Yokoo
@yujiyokoo
Aug 29 2016 00:00
This message was deleted
@timriley thanks, I've just read the discussion on errors vs hints. It makes sense to me now :)
Tim Riley
@timriley
Aug 29 2016 01:06
Cool :)
John Backus
@backus
Aug 29 2016 03:11
@solnic or @flash-gordon I've got dry-rb/dry-types#133, dry-rb/dry-types#134, and dry-rb/dry-types#135 ready to go. I'd like to work on refactoring the hash schemas but I'm already about 28 (smallish) commits ahead of master so it would be nice to get some of this reviewed and merged
Nikita Shilnikov
@flash-gordon
Aug 29 2016 06:12
@backus, at the end of the day probably
Aleksandar Radunović
@aradunovic
Aug 29 2016 07:15
Is it considered a bad practice to return Left(nil) when using Either monad?
Nikita Shilnikov
@flash-gordon
Aug 29 2016 08:01
I think you want to use Maybe instead
Aleksandar Radunović
@aradunovic
Aug 29 2016 08:20
@flash-gordon I thought about it, but I actually don’t care about the result on failure
Juanma Cervera
@jmcervera
Aug 29 2016 08:26
@aradunovic , thanks for your help. I'm beginning to see the light.
Now I can access repositories from the container, but I can't get access to the relations. I thought they were registered also because they were in the lib directory. The same problem with entities. Am I missing something?
Piotr Solnica
@solnic
Aug 29 2016 09:00
@jmcervera oh, no no, we didn’t integrate dry-system with rom yet so relations, commands and mappers are available through rom container so ie rom.relations[:your_relation]
I do plan to integrate rom with dry-container/system/auto_inject at some point though
Juanma Cervera
@jmcervera
Aug 29 2016 09:02
@solnic. Ahh. thank you I was stuck with all these things
Juanma Cervera
@jmcervera
Aug 29 2016 09:27
Well, I'm working against a legacy database.
As soon as I configure ROM, it seems that I have autodefined all the relations in the database. so what's the point of defining this relations as standalone classes?
you can think of relations as your data access layer, and repositories as your domain-specific data access layer, where you can instantiate custom objects, and load complex aggregates
Juanma Cervera
@jmcervera
Aug 29 2016 09:55
@solnic. I have read it, and define some, using less fields that the actual table, but they are not uses by the repository, it seems to uses all the fields.
How are the relations attached to the ROM container?
Piotr Solnica
@solnic
Aug 29 2016 09:58
@jmcervera oh if you want to change default dataset logic you need to use dataset with a block, we should probably default to schema attributes though
@jmcervera during setup rom builds initial relation objects and stores them in its container
so when you configure auto-registration in rom config, it’s gonna require your relation classes and use them
it boils down to YourRel.new(gateway.dataset(:your_rel)) and storing the instance in registry under :rel_name key (names are configurable through register_as setting in rel class)
Juanma Cervera
@jmcervera
Aug 29 2016 10:02
@solnic Thanks, I'm going to try all these things.
Piotr Solnica
@solnic
Aug 29 2016 10:03
docs are still lacking for rom-sql :( lemme show you how to override the dataset with custom columns
Kiril Dokh
@dsounded
Aug 29 2016 10:05
Hello @solnic I’ve been in vacation, do you remember about me ?))
Piotr Solnica
@solnic
Aug 29 2016 10:09
@jmcervera I added an example to rom-rb/rom-rb.org#166 showing how to override a dataset by using schema info
@dsounded hey man, yeah still working on stuff, I’m in the middle of one refactoring in dry-logic/validation now, it’s gonna be done in a couple of days, then I’ll go right to that feature you want (esp that it needs moving things from dry-v to dry-l)
@dsounded if things go well I’ll push releases next week
Kiril Dokh
@dsounded
Aug 29 2016 10:10
@solnic thanks
Juanma Cervera
@jmcervera
Aug 29 2016 10:37
@solnic Thank you, everything begins to work now
Rafael George
@cored
Aug 29 2016 15:46
hey @solnic working on using dry-struct in dry-validation
found an issue in here
Piotr Solnica
@solnic
Aug 29 2016 15:47
@cored it’s half-baked so there will be issues :)
Rafael George
@cored
Aug 29 2016 15:47
after changing that spec to define the structs as https://gist.github.com/cored/ed5ed311c027812b143e3f27039b5a50
following what I saw in dry-struct specs of course
so I guess the check for dry struct in Dry::Validation::Schema::Value
so I guess that's what need to change line 6
it was ::Dry::Types::Struct before
Piotr Solnica
@solnic
Aug 29 2016 15:51
@cored aah yeah that’s the first thing to fix to prep for dry-struct release
Rafael George
@cored
Aug 29 2016 15:52
cool
Nikita Shilnikov
@flash-gordon
Aug 29 2016 16:57
@backus I'm available more or less for the next two hours I hope
@solnic do you have any comments on dry-rb/dry-types#137 ? I'm just gonna to wrap it up now
Piotr Solnica
@solnic
Aug 29 2016 17:08
sorry busy now
Nikita Shilnikov
@flash-gordon
Aug 29 2016 17:13
no worries, it will stay there :)
John Backus
@backus
Aug 29 2016 17:40
@flash-gordon cool I'll be at work in a half hour or so
Basically just curious if you have other comments on my hash schema spec PR.
I'm done with all of the spec changes I think I needed to make although it looks like solnic spotted a few untested parts I trimmed which I'll need to understand how to test
Nikita Shilnikov
@flash-gordon
Aug 29 2016 17:43
I'll have a look
Piotr Solnica
@solnic
Aug 29 2016 17:44
@backus with have #meta interface for setting arbitrary stuff under options[:meta] so you could just use this
John Backus
@backus
Aug 29 2016 17:44
@solnic ah ok that clarifies what I wasn't seeing
My perspective was that you just couldn't set other options so that interface was open to trimming
Piotr Solnica
@solnic
Aug 29 2016 17:48
IIRC there’s a common spec for #meta
John Backus
@backus
Aug 29 2016 17:51
Great that will fit right in
Rafael George
@cored
Aug 29 2016 18:22
@backus maybe you could give me some guidance with my PR
dry-rb/dry-validation#244
John Backus
@backus
Aug 29 2016 18:23
@cored was actually just looking at it
I'll actually need input from @solnic since he is the mastermind here
Rafael George
@cored
Aug 29 2016 18:23
thanks
got it
John Backus
@backus
Aug 29 2016 18:23
Basically dry-struct is going to be an optional offshoot of dry-types
Rafael George
@cored
Aug 29 2016 18:24
so in more specific terms what does that mean ?
John Backus
@backus
Aug 29 2016 18:24
So realistically that doesn't mean that dry-struct users will be left high and dry when it comes to dry-validation
Rafael George
@cored
Aug 29 2016 18:24
like you can turn it on and off ?
John Backus
@backus
Aug 29 2016 18:24
but there will probably need to be internal refactorings of dry-validation
Rafael George
@cored
Aug 29 2016 18:25
I see
John Backus
@backus
Aug 29 2016 18:25
Yeah @cored basically I don't think that @solnic will want to just require dry-struct for all dry-v users
If I were you I'd leave the PR open just so we can get @solnic to weigh in here on how this will all work
Rafael George
@cored
Aug 29 2016 18:26
sure thing
thanks @backus
John Backus
@backus
Aug 29 2016 18:27
@cored I spent some of the weekend basically working on improving the boundaries between dry-types and dry-struct so just note that dry-struct is in a sort of purgatory phase where we are still resolving what should live in dry-types and what should live in dry-struct
So in the long term your issue should be resolved
Rafael George
@cored
Aug 29 2016 18:27
gotcha
I'm going to study both code bases then
John Backus
@backus
Aug 29 2016 18:28
Cool
Piotr Solnica
@solnic
Aug 29 2016 19:18
@cored @backus struct integration should be completely separated, somehow, from the main codebase, and we should either require it if defined?(Dry::Struct) or just let people require it themselves when they need it