Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Dec 07 14:03

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 07 10:01
    Travis dry-rb/dry-view (master) errored (636)
  • Dec 07 09:58
    Travis dry-rb/dry-view (master) errored (635)
  • Dec 07 09:56

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 07 09:56

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 07 09:56

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 07 09:56

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 07 09:56

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 07 09:56

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 07 09:56

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 07 09:56

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 07 09:56

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 07 09:56

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 07 09:56

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 07 09:56

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 07 09:54

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 07 09:54

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 07 09:54

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 07 09:54

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 07 09:54

    dry-bot on master

    [devtools] config sync (compare)

Nicolas Cavigneaux
@Bounga
Yes so if the attribute is not present there's no check, that dry-validation job which provides required keyword
Thank a lot for your help
Gustavo Caso
@GustavoCaso
Yes I think Hanami use dry-validations right?
Nicolas Cavigneaux
@Bounga
yes
Gustavo Caso
@GustavoCaso
Nice so you can solve the issue right ?
Nicolas Cavigneaux
@Bounga
Yes I was doing my check in the wrong place
Gustavo Caso
@GustavoCaso
:+1:
Hamza Khan-Cheema
@hamzakc
What tools are people were using for API documentation. I have used swagger::blocks before (https://github.com/fotinakis/swagger-blocks) Anyone using anything else in a dry-web app ?
Semyon Pupkov
@artofhuman

Hi, i have question about dynamic arguments in dry-v schema

I try to define schema

        CreateSchema = Dry::Validation.Form do
          configure do
            option :min_time

            def time_range
              min_time...Time.current
            end
          end

          required(:start_at).filled(:time?, included_in?: time_range)
     end

but i have the error when use this schema

CreateSchema.with(min_time: 10.minutes.ago).call(params)

Failure/Error: min_time...Time.current

ArgumentError:
  bad value for range

I think this error raised when schema compiled and option min_time at thid moment is nil. It’s right way to define schema like this with dynamic agruments?

Gustavo Caso
@GustavoCaso
I think the error comes from min...Time.current
11...Time.current
ArgumentError: bad value for range
Gustavo Caso
@GustavoCaso
Ups sorry my fault
Semyon Pupkov
@artofhuman
I use custom validation block =) thanks
Gustavo Caso
@GustavoCaso
I wish I was a better help :smile:
Calinoiu Alexandru Nicolae
@alexandru-calinoiu
HI all, do you guys know of an online workshop (payed on not) that I can point someone to learn about dry? Even if is something similar to rails book.
Spencer Goh
@dymaxionuk
Modular components, what is the preferred way of doing this in dry-web? http://dry-rb.org/gems/dry-system/component-providers/ suggests writing a gem, that you boot up from your container. The other way I noticed like dry logging/monitor, is that a plugin is "use"d in a container. And it then registers an instance into the container.
Oskar Szrajer
@gotar
@hamzakc almost sure you cannot use swagger. It’s generate doc based on routes. Dry web use roda. It’s. Tree based routing. Generating swagger doc (automatically) probably will not be possible. (But never tried myself)
@alexandru-calinoiu @timriley prepared some offline lessons and made few of it around the world. Not sure it’s possible now and online.
Tim Riley
@timriley
It’s not an online thing, unfortunately. @alexandru-calinoiu as solnic mentioned in the forum, detailed guides/workshops etc. will probably wait until we’re 1.0 on the gems
Spencer Goh
@dymaxionuk

How are we supposed to mock operations?

class MyOp
  def call(inputs)
    // lightweight do something
    my_wrapped_op.call(stuff) do |m|
      m.success do |v|
         // do something
      end
    end
    // clean up and return stuff
  end
end

This however doesn't work because my_wrapped_op should call the block with a Dry::Matcher::Evaluator - my test however shouldn't get into the internals of dry operations.

