These are chat archives for dry-rb/chat

1st
Jul 2016
Tim Riley
@timriley
Jul 01 2016 05:58
Nice work @backus 💪🏼
Kimmo Lehto
@kke
Jul 01 2016 08:01
has people been having problems with dry dependencies? our cli fails to install for some people now, i think we need to dig all dry-* from gemfile.lock and version lock them in .gemspec
requires dry-logic (= 0.2.2); dry-validation requires dry-logic (>= 0.2.2, ~> 0.2); dry-types requires dry-logic (>= 0.2.3, ~> 0.2)
John Backus
@backus
Jul 01 2016 08:07
@solnic dry-rb/dry-struct#1
Theo Cushion
@theozaurus
Jul 01 2016 08:34
@solnic, yes inherit rules from another schema
pheeew, got 99% done for 0.8.0 release
magic happens when I get up at 6am lol
so finally this works:
required(:data).filled(min_size?: 10) { each(:int?) }
Theo Cushion
@theozaurus
Jul 01 2016 08:38
@solnic, just discovered you can call ‘schema’ without chaining onto a key!
Piotr Solnica
@solnic
Jul 01 2016 08:38
I made a bunch of improvements today in this area
Theo Cushion
@theozaurus
Jul 01 2016 08:39
Awesome!
Piotr Solnica
@solnic
Jul 01 2016 08:39
maybe I’ll make it work via chaining, but not now, not enough time
apart from this, you can also do each(OtherSchema) now
@jodosha you there?
Theo Cushion
@theozaurus
Jul 01 2016 08:47
@solnic, is it possible to multiple inheritance without nesting? For instance
FooSchema = Dry::Validation.Schema { key(:foo).required }
BarSchema = Dry::Validation.Schema { key(:bar).required }

FooBarSchema = Dry::Validation.Schema {
  schema(FooSchema)
  schema(BarSchema)
}

FooBarSchema.call({})
# => #<Dry::Validation::Result output={} messages={}>
Piotr Solnica
@solnic
Jul 01 2016 08:52
try Dry::Validation.Schema(rules: FooSchema.rules + BarSchema.rules)
Theo Cushion
@theozaurus
Jul 01 2016 08:53
Dry::Validation.Schema(rules: FooSchema.rules + BarSchema.rules)
NoMethodError: undefined method `+' for #<Hash:0x007ffdfd7f2a58>
Piotr Solnica
@solnic
Jul 01 2016 08:54
ugh right, I meant .class.rules
Theo Cushion
@theozaurus
Jul 01 2016 08:56
(Dry::Validation.Schema(rules: FooSchema.class.rules + BarSchema.class.rules) { }).call({})
=> #<Dry::Validation::Result output={} messages={:foo=>["is missing"], :bar=>["is missing"]}>
Yay!
Piotr Solnica
@solnic
Jul 01 2016 08:57
flexbility, we have it™
@splattael Peter, I’m sorry but I had to revert your perf improvement with messages cache…even though it gave us a speed boost at run-time, it also made the test suite run 40 seconds instead of 5
it’s mostly because we create new messages for each schema
and since we create thousands of schemas during tests…
we should defo revisit this though
Piotr Solnica
@solnic
Jul 01 2016 09:04
anybody interested in building a small lib for deprecation APIs? it’s gonna be awesome because we can call it dry-deprecated and confuse everybody like hell :laughing:
Theo Cushion
@theozaurus
Jul 01 2016 09:04
Haha, I like the sound of it.
@solnic, now can you merge the rules within the block? Trying to use reform, and it hides the Dry::Validation.Schema call
Theo Cushion
@theozaurus
Jul 01 2016 09:13

Was hoping

FooBarSchema = Dry::Validation.Schema {
  self.rules += FooSchema.class.rules
  self.rules += BarSchema.class.rules
}
FooBarSchema.call({})
=> #<Dry::Validation::Result output={} messages={}>

Would do it, or:

FooBarSchema = Dry::Validation.Schema {
  configure do |c|
    c.rules += FooSchema.class.rules
    c.rules += BarSchema.class.rules
  end
}
Piotr Solnica
@solnic
Jul 01 2016 09:17
the latter should actually work
Theo Cushion
@theozaurus
Jul 01 2016 09:17
irb(main):118:0> FooBarSchema = Dry::Validation.Schema {
irb(main):119:1*   configure do |c|
irb(main):120:2*     c.rules += FooSchema.class.rules
irb(main):121:2>     c.rules += BarSchema.class.rules
irb(main):122:2>   end
irb(main):123:1> }
NoMethodError: undefined method `rules=' for #<Class:0x007ffdfd69dba8>
Theo Cushion
@theozaurus
Jul 01 2016 09:35
No dice on dry-validations from master branch either.
Piotr Solnica
@solnic
Jul 01 2016 09:52
@theozaurus don’t use c there, just do config.rules +=
Theo Cushion
@theozaurus
Jul 01 2016 09:54
@solnic that works! Thank you so much for your time and patience.
Piotr Solnica
@solnic
Jul 01 2016 09:55
Run options: --seed 37190

