by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 12:29
    flash-gordon commented #403
  • 10:46
    adamransom commented #403
  • 10:17
    solnic commented #403
  • 10:03
    adamransom commented #403
  • 09:42
    adamransom commented #403
  • 09:39
    solnic commented #403
  • 09:36
    adamransom commented #403
  • 09:35
    adamransom commented #403
  • 09:33
    solnic commented #403
  • 09:29
    adamransom edited #403
  • 09:27
    adamransom opened #403
  • Jul 31 07:02
    flash-gordon commented #130
  • Jul 31 04:56

    solnic on master

    Merge pull request #131 from da… (compare)

  • Jul 31 04:55

    solnic on release-1.3

    small grammar changes to improv… Merge pull request #131 from da… (compare)

  • Jul 31 04:55
    solnic closed #131
  • Jul 31 04:53

    solnic on release-0.8

    Merge pull request #30 from dav… (compare)

  • Jul 31 04:51

    solnic on master

    Added in missing word and missi… Merge pull request #30 from dav… (compare)

  • Jul 31 04:51
    solnic closed #30
  • Jul 31 04:51
    solnic edited #30
  • Jul 31 00:21
    davich opened #131
Tim Riley
@timriley
Of course, you take a risk whenever you use master of anything, but AFAIK it’s fine here :)
panigrah
@panigrah

@timriley the following doesn't work on master any more. fails with a NoMethodError for 'key'

 require 'dry-validation'
 class Schema < Dry::Validation::Schema::Form
      key(:email) { |email| email.filled? }
  end

did the API change?

Tim Riley
@timriley
Yeah, it did.
required(:email).filled is whart you want now
dry-rb/dry-validation#99 is a decent summary
David Strauß
@stravid
@timriley upboated! Please keep writing them :)
Benjamin Klotz
@tak1n
ugh dry-rb/dry-types#78 :(
panigrah
@panigrah
@timriley In master - I also cannot extend Dry::Validation::Schema::Form as described in documentation - is that intentional? See my excerpt above. Thanks
Hannes Nevalainen
@kwando
@panigrah
Dry::Validation.Form{
  key(:email) { |email| email.filled? }
}
New syntax
panigrah
@panigrah
Thanks @kwando I wanted to know if the old syntax is supported or retired. Guessing it is retired
Hannes Nevalainen
@kwando
Yeah, it is retired =)
Tim Cooper
@coop
I wonder if it is worth adding a caluse to the README explaining that these docs are for master - checkout the appropiate release for the relevant docs.
I’m sure I’ve seen other projects do that.
Hannes Nevalainen
@kwando
:thumbsup: for that
dan-klasson
@dan-klasson
@coop actually the docs is for the latest release, not master
Tim Cooper
@coop
@dan-klasson the docs on the website are but I said README.md.
dan-klasson
@dan-klasson
@coop but there is nothing in the README
Tim Cooper
@coop

@dan-klasson

I wonder if it is worth adding a caluse to the README explaining ...

dan-klasson
@dan-klasson
... that these docs are for maste
r
Tim Cooper
@coop
Right, I feel like I wasn’t clear, I meant the docs in the README.
dan-klasson
@dan-klasson
hehe, but there are no docs in the README. that's why i'm totally confused right now :)
Fran Worley
@fran-worley
What would be amazing is to be able to view the docs on the website by release
Tim Cooper
@coop
That makes sense becauase the docs will only reference the current released version.
@fran-worley I believe Bundler does that.
Fran Worley
@fran-worley
I mean the dry-rb.org site
Tim Cooper
@coop
I know - I’m saying that bundler does something similar.
Fran Worley
@fran-worley
Ah didn't know that.
It might solve a lot of the syntax changing queries if people could view the docs on the site by version vs Master. e.g. http://dry-rb.org/gems/dry-validation/v-0.7.4
Tim Cooper
@coop
I like it.
Bundler just copy over the docs for each release - https://github.com/bundler/bundler-site/tree/master/source
Fran Worley
@fran-worley
Yeah, I'm talking about taking what is on the dry-rb site rather than the readme/docs for the repo itself
that way when versions get bumped and the docs/ examples on the site are changed those running old versions don't miss out
Tim Cooper
@coop
I totally get what you mean, I’m just linking to how bundler is doing it. Their docs site is generated from https://github.com/bundler/bundler-site. The dry-rb.org docs site is generated from https://github.com/dry-rb/dry-rb.org/.
Fran Worley
@fran-worley
Sorry, my brain is not engaging... I know understand what you mean!
I thought you meant that bundler does some magic with rubygem docs for versions... must get a :coffee: before I do anything else!
Tim Cooper
@coop
:P
Tim Cooper
@coop

@timriley I’ve been reading over your article again and I have a feeling that you meant to say that an Article is an entity not a value object. From your article you quote the definition of a value object as:

A value object is one whose notion of equality is based on the values of the attributes it contains, not its object identity.

I agree with this but your article class includes an id field:

class Article < Dry::Types::Struct
  attribute :id, Types::Strict::Int
  attribute :title, Types::Strict::String
  attribute :body, Types::Strict::String
end

I think we both will agree that Article.new(id: 1, title: “title”, body: “body”) != Article.new(id: 1, title: “amended title”, body: “body”) in code land but in the real world the objects are the same, they’re both referring to the exact same article (the second article is modified and therefore its title is different).

IMO a value object is something that is only identifiable by its attributes, things like money, name, address and credit cards.

I did enjoy the article though, just my 2 cents.

Simon Schmid
@sled
@coop :+1:
Tim Riley
@timriley
Good point, @coop. id being there is kind of a smell that it’s not a true value object.
Simon Schmid
@sled
but it leaves me wondering how to handle objects which could be in an invalid state :)
Tim Riley
@timriley
Even though the the equality methods on Dry::Types::Struct still take into account all the attributes.
@sled we just treat invalid data as just that - a hash of invalid params/attributes
pass it around until like that the user can make it valid
Simon Schmid
@sled
@timriley what do you think about an anonymous class which represents the hash as simple struct with attr_readers ?
kind of a "representer" of the invalid data
Tim Riley
@timriley
What does that get you over a hash?
Simon Schmid
@sled
@timriley compatibility with existing libraries which can't handle hashes directly