Sha256: 785681ccfeaeb7868f5d926442786e4cbf8e04050814577953de926829cbb4c1

Contents?: true

Size: 756 Bytes

Versions: 1

Compression:

Stored size: 756 Bytes

Contents

require 'active_support/concern'

module Grape
  module DSL
    module Validations
      extend ActiveSupport::Concern

      module ClassMethods
        def reset_validations!
          settings.peek[:declared_params] = []
          settings.peek[:validations] = []
        end

        def params(&block)
          Grape::Validations::ParamsScope.new(api: self, type: Hash, &block)
        end

        def document_attribute(names, opts)
          @last_description ||= {}
          @last_description[:params] ||= {}
          Array(names).each do |name|
            @last_description[:params][name[:full_name].to_s] ||= {}
            @last_description[:params][name[:full_name].to_s].merge!(opts)
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
grape-0.9.0 lib/grape/dsl/validations.rb