# Running:

.................................................S...............S.........................S.................................................S......................................................................................................S.........................................................................................S.......................................................S...........S..............................................................................................S...............S....S........................S............................................................................................................S...S................................................................................................................................S.......S.....S..................................S..............S.............S.........................................................................................................................S.................................................S...............................S..S...................S..S.........................................................................S..S...............S...........................................................................................................................................S........................S...................................S...............................................S........................S................................

Finished in 4.269826s, 349.6629 runs/s, 669.1139 assertions/s.

1493 runs, 2857 assertions, 0 failures, 0 errors, 34 skips

You have skipped tests. Run with —verbose for details.
@jodosha ^^^^
@theozaurus sure, glad I could help
yeah so…dry-v 0.8.0 will be released today, all issues scheduled for this release are closed and I updated hanami-validations to work with it so 0 (zero) blockers
Luca Guidi
@jodosha
Jul 01 2016 10:23
@solnic Now I'm around :)
@solnic I just joined the channel to say thank you about the speed improvement. I noticed it by running hanami-v test suite :)
Piotr Solnica
@solnic
Jul 01 2016 10:25
it was because…we made a perf improvement that made run-time faster, but slowed down defining schemas A LOT, so I reverted this for now
@jodosha could you give me access to hanami-validations? I’ll send a PR with updated code that works with 0.8
just don’t wanna fork it, I won’t be pushing to master
Luca Guidi
@jodosha
Jul 01 2016 10:26
@solnic One second :)
Piotr Solnica
@solnic
Jul 01 2016 10:27
folks, I added a public API for extending DSL in dry-v, go nuts and experiment https://github.com/dry-rb/dry-validation/blob/master/spec/integration/schema/extending_dsl_spec.rb :)
Luca Guidi
@jodosha
Jul 01 2016 10:27
@solnic Done
Please let me know if something doesn't work ;)
Fran Worley
@fran-worley
Jul 01 2016 10:27
@solnic have you updated the specs to work with the new types syntax or do you want me to help ?
Luca Guidi
@jodosha
Jul 01 2016 10:28
@solnic Great feature!
Piotr Solnica
@solnic
Jul 01 2016 10:30
@fran-worley not yet…let’s do it after release
@fran-worley coercion-inference will be around until 1.0 anyway
@jodosha PR sent :)
Fran Worley
@fran-worley
Jul 01 2016 10:30
@solnic I just figured it would really test if your changes work...
Luca Guidi
@jodosha
Jul 01 2016 10:31
:heart:
Fran Worley
@fran-worley
Jul 01 2016 10:31
I started doing it and that's how I found the whole array coercion thing
Piotr Solnica
@solnic
Jul 01 2016 10:32
yeah I understand this, although the specs I added (array issue is fixed) actually do cover all possible cases
in the long term, coercion will be separated, so there won’t be a need to test it all the time in each spec wherever we test predicates
so updating entire test suite to use type-specs is probably not a good idea, although it would defo make the suite more robust :)
Fran Worley
@fran-worley
Jul 01 2016 10:34
That makes sense. I'll save myself some time then :)
Piotr Solnica
@solnic
Jul 01 2016 10:34
I should’ve mentioned this to you earlier, sorry about that
Fran Worley
@fran-worley
Jul 01 2016 10:35
No worries, I didn't get very far :)
Piotr Solnica
@solnic
Jul 01 2016 10:35
ok good :)
Piotr Solnica
@solnic
Jul 01 2016 10:41
@jodosha oooh damn I forgot about these :)
but it’s passing :)
Luca Guidi
@jodosha
Jul 01 2016 10:41
yes, on before the test suite didn't even started. Now starts, but there was to uncomment the specs that was actually using that fixture ;)
SUCH CHANGELOG WOW
Piotr Solnica
@solnic
Jul 01 2016 11:02
[√] release dry-logic 0.3.0 /cc @fran-worley
Fran Worley
@fran-worley
Jul 01 2016 11:04
@solnic Yey :) such a good day :)
Going to update reform to use 0.8 this weekend
Piotr Solnica
@solnic
Jul 01 2016 11:07
now the worse part - ann post O_o
which features should we highlight? /cc @fran-worley @timriley
[√] release dry-types 0.8.0
Fran Worley
@fran-worley
Jul 01 2016 11:14
Definitely the new types declaration syntax thing.
Piotr Solnica
@solnic
Jul 01 2016 11:16
yeah, this one will be tough to explain I suppose
it’s super important, but not sure if it should be high on the list
irb(main):008:0> schema = Dry::Validation.Schema { required(:foo).filled }
irb(main):009:0> [{foo: "bar"}].map(&schema)
=> [#<Dry::Validation::Result output={:foo=>”bar”} messages={}>]
Did you know? ^ :)
Bundler could not find compatible versions for gem "dry-logic":
  In Gemfile:
    dry-validation was resolved to 0.8.0, which depends on
      dry-logic (>= 0.3.0, ~> 0.3)
