postmodern · @postmodern
1347 followers · 2080 posts · Server ruby.social

TIL Types::Hash.map is still not fully supported by dry-schema/dry-validations. :(
github.com/dry-rb/dry-types/co

#dry_rb #dry_types

Last updated 1 year ago

postmodern · @postmodern
1344 followers · 2057 posts · Server ruby.social

Solved: use `Types::Symbol.enum(symbol: 'string', ...)` if you want to convert Strings into Symbols.

#dry_rb #dry_types

Last updated 1 year ago

postmodern · @postmodern
1291 followers · 1809 posts · Server ruby.social

Clever. dry-validations allows for rules to execute on each value in an Array using `rule(:name).each do ...`.
dry-rb.org/gems/dry-validation

#dry_rb #dry_validations

Last updated 1 year ago

postmodern · @postmodern
1235 followers · 1540 posts · Server ruby.social

Now that I'm writing HTML forms to pass params to dry-validations/dry-schema, I'm wondering if anyone has built a form builder library that can interpret dry-types and generate the appropriate form fields? Or is that what trailblazer is for?

#dry_rb

Last updated 1 year ago

postmodern · @postmodern
1215 followers · 1454 posts · Server ruby.social

How do you specify a String or Regexp type in a dry-schema?

#dry_rb

Last updated 1 year ago

postmodern · @postmodern
1215 followers · 1453 posts · Server ruby.social

How do you specify the key and value types of a Hash using dry-schema?

#dry_rb

Last updated 1 year ago

postmodern · @postmodern
1213 followers · 1448 posts · Server ruby.social

and here's the end-result of all of my dry-rb questions and complaining about docker/docker-compose. A small Sinatra app which uses dry-schema/dry-validations to validate/coerce form input, pass it to a Sidekiq worker, and coerce the JSON params back into a Symbol Hash, which is then **kwargs splatted to another library.
github.com/ronin-rb/ronin-app

#dry_rb #sinatra #sidekiq

Last updated 1 year ago

postmodern · @postmodern
1212 followers · 1431 posts · Server ruby.social

Once you've defined your Dry::Types, Dry::Schemas, and Dry::Validations, do you typically also write tests to double check that they work as intended? Or do you trust the declarative nature of the dry-* libraries?

#dry_rb

Last updated 1 year ago

postmodern · @postmodern
1210 followers · 1408 posts · Server ruby.social

What is the dry-rb way of rendering validation errors for forms in Sinatra? I kind of don't want to reinvent the wheel and roll my own form builder methods; although I probably will so that they integrate with Bulma CSS classes.

#dry_rb #sinatra

Last updated 1 year ago

postmodern · @postmodern
1212 followers · 1380 posts · Server ruby.social

Is there a way to convert `Dry::Schema.Params` into an identical `Dry::Schema.JSON` schema? What if I want to coerce/validate both HTTP params and deserialized JSON params?

#dryrb #dry_rb

Last updated 1 year ago

postmodern · @postmodern
1212 followers · 1377 posts · Server ruby.social

Why doesn't `Dry::Types::Range` have an `.of()` method for specifying that the Range must be of Integers or Strings?

#dryrb #dry_rb

Last updated 1 year ago

postmodern · @postmodern
1211 followers · 1371 posts · Server ruby.social

Where should I store my dry-validation or dry-schema classes if I'm not using Hanami or Rails? Obviously if I was using dry-struct, I'd store them in `models/`. However, where should dry-validation contract classes go?

#dryrb #dry_rb

Last updated 1 year ago

Peter Solnica · @solnic
1550 followers · 1020 posts · Server ruby.social

I'm planning (🤞) to start publishing again. Maybe this time it'll work - so here's a question: what would you be interested in seeing the most?

#ruby #hanami #dry_rb #programming #blog #screencasts #poll

Last updated 2 years ago

Esparta :ruby: · @esparta
169 followers · 817 posts · Server ruby.social

@solnic hi Peter, welcome back!

I'm glad you had time to recharge and get some rest, and please don't hesitate to take more, we (the community) are OK, the & can always wait because you, the person, is always more important than any work project that happen to depend in them and your leadership and tremendous knowledge and passion.

Thanks, and welcome back, again.

#hamani #dry_rb

Last updated 2 years ago

Peter Solnica · @solnic
1378 followers · 784 posts · Server ruby.social

I released dry-matcher 1.0.0 today. It's something we built years ago and I remember that this was yet another "weird concept" we were bringing to 🙀

Eventually, Pattern Matching was introduced as one of the new language features and now more and more people are adopting it 🤓

Seeing functional concepts becoming part of Ruby makes me very happy. I hope all the naysayers have changed their mind already! 😊

#ruby #dry_rb #patternmatching

Last updated 2 years ago

Peter Solnica · @solnic
1354 followers · 702 posts · Server ruby.social
Dan Healy · @danhealy
13 followers · 37 posts · Server ruby.social

combining , , and sidekiq-dry gem

#chatgpt #sidekiq #dry_rb

Last updated 2 years ago

dry-rb · @dry_rb
90 followers · 3 posts · Server ruby.social

📣 dry-schema 1.13.0 was just released which ships with upgraded dry-logic to 1.5.0 - it fixes compatibility with `eql?` and `respond_to?` predicates which previously were conflicting with the default implementation in Object.

See full changelog 👇

github.com/dry-rb/dry-schema/r

#ruby #dry_rb #rubygem #validation #oss #opensource #library

Last updated 2 years ago

Hanami · @hanami
117 followers · 2 posts · Server ruby.social
William Neal · @Sandbagger
90 followers · 192 posts · Server ruby.social

@d_s thanks I never came across before.

What do you think the value of introducing functional concepts into Ruby is?

In what circumstances do you think the abstraction is worth it?

#dry_rb

Last updated 2 years ago