lib/grape.rb in grape-1.6.2 vs lib/grape.rb in grape-1.7.0

- old
+ new

@@ -5,23 +5,26 @@ require 'rack/builder' require 'rack/accept' require 'rack/auth/basic' require 'rack/auth/digest/md5' require 'set' +require 'bigdecimal' +require 'date' require 'active_support' +require 'active_support/concern' require 'active_support/version' require 'active_support/isolated_execution_state' if ActiveSupport::VERSION::MAJOR > 6 -require 'active_support/core_ext/hash/indifferent_access' -require 'active_support/core_ext/object/blank' +require 'active_support/core_ext/array/conversions' require 'active_support/core_ext/array/extract_options' require 'active_support/core_ext/array/wrap' -require 'active_support/core_ext/array/conversions' +require 'active_support/core_ext/hash/conversions' require 'active_support/core_ext/hash/deep_merge' -require 'active_support/core_ext/hash/reverse_merge' require 'active_support/core_ext/hash/except' +require 'active_support/core_ext/hash/indifferent_access' +require 'active_support/core_ext/hash/reverse_merge' require 'active_support/core_ext/hash/slice' -require 'active_support/core_ext/hash/conversions' +require 'active_support/core_ext/object/blank' require 'active_support/dependencies/autoload' require 'active_support/notifications' require 'i18n' I18n.load_path << File.expand_path('grape/locale/en.yml', __dir__) @@ -43,10 +46,11 @@ autoload :Parser autoload :Request autoload :Env, 'grape/util/env' autoload :Json, 'grape/util/json' autoload :Xml, 'grape/util/xml' + autoload :DryTypes end module Http extend ::ActiveSupport::Autoload eager_autoload do @@ -69,18 +73,21 @@ autoload :UnknownValidator autoload :UnknownOptions autoload :UnknownParameter autoload :InvalidWithOptionForRepresent autoload :IncompatibleOptionValues - autoload :MissingGroupTypeError, 'grape/exceptions/missing_group_type' - autoload :UnsupportedGroupTypeError, 'grape/exceptions/unsupported_group_type' + autoload :MissingGroupType + autoload :UnsupportedGroupType autoload :InvalidMessageBody autoload :InvalidAcceptHeader autoload :InvalidVersionHeader autoload :MethodNotAllowed autoload :InvalidResponse autoload :EmptyMessageBody + autoload :TooManyMultipartFiles + autoload :MissingGroupTypeError, 'grape/exceptions/missing_group_type' + autoload :UnsupportedGroupTypeError, 'grape/exceptions/unsupported_group_type' end end module Extensions extend ::ActiveSupport::Autoload @@ -216,36 +223,67 @@ autoload :FileBody autoload :SendfileResponse autoload :StreamResponse end end + + module Validations + extend ::ActiveSupport::Autoload + + eager_autoload do + autoload :AttributesIterator + autoload :MultipleAttributesIterator + autoload :SingleAttributeIterator + autoload :Types + autoload :ParamsScope + autoload :ValidatorFactory + autoload :Base, 'grape/validations/validators/base' + end + + module Types + extend ::ActiveSupport::Autoload + + eager_autoload do + autoload :InvalidValue + autoload :DryTypeCoercer + autoload :ArrayCoercer + autoload :SetCoercer + autoload :PrimitiveCoercer + autoload :CustomTypeCoercer + autoload :CustomTypeCollectionCoercer + autoload :MultipleTypeCoercer + autoload :VariantCollectionCoercer + end + end + + module Validators + extend ::ActiveSupport::Autoload + + eager_autoload do + autoload :Base + autoload :MultipleParamsBase + autoload :AllOrNoneOfValidator + autoload :AllowBlankValidator + autoload :AsValidator + autoload :AtLeastOneOfValidator + autoload :CoerceValidator + autoload :DefaultValidator + autoload :ExactlyOneOfValidator + autoload :ExceptValuesValidator + autoload :MutualExclusionValidator + autoload :PresenceValidator + autoload :RegexpValidator + autoload :SameAsValidator + autoload :ValuesValidator + end + end + end end require 'grape/config' require 'grape/content_types' require 'grape/util/lazy_value' require 'grape/util/lazy_block' require 'grape/util/endpoint_configuration' - -require 'grape/validations/validators/base' -require 'grape/validations/attributes_iterator' -require 'grape/validations/single_attribute_iterator' -require 'grape/validations/multiple_attributes_iterator' -require 'grape/validations/validators/allow_blank' -require 'grape/validations/validators/as' -require 'grape/validations/validators/at_least_one_of' -require 'grape/validations/validators/coerce' -require 'grape/validations/validators/default' -require 'grape/validations/validators/exactly_one_of' -require 'grape/validations/validators/mutual_exclusion' -require 'grape/validations/validators/presence' -require 'grape/validations/validators/regexp' -require 'grape/validations/validators/same_as' -require 'grape/validations/validators/values' -require 'grape/validations/validators/except_values' -require 'grape/validations/params_scope' -require 'grape/validations/validators/all_or_none' -require 'grape/validations/types' -require 'grape/validations/validator_factory' require 'grape/version'