what the heck travis O_o
worked for mri 2.0.0
but the rest failed, UGH
could somebody pull dry-v from master and try to bundle?
Piotr Solnica
@solnic
Jul 01 2016 11:27
ok this is some insanity right there, rubygems on travis doesn’t see dry-logic 0.3
works on mri 2.0 on travis, crazy crazzzyyy
@fran-worley @timriley @AMHOL @flash-gordon ^^^ could you please try it out locally? I’m super confused
Benjamin Klotz
@tak1n
Jul 01 2016 11:33

`
benny@benny-Lenovo-Y50-70:~/dev/ruby/dry-rb$ rm -rf dry-validation/
benny@benny-Lenovo-Y50-70:~/dev/ruby/dry-rb$ git clone git@github.com:dry-rb/dry-validation.git
Cloning into 'dry-validation'...
remote: Counting objects: 5334, done.
remote: Compressing objects: 100% (145/145), done.
remote: Total 5334 (delta 77), reused 0 (delta 0), pack-reused 5188
Receiving objects: 100% (5334/5334), 694.36 KiB | 669.00 KiB/s, done.
Resolving deltas: 100% (3259/3259), done.
Checking connectivity... done.
benny@benny-Lenovo-Y50-70:~/dev/ruby/dry-rb$ cd dry-validation/
benny@benny-Lenovo-Y50-70:~/dev/ruby/dry-rb/dry-validation$ chruby 2.3.1
benny@benny-Lenovo-Y50-70:~/dev/ruby/dry-rb/dry-validation$ gh .
benny@benny-Lenovo-Y50-70:~/dev/ruby/dry-rb/dry-validation$ gem install bundler
Fetching: bundler-1.12.5.gem (100%)
Successfully installed bundler-1.12.5
Parsing documentation for bundler-1.12.5
Installing ri documentation for bundler-1.12.5
bDone installing documentation for bundler after 2 seconds
1 gem installed
benny@benny-Lenovo-Y50-70:~/dev/ruby/dry-rb/dry-validation$ bundle
Fetching gem metadata from https://rubygems.org/
Fetching version metadata from https://rubygems.org/
Resolving dependencies...
Bundler could not find compatible versions for gem "dry-logic":
In Gemfile:
dry-validation was resolved to 0.8.0, which depends on
dry-logic (~> 0.3)

Could not find gem 'dry-logic (~> 0.3)', which is required by gem 'dry-validation', in any of the sources.
benny@benny-Lenovo-Y50-70:~/dev/ruby/dry-rb/dry-validation$
`

Piotr Solnica
@solnic
Jul 01 2016 11:33
wtf
like, srsly, wtf
@tak1n could you remove version specs and see what happens?
Andy Holland
@AMHOL
Jul 01 2016 11:34
➜  dry-validation git:(master) bundle
Fetching gem metadata from https://rubygems.org/
Fetching version metadata from https://rubygems.org/
Resolving dependencies...
Bundler could not find compatible versions for gem "dry-logic":
  In Gemfile:
    dry-validation was resolved to 0.8.0, which depends on
      dry-logic (~> 0.3)

Could not find gem 'dry-logic (~> 0.3)', which is required by gem 'dry-validation', in any of the sources.
➜  dry-validation git:(master) ruby -v
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]
➜  dry-validation git:(master) bundler -v
Bundler version 1.12.2
Piotr Solnica
@solnic
Jul 01 2016 11:34
WAT
that’s some serious nonsense
Benjamin Klotz
@tak1n
Jul 01 2016 11:35
benny@benny-Lenovo-Y50-70:~/dev/ruby/dry-rb/dry-validation$ bundle
Fetching gem metadata from https://rubygems.org/
Fetching version metadata from https://rubygems.org/
Resolving dependencies...
Bundler could not find compatible versions for gem "dry-logic":
  In Gemfile:
    dry-validation was resolved to 0.8.0, which depends on
      dry-types (~> 0.8) was resolved to 0.8.0, which depends on
        dry-logic (>= 0.3.0, ~> 0.3)

    dry-validation was resolved to 0.8.0, which depends on
      dry-logic

Could not find gem 'dry-logic (>= 0.3.0, ~> 0.3)', which is required by gem 'dry-validation', in any of the sources.
removed dry-logic ~> 0.3 from dry-v gemspec
but dry-types still depends on it
decreased dry-types to ~> 0.7 in gemspec then it works
but u released dry-logic 0.3 right?
so why the heck does it say not found Oo
Piotr Solnica
@solnic
Jul 01 2016 11:36
both types and logic are released
Benjamin Klotz
@tak1n
Jul 01 2016 11:36
maybe rubygems caches the versions?
and the cache is not updated?
idk
Piotr Solnica
@solnic
Jul 01 2016 11:36
furthermore, types has exactly same dry-logic ver spec
and it worked for dry-types just fine
Benjamin Klotz
@tak1n
Jul 01 2016 11:36
hm weird
Andy Holland
@AMHOL
Jul 01 2016 11:36
Fetching: dry-logic-0.3.0.gem (100%)
Successfully installed dry-logic-0.3.0
Parsing documentation for dry-logic-0.3.0
Installing ri documentation for dry-logic-0.3.0
Done installing documentation for dry-logic after 0 seconds
1 gem installed
Piotr Solnica
@solnic
Jul 01 2016 11:37
inorite!
Andy Holland
@AMHOL
Jul 01 2016 11:37
Now bundle works
Piotr Solnica
@solnic
Jul 01 2016 11:37
oh wow
O_O
Benjamin Klotz
@tak1n
Jul 01 2016 11:37
can confirm that
installing dry-logic manually works
:S
Piotr Solnica
@solnic
Jul 01 2016 11:38
can you remove dry-logic and run bundle again?
Benjamin Klotz
@tak1n
Jul 01 2016 11:38
benny@benny-Lenovo-Y50-70:~/dev/ruby/dry-rb/dry-validation$ gem uninstall dry-logic

