These are chat archives for dry-rb/chat

28th
Jan 2018
Orban Botond
@orbanbotond
Jan 28 2018 16:56

Hi,

Is there something in the trailblazer ecosystem which extracts the info from the reform’s validation block:

    validation :default do
      required(:first_name).filled(:str?)
      required(:last_name).filled(:str?)
      required(:new_email).filled(:str?, format?: /.+@.*\./)
      required(:password).filled
    end

Into a swagger compatible documentation:

    class << self
      def documentation
        {
          first_name:{required:true, type:"String", desc:"First Name"},
          last_name:{required:true, type:"String", desc:"Last Name"},
          new_email:{required:true, type:"String", desc:"New Email"},
          password:{required:true, type:"String", desc:"Password"}
        }        
      end
    end

So that it can be used in swaggers the params declaration:
params Registration::InvestorForm.documentation

Gustavo Caso
@GustavoCaso
Jan 28 2018 16:57
@orbanbotond this is the dry-rb channel I think you will get more luck in the trailblazer channel :smile:
Orban Botond
@orbanbotond
Jan 28 2018 16:58
oh… right :D
Thx. @GustavoCaso , sorry for the wrong message.
Gustavo Caso
@GustavoCaso
Jan 28 2018 16:58
No need to apologise :smile: