lib/grape/kaminari.rb in grape-kaminari-0.1.0 vs lib/grape/kaminari.rb in grape-kaminari-0.1.1

- old
+ new

@@ -1,6 +1,7 @@ require "grape/kaminari/version" +require "grape/kaminari/max_value_validator" require "kaminari/grape" module Grape module Kaminari def self.included(base) @@ -15,15 +16,19 @@ end end end def self.paginate(options = {}) - options.reverse_merge!(per_page: 10) + options.reverse_merge!( + per_page: 10, + max_per_page: false + ) params do optional :page, type: Integer, default: 1, desc: 'Page offset to fetch.' optional :per_page, type: Integer, default: options[:per_page], - desc: 'Number of results to return per page.' + desc: 'Number of results to return per page.', + max_value: options[:max_per_page] end end end end end