You have requested to uninstall the gem:
        dry-logic-0.3.0

dry-types-0.8.0 depends on dry-logic (>= 0.3.0, ~> 0.3)
If you remove this gem, these dependencies will not be met.
Continue with Uninstall? [yN]  y
Successfully uninstalled dry-logic-0.3.0
benny@benny-Lenovo-Y50-70:~/dev/ruby/dry-rb/dry-validation$ bundle
Fetching gem metadata from https://rubygems.org/
Fetching version metadata from https://rubygems.org/
Resolving dependencies...
Could not find dry-logic-0.3.0 in any of the sources
benny@benny-Lenovo-Y50-70:~/dev/ruby/dry-rb/dry-validation$
Andy Holland
@AMHOL
Jul 01 2016 11:38
➜  dry-validation git:(master) gem uninstall dry-logic

Select gem to uninstall:
 1. dry-logic-0.2.2
 2. dry-logic-0.2.3
 3. dry-logic-0.3.0
 4. All versions
> 4
Successfully uninstalled dry-logic-0.2.2
Successfully uninstalled dry-logic-0.2.3

You have requested to uninstall the gem:
    dry-logic-0.3.0

dry-data-0.5.1 depends on dry-logic (~> 0.1)
dry-types-0.8.0 depends on dry-logic (>= 0.3.0, ~> 0.3)
dry-types-0.7.2 depends on dry-logic (>= 0.2.3, ~> 0.2)
dry-types-0.7.1 depends on dry-logic (>= 0.2.0, ~> 0.2)
If you remove this gem, these dependencies will not be met.
Continue with Uninstall? [yN]  y
Successfully uninstalled dry-logic-0.3.0
➜  dry-validation git:(master) bundle
Fetching gem metadata from https://rubygems.org/
Fetching version metadata from https://rubygems.org/
Resolving dependencies...
Could not find dry-logic-0.3.0 in any of the sources
Piotr Solnica
@solnic
Jul 01 2016 11:38
dry-rb/dry-validation (master«) % bi
Fetching gem metadata from https://rubygems.org/
Fetching version metadata from https://rubygems.org/
Resolving dependencies...
Could not find dry-logic-0.3.0 in any of the sources
Benjamin Klotz
@tak1n
Jul 01 2016 11:38
lol
wtf
Piotr Solnica
@solnic
Jul 01 2016 11:38
got it reproduced
so stupid
Andy Holland
@AMHOL
Jul 01 2016 11:39
:joy:
Piotr Solnica
@solnic
Jul 01 2016 11:40
why on earth does it work on mri 2.0?
this makes absolutely no sense
why did it work fine for dry-types?
I SENSE CONSPIRACY HERE
Andy Holland
@AMHOL
Jul 01 2016 11:43
bundle --full-index works
Piotr Solnica
@solnic
Jul 01 2016 11:44
thank you man
didn’t know about that option
trying on travis…
so probably caching issue on rubygems side
Andy Holland
@AMHOL
Jul 01 2016 11:46
Google FTW :p
Kimmo Lehto
@kke
Jul 01 2016 11:46
ha ha, dependencies causing problems for you too :)
Piotr Solnica
@solnic
Jul 01 2016 11:46
not dependencies, rubygems is having issues with caching
partial gem index doesn’t include a newly released version
Kimmo Lehto
@kke
Jul 01 2016 11:47
kontena/kontena#824 someone just had trouble with our gem/cli because of dry dependencies
Piotr Solnica
@solnic
Jul 01 2016 11:49
Fetching source index from https://rubygems.org/ for 312 hours already, I better get a coffee
@kke oh what kind of issues did you have?
Kimmo Lehto
@kke
Jul 01 2016 11:51
something to do with dry-types i think
something requiring 0.2.2 and something else requiring 0.2.3
we couldn't reproduce it on a fresh system
Piotr Solnica
@solnic
Jul 01 2016 11:52
I relaxed deps to ~> 0.x
but validation requires >= 0.3 and >= 0.8 of logic/types
so it’s ~> 0.3, >= 0.3.0 in dry-v
Kimmo Lehto
@kke
Jul 01 2016 11:53
our gemspec had version lock on dry-logic and dry-validation
Piotr Solnica
@solnic
Jul 01 2016 11:53
you’ll be able to remove dry-logic and leave dry-v only
once I release the thing
in a minute, or two
Piotr Solnica
@solnic
Jul 01 2016 12:09
@kke there ya go kontena/kontena#831
Kimmo Lehto
@kke
Jul 01 2016 12:09
nice!
office rejoices
Piotr Solnica
@solnic
Jul 01 2016 12:12
@kke haha awesome :)
[√] release dry-validation 0.8.0
pheeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeew
Benjamin Klotz
@tak1n
Jul 01 2016 12:12
:clap: :sparkles:
Piotr Solnica
@solnic
Jul 01 2016 12:13
now a) lunch b) ann blog post
Benjamin Klotz
@tak1n
Jul 01 2016 12:13
have a good lunch :)
Luca Guidi
@jodosha
Jul 01 2016 12:24
@solnic @fran-worley @AMHOL @timriley Congrats on the releases and thank you very much :tada: :tada: :tada:
Piotr Solnica
@solnic
Jul 01 2016 12:24
w00t w00t w00t
Pablo Herrero
@pabloh
Jul 01 2016 13:01
CONGRATS! :tada: :tada: :tada:
Nikita Shilnikov
@flash-gordon
Jul 01 2016 13:01
AWESOME
solnic @solnic writes ann blog post
Daniel Sandbecker
@daniels
Jul 01 2016 13:38
@solnic et.al. Great work! Thank you all!
Piotr Solnica
@solnic
Jul 01 2016 13:44
btw I forgot completely about attr DSL that was removed
but literally NOBODY asked for it…
I’ll create an issue about it later today
Daniel Sandbecker
@daniels
Jul 01 2016 13:49