expect MyOp.to_receive(:call) {|&block| block.call( Success('something') }

Am I approaching this wrong?

Gustavo Caso
@GustavoCaso
Are we talking about dry-transaction? @dymaxionuk
Gustavo Caso
@GustavoCaso
?
Nico Ritschel
@nicosuave
Has anyone nested transactions with dry-transaction? I'm thinking this might provide a sane way to organize a moderately complex flow with lots of branching & provide more encapsulation/reusability. I.e. a single step in a parent transaction calls a child transaction
Nico Ritschel
@nicosuave
I am not using operations containers, but rather local operations and anything common I have just been extracting into behvaior-centric modules, so perhaps I'm missing critical info here.
Tim Riley
@timriley
@nicosuave I don’t see why you couldn’t use a transaction object as a step for another transaction
Nico Ritschel
@nicosuave
Thanks @timriley, I was hoping to avoid anti-patterns and was curious if anyone had composed transactions similarly. Will proceed forward :metal:
Tim Riley
@timriley
Trasactions are just operations themselves, at the end of the day
Nico Ritschel
@nicosuave
:)
Spencer Goh
@dymaxionuk
@GustavoCaso sorry that class MyOp was supposed to be a dry-transaction/operation
Guilherme Moreira
@gmmoreira
@nicosuave I have been using and they work pretty well. The interface of a transaction is the same of the operations, respond to call and return success or failure.
Alexander
@cutalion
hey! Are there somebody who can show test setup with dry-system and stubs?
My problem is that I have a boot.rb file, which I load in tests, but it finalizes and freezes the app container, so enable_stubs! does not work after that.
Alexander
@cutalion
for now I ended with this in my boot.rb file (which loads everything and is a entry point for the app)
if ENV['RACK_ENV'] == 'test'
  require 'dry/system/stubs'
  App.enable_stubs!
end
btw, I wrote this a long time ago:
require_relative 'app/container'
require_relative 'app/transaction'
require_relative 'app/operation'
require_relative 'app/import'

if ENV['RACK_ENV'] == 'test'
  require 'dry/system/stubs'
  App.enable_stubs!
end

App.finalize! do |container|
  # Boot the app config before everything else
  container.start :app_config
  container.start :i18n
end

require_relative 'app/api'
Alexander
@cutalion
I remember I looked at berg app and was trying to build my own app. So, I do not remember why I require api after finalize! :smile:
app/api here defines grape application.
Can somebody else share config for dry-system/dry-web application too? Would be interesting to compare
Tim Riley
@timriley
@cutalion don’t load the boot file in tests
@cutalion just require the container directly: require “my_app/container”, this will leave it un-finalized and allow you to add the stubs support
Steve Clarke
@srcnix
Is there anyway in Dry System Container to load all files in a specific directory as bootable? Or is it a simple case of that's how much app works so down to me? Just wondering what conventions are already built in.
Piotr Solnica
@solnic
@srcnix bootable components are registered via Container.boot method
by convention, we store them under {system_dir}/boot/*.rb
Steve Clarke
@srcnix
Thanks @solnic
Mateusz Kluge
@inclooder
Hello, Is it possible to set default value for key in dry-validation ? For example optional(:enabled).maybe(:bool?) to be false by default?
Lairan
@alex-lairan

You can use http://dry-rb.org/gems/dry-validation/input-preprocessing/

optional(:enabled, FalseBoolean).maybe(:bool?)

Mateusz Kluge
@inclooder
How would you define FalseBolean ? Dry::Types.module::Bool.default(false) or Dry::Types.module::Strict::Bool.default(false) ?
Does it matter ?
Lairan
@alex-lairan

I don't know, sorry :s

An example of what i've done:

module Types
  include Dry::Types.module

  Checkbox = Types::Bool.constructor do |str|
    str == '1' || str == true || str == 'true'
  end
end
I think you can do something like
FalseBolean = Types::Bool.constructor do |value|
  value || false
end
Mateusz Kluge
@inclooder
Thank you @alex-lairan I'll check if that solves my problem. Have a good day :+1:
Lairan
@alex-lairan
:+1:
Ivan Shamatov
@IvanShamatov
Hello there