@solnic Realized your implementation of my feature suggestion now allows two similar ways to specify a nested schema:

required(:foo).schema(SomeSchema)
required(:foo).filled(SomeSchema)

Are those two equivalent?

Piotr Solnica
@solnic
Jul 01 2016 13:55
not really, filled prepends filled? check
Fran Worley
@fran-worley
Jul 01 2016 14:02
Great work everyone :clap: . Sorry I've not really been around today!
Chris Richards
@cmrichards
Jul 01 2016 14:03
What does the "dry" part mean? (not Dont repeat yourself I assume)
Daniel Sandbecker
@daniels
Jul 01 2016 14:04
Ah, but then #value(SomeSchema) is effectively the same as #schema(SomeSchema)?
Piotr Solnica
@solnic
Jul 01 2016 14:07
1k words and counting…:/
@daniels it does mean that
Fran Worley
@fran-worley
Jul 01 2016 14:08
@solnic happy to read and help you condense a little if you would like
Piotr Solnica
@solnic
Jul 01 2016 14:08
@fran-worley yes please help! :D
I’ll finish in ~10 minutes
Fran Worley
@fran-worley
Jul 01 2016 14:08
Cool :)
Maciej Mensfeld
@mensfeld
Jul 01 2016 14:15
@solnic any idea?
Bundler could not find compatible versions for gem "dry-logic":
  In Gemfile:
    enjin was resolved to 1.15.11, which depends on
      dry-validation (>= 0.8.0) was resolved to 0.8.0, which depends on
        dry-logic (>= 0.3.0, ~> 0.3)

Could not find gem 'dry-logic (>= 0.3.0, ~> 0.3)', which is required by gem 'dry-validation (>= 0.8.0)', in any of the sources.
I can see that you've just pushed it
maybe that's why
yeah
exactly :D that was crazy XD
but the docs are outdated - nvmd, will try to solve it manually
Piotr Solnica
@solnic
Jul 01 2016 14:23
@mensfeld rubygems is borked…do gem install dry-validation and then bundle…I’ve no idea what’s happening there
Maciej Mensfeld
@mensfeld
Jul 01 2016 14:24
@solnic yeah figured that out - solved, now trying to update since I used it on production :D good to have a decent test cov for that ;)
btw did you guys changed custom predicates api?
this no longer works:
      configure do
        config.predicates = Schemas::Predicates
      end

      required(:build_path).filled(:str?, :absolute_path?)
    module Predicates
      include Dry::Logic::Predicates

      # This regexp describes an absolute path
      # Absolute path always needs to start with / and cannot end with /
      ABSOLUTE_PATH_REGEXP = %r{\A\/.*[^\/]\z}

      predicate(:absolute_path?) do |value|
        !ABSOLUTE_PATH_REGEXP.match(value).nil? && File.exist?(value)
      end
    end
istead I get +absolute_path?+ is not a valid predicate name
Piotr Solnica
@solnic
Jul 01 2016 14:26
@mensfeld yes that’s a breaking change, do configure { predicates(Schemas::Predicates) }
Maciej Mensfeld
@mensfeld
Jul 01 2016 14:27
@solnic works like a charm! Thx!
Piotr Solnica
@solnic
Jul 01 2016 14:28
good :)
thanks btw, I forgot to mention that in upgrading notes
so adding it now
Maciej Mensfeld
@mensfeld
Jul 01 2016 14:28
:) there are upgrade notes?:D
Piotr Solnica
@solnic
Jul 01 2016 14:29
uhm yes :)
anybody interested in updating dry-validation docs on dry-rb.org?
Maciej Mensfeld
@mensfeld
Jul 01 2016 14:36
@solnic update went great - thanks for help!
having 100% coverage with gems that change rapidly is a must be ;)
Piotr Solnica
@solnic
Jul 01 2016 14:36
@mensfeld oh w/o even reading the upgrading notes? :D
one does not simply upgrade gems w/o 100% test cov
literally
:laughing:
is this the upgrade note?
Piotr Solnica
@solnic
Jul 01 2016 14:37
yes changelog has useful info, but I wrote a coupl parapgraphs in the ann post to highlight some stuff
Maciej Mensfeld
@mensfeld
Jul 01 2016 14:37
never saw it
just used this one
@fran-worley @AMHOL could you pls take a look (written very fast…:/) ^^
Fran Worley
@fran-worley
Jul 01 2016 14:44
@solnic on it :)
Fran Worley
@fran-worley
Jul 01 2016 14:51
@solnic :includes? and :excludes? are not new predicates we just renamed :exclusion? and :inclusion? which have been deprecated. Also see my comment on you commit to add back the message for inclusion.
Piotr Solnica
@solnic
Jul 01 2016 14:56
lol ok :)
Fran Worley
@fran-worley
Jul 01 2016 14:56
Not that I'm picky or anything!
Piotr Solnica
@solnic
Jul 01 2016 15:00
Could you update that section or should we just remove it?
Fran Worley
@fran-worley
Jul 01 2016 15:01
Happy to update it. I'll add just move those to to the updating section
We need to add a message back in for :exclusion? or anyone who doesn't upgrade will get a no message for predicate error
Piotr Solnica
@solnic
Jul 01 2016 15:05
@fran-worley I don’t feel like releasing 0.8.1 because of that tbh :/ let’s wait and see if people start reporting issues about that, if they are, we’ll fix
Fran Worley
@fran-worley
Jul 01 2016 15:06
Shall we just mention it in the updating notes?
Piotr Solnica
@solnic
Jul 01 2016 15:06
right
btw if you see some weird-sounding english pls do let me know :)
Fran Worley
@fran-worley
Jul 01 2016 15:16
Will do. Very impressed btw my language skills are appalling!
Piotr Solnica
@solnic
Jul 01 2016 15:31
ok Andy is helping me with lang-fixes :)
Fran Worley
@fran-worley
Jul 01 2016 15:31
Oh I can do English
Piotr Solnica
@solnic
Jul 01 2016 15:32
I can haz English :D
Fran Worley
@fran-worley
Jul 01 2016 15:32
and only English :) I meant I'm impressed with those for whom English is not their first language and they can write something meaningful!
Piotr Solnica
@solnic
Jul 01 2016 15:33
yeah it’s tough I gotta admit
Fran Worley
@fran-worley
Jul 01 2016 15:33
Do you want me to make changes to the doc or stick my ammendments in a gist?
Piotr Solnica
@solnic
Jul 01 2016 15:33
gimme a sec, I’ll push what I have now
Piotr Solnica
@solnic
Jul 01 2016 15:39
@fran-worley ok pushed some updates
Fran Worley
@fran-worley
Jul 01 2016 15:41
Cool will check
You've already changed most of the 'english' things I found!
Piotr Solnica
@solnic
Jul 01 2016 15:42
a couple more fixes are coming
ok, pushed
and stopping now :)
I’ll publish it once you give me :+1: :)
Fran Worley
@fran-worley
Jul 01 2016 15:48
Do you want me to commit my suggested changes?
Piotr Solnica
@solnic
Jul 01 2016 15:49
yes pls
just push it to the PR’s branch
http://weblog.rubyonrails.org/2016/6/30/Rails-5-0-final/ <= gonna be hard to compete with this news :laughing:
Fran Worley
@fran-worley
Jul 01 2016 15:58
@solnic can we move the section on the new Types api thing to a page in the dry site and link to it?
Piotr Solnica
@solnic
Jul 01 2016 15:59
we could that, you think it doesn’t fit in the post?
Fran Worley
@fran-worley
Jul 01 2016 16:00
I like the detail of it but I just wonder whether it's a bit much for the announcements item when you kinda hint that it's a bit experimental and will be improved upon lots
Piotr Solnica
@solnic
Jul 01 2016 16:01
yeah I have to say I was on the fence with this when writing it
yeah I’ll move it
Fran Worley
@fran-worley
Jul 01 2016 16:01
Loving customisable hints. :)
and what do you think about having a roadmap? then we can cut out bits like this:
In future releases we’ll be expanding this unique feature, for instance it will be possible to distinguish between errors and hints when displaying them in the UI, so that you can provide better UX for your users.
Piotr Solnica
@solnic
Jul 01 2016 16:11
yeah I’ll be working on roadmap
I’d like to start using milestones and define scope of work so that it’s easier to focus on stuff that matter
Piotr Solnica
@solnic
Jul 01 2016 16:17
@fran-worley I updated the docs in the meantime
but there’s like A TON of undocumented features :(
Fran Worley
@fran-worley
Jul 01 2016 16:25
@solnic I've updated the announcement. I will try to find some time to look at the dry-rb.org docs for dry-logic and dry-validation over the weekend.
Piotr Solnica
@solnic
Jul 01 2016 16:25
thanks!
Fran Worley
@fran-worley
Jul 01 2016 16:25
(can't promise anything though...)
Piotr Solnica
@solnic
Jul 01 2016 16:26
no worries!
Fran Worley
@fran-worley
Jul 01 2016 16:26
I was wondering if we should put upgrading after installation as people might miss it at the very end of the doc
Piotr Solnica
@solnic
Jul 01 2016 16:26
hm good point
Fran Worley
@fran-worley
Jul 01 2016 16:26
ending on the ... and more which I quite like
Piotr Solnica
@solnic
Jul 01 2016 16:32
oook deploying this thing
thanks to all contributors <3 we made it :)
Fran Worley
@fran-worley
Jul 01 2016 16:46
Grr github gets to me sometimes. You never got my updates to the ann did you?
Piotr Solnica
@solnic
Jul 01 2016 16:50
I did. Pulled that and rebased/squashed
Fran Worley
@fran-worley
Jul 01 2016 16:51
Not sure why my local repo is such a mess I've got about 4 sets of conflicts (which I've resolved at least twice now) and loads of other changes. Might delete it and start again if you've got my changes
Piotr Solnica
@solnic
Jul 01 2016 16:52
I'm out already so hard to help. Maybe you didn't use latest-latest version when applying your updates
Fran Worley
@fran-worley
Jul 01 2016 16:52
Don't worry I'll sort it.
This message was deleted
Piotr Solnica
@solnic
Jul 01 2016 16:57
If you do, you can also deploy via middleman deploy command
Fran Worley
@fran-worley
Jul 01 2016 16:58
Not until I've managed to get the site running locally. I've never used middleman and have not had the time to get it running. It's fine you've got most of them so :sparkles: whoop :)
Oskar Szrajer
@gotar
Jul 01 2016 17:29
dry-web in the same ruby weekly as rails 5 ;]
not bad ;]
John Backus
@backus
Jul 01 2016 18:23
Hurray! dry-v 0.8 is finally out
We're upgrading now
Brent Jubinville
@utilityboy
Jul 01 2016 18:51
Hello. Do you guys answer questions on usage of dry-rb gems here (specifically dry-types) or should they be asked elsewhere?
Piotr Solnica
@solnic
Jul 01 2016 19:42
nice, Tim’s talk is in RubyWeekly in the main section :)
Piotr Solnica
@solnic
Jul 01 2016 19:48
@fran-worley still there? if you managed to make some changes locally, pls push and I’ll check it out / deploy :) and sorry for pestering you with this
@utilityboy hello :) yes this is a channel about all dry-rb gems
Brent Jubinville
@utilityboy
Jul 01 2016 19:52
Thanks @solnic . Just didn't want to get in the way of dev speak with my usage questions
Piotr Solnica
@solnic
Jul 01 2016 19:52
no worries
Brent Jubinville
@utilityboy
Jul 01 2016 19:58
I've got a regular PORO that acts as a base class for an event stream(https://gist.github.com/utilityboy/d41522d6b0e748eacb0c4ca775ba3a52). It works well, and I have event subclasses which basically specify payload and metadata hashes. My concern is that with the current "hash-driven-design" a bug may be introduced and muck up my event log, which would be terrible. I was looking at Virtus to solve this for me with ActiveModel goodness, but performance is paramount, so I thought I'd give dry-rb a run
Been hacking away for a few hours and I really like dry-types. A couple questions: do you have something similar to Virtus.module? I'd rather compose instead of inherit this BaseEvent class.
The other question I have is, given both payload and metadata are hashes, is there a way to apply a schema to an attribute that is a hash? e.g. ensure metadata always has a timestamp that is Type::Time?
Piotr Solnica
@solnic
Jul 01 2016 20:02
@utilityboy I would recommend using dry-validation for verifying data and define structs as pure data objects and just pass in valid attributes
re Virtus.module - no, class-based inheritance is intentional to put emphasis on the fact that a given object should be a struct and nothing else
Brent Jubinville
@utilityboy
Jul 01 2016 20:03
I figured that may be the case
Are you able to define schemas on attributes that are hashes?
e.g
  class BaseEvent < Dry::Types::Struct
    constructor_type(:schema)

    attribute :id, Types::Maybe::Strict::Int
    attribute :stream_id, Types::UUID
    attribute :event_id, Types::UUID.default(SecureRandom.uuid)
    attribute :payload, Types::Hash.default({})
    attribute :metadata, Types::Strict::Hash.schema(timestamp: Types::Strict::Time)
  end
Piotr Solnica
@solnic
Jul 01 2016 20:07
you can define schemas on everything:)
@backus I hope you’ll manage to upgrade w/o much issues :)
Brent Jubinville
@utilityboy
Jul 01 2016 20:08
And If I try to set metadata[:timestamp] = 'foo' I should get an schema exception of sorts?
Piotr Solnica
@solnic
Jul 01 2016 20:08
yeah it would raise with a strict time type
Brent Jubinville
@utilityboy
Jul 01 2016 20:09
Ok, I'll try that again... I must have made a mistake on my test.
Maciej Mensfeld
@mensfeld
Jul 01 2016 20:09
@solnic good job with the new dry-validations - api is way more consistent now :clap:
Brent Jubinville
@utilityboy
Jul 01 2016 20:09
Thanks @solnic . Appreciate your time.
Piotr Solnica
@solnic
Jul 01 2016 20:10
@mensfeld thanks, we’re getting there! I’ve got a bunch of ideas what kind of things we can do to make rule composition smarter
but that’s for 0.9.0 now I need a break :laughing:
Fran Worley
@fran-worley
Jul 01 2016 20:24
@solnic just got back
Piotr Solnica
@solnic
Jul 01 2016 20:24
@fran-worley w/b :) I pushed one small fix for the post
Fran Worley
@fran-worley
Jul 01 2016 20:25
is it merged to master or still on the branch?
Piotr Solnica
@solnic
Jul 01 2016 20:25
merged / deployed
funny part, rubygems still doesn’t think dry-logic is there…so so weird
I mean bundler+rubygems
Fran Worley
@fran-worley
Jul 01 2016 20:27
Fab I'll check it out
Piotr Solnica
@solnic
Jul 01 2016 20:27
@utilityboy in general the philosophy is to not use “models” for validation
structs with strict types are nice in places where you really expect stuff to be always valid and invalid data should be treated as an exception (hence we raise)
but if you expect that sometimes something might be invalid, then just validate it using dry-validation schemas and handle it gracefuly
Fran Worley
@fran-worley
Jul 01 2016 20:29
@solnic shall we delete the branch then?
Piotr Solnica
@solnic
Jul 01 2016 20:29
@fran-worley I thought I did that O_o
Fran Worley
@fran-worley
Jul 01 2016 20:30
We've still got ann-post-dry-v
Piotr Solnica
@solnic
Jul 01 2016 20:30
oh my
should be deleted
Fran Worley
@fran-worley
Jul 01 2016 20:31
Gone :wave:
Piotr Solnica
@solnic
Jul 01 2016 20:31
good bye you problematic branch! ᕕ(˵•̀෴•́˵)ᕗ
Fran Worley
@fran-worley
Jul 01 2016 20:52
@solnic do you get access to tokens in your hint messages?
en:
  errors:
    min_size?:
      failure: "size can't be less than %{num}"
      hint: "please make sure it has at least 3 chars"
Could be:
en:
  errors:
    min_size?:
      failure: "size can't be less than %{num}"
      hint: "please make sure it has at least %{num} chars"
Piotr Solnica
@solnic
Jul 01 2016 21:05
@fran-worley oh right missed that one
and yes, it has access to all args thanks to the improvements you made :)
Fran Worley
@fran-worley
Jul 01 2016 21:07
Done :) Just updating reform now. Then I can finally use dry-logic the way I want to
Brent Jubinville
@utilityboy
Jul 01 2016 21:08
@solnic I follow... unfortunately, I'm guarding my most precious asset in my system (the event log) from corruption. Events are generated from both internally and externally and I'm processing payloads (which are a big hash). I can't really trust anybody.
I'm refactoring some things in the processor to ensure the data I generate at least is validated before it hits the Struct
Piotr Solnica
@solnic
Jul 01 2016 21:09
@utilityboy so it's a matter of deciding if you want to treat this as an exception or not
Brent Jubinville
@utilityboy
Jul 01 2016 21:09
I do... if either the payload or metadata is corrupt, it's really bad.
Everything should stop running at that point.
Piotr Solnica
@solnic
Jul 01 2016 21:10
so feels like strict structs is what you need
FWIW I built this feature originally to have type-safe db queries
Brent Jubinville
@utilityboy
Jul 01 2016 21:10
Ya. I think so... I'm dropping a factory method in front of the creation of events to make sure at least the struct can be strict 100% of the time
I'm hoping my event subclasses can just define attributes for payload and metadata that also contain strict structs
Is there any syntactical goodness for accessors on attributes that are hashes?
"nested" attributes?
Piotr Solnica
@solnic
Jul 01 2016 21:17
@utilityboy any examples? not entirey sure what you need
Brent Jubinville
@utilityboy
Jul 01 2016 21:17
Sure... jas
Actually, let me finish some thoughts/tests to make sure I'm asking valid questions. Don't want to waste anybody's time.
Ralf Schmitz Bongiolo
@mrbongiolo
Jul 01 2016 22:07
@solnic can I create a pt-BR version of the errors.yml file for dry-v?
Piotr Solnica
@solnic
Jul 01 2016 22:58
@mrbongiolo sure, although we probably shouldn't keep additional translations in the main repo