Module: Grape
- Extended by:
- Dry::Configurable
- Defined in:
- lib/grape/router/greedy_route.rb,
lib/grape.rb,
lib/grape/api.rb,
lib/grape/env.rb,
lib/grape/xml.rb,
lib/grape/json.rb,
lib/grape/path.rb,
lib/grape/parser.rb,
lib/grape/router.rb,
lib/grape/cookies.rb,
lib/grape/railtie.rb,
lib/grape/request.rb,
lib/grape/testing.rb,
lib/grape/version.rb,
lib/grape/dsl/desc.rb,
lib/grape/endpoint.rb,
lib/grape/dry_types.rb,
lib/grape/formatter.rb,
lib/grape/mountable.rb,
lib/grape/namespace.rb,
lib/grape/dsl/entity.rb,
lib/grape/dsl/logger.rb,
lib/grape/parser/xml.rb,
lib/grape/util/cache.rb,
lib/grape/dsl/headers.rb,
lib/grape/dsl/helpers.rb,
lib/grape/dsl/routing.rb,
lib/grape/parser/base.rb,
lib/grape/parser/json.rb,
lib/grape/util/header.rb,
lib/grape/validations.rb,
lib/grape/api/instance.rb,
lib/grape/dsl/declared.rb,
lib/grape/dsl/settings.rb,
lib/grape/router/route.rb,
lib/grape/content_types.rb,
lib/grape/dsl/callbacks.rb,
lib/grape/formatter/txt.rb,
lib/grape/formatter/xml.rb,
lib/grape/util/registry.rb,
lib/grape/dsl/middleware.rb,
lib/grape/dsl/parameters.rb,
lib/grape/formatter/base.rb,
lib/grape/formatter/json.rb,
lib/grape/params_builder.rb,
lib/grape/router/pattern.rb,
lib/grape/util/lazy/base.rb,
lib/grape/dsl/validations.rb,
lib/grape/error_formatter.rb,
lib/grape/exceptions/base.rb,
lib/grape/middleware/base.rb,
lib/grape/util/lazy/block.rb,
lib/grape/util/lazy/value.rb,
lib/grape/util/media_type.rb,
lib/grape/dsl/inside_route.rb,
lib/grape/endpoint/options.rb,
lib/grape/middleware/error.rb,
lib/grape/middleware/stack.rb,
lib/grape/precompiled_json.rb,
lib/grape/util/deep_freeze.rb,
lib/grape/util/translation.rb,
lib/grape/middleware/filter.rb,
lib/grape/router/base_route.rb,
lib/grape/validations/types.rb,
lib/grape/dsl/rescue_options.rb,
lib/grape/util/freeze_on_new.rb,
lib/grape/dsl/version_options.rb,
lib/grape/error_formatter/txt.rb,
lib/grape/error_formatter/xml.rb,
lib/grape/middleware/auth/dsl.rb,
lib/grape/params_builder/base.rb,
lib/grape/params_builder/hash.rb,
lib/grape/router/pattern/path.rb,
lib/grape/dsl/request_response.rb,
lib/grape/error_formatter/base.rb,
lib/grape/error_formatter/json.rb,
lib/grape/middleware/auth/base.rb,
lib/grape/middleware/formatter.rb,
lib/grape/middleware/versioner.rb,
lib/grape/presenters/presenter.rb,
lib/grape/util/api_description.rb,
lib/grape/util/lazy/value_hash.rb,
lib/grape/util/path_normalizer.rb,
lib/grape/exceptions/validation.rb,
lib/grape/util/lazy/value_array.rb,
lib/grape/util/stackable_values.rb,
lib/grape/serve_stream/file_body.rb,
lib/grape/validations/types/file.rb,
lib/grape/validations/types/json.rb,
lib/grape/declared_params_handler.rb,
lib/grape/exceptions/request_error.rb,
lib/grape/util/inheritable_setting.rb,
lib/grape/validations/params_scope.rb,
lib/grape/exceptions/error_response.rb,
lib/grape/middleware/versioner/base.rb,
lib/grape/middleware/versioner/path.rb,
lib/grape/router/mustermann_pattern.rb,
lib/grape/middleware/auth/strategies.rb,
lib/grape/middleware/versioner/param.rb,
lib/grape/params_builder/hashie_mash.rb,
lib/grape/util/lazy/value_enumerable.rb,
lib/grape/validations/coerce_options.rb,
lib/grape/validations/contract_scope.rb,
lib/grape/validations/shared_options.rb,
lib/grape/exceptions/invalid_response.rb,
lib/grape/formatter/serializable_hash.rb,
lib/grape/middleware/versioner/header.rb,
lib/grape/util/endpoint_configuration.rb,
lib/grape/validations/oneof_collector.rb,
lib/grape/validations/validators/base.rb,
lib/grape/exceptions/invalid_formatter.rb,
lib/grape/exceptions/missing_mime_type.rb,
lib/grape/exceptions/unknown_parameter.rb,
lib/grape/exceptions/unknown_validator.rb,
lib/grape/exceptions/validation_errors.rb,
lib/grape/serve_stream/stream_response.rb,
lib/grape/validations/validations_spec.rb,
lib/grape/exceptions/method_not_allowed.rb,
lib/grape/exceptions/missing_group_type.rb,
lib/grape/middleware/auth/strategy_info.rb,
lib/grape/util/shadowed_rescue_handlers.rb,
lib/grape/validations/types/set_coercer.rb,
lib/grape/serve_stream/sendfile_response.rb,
lib/grape/exceptions/invalid_message_body.rb,
lib/grape/validations/attributes_iterator.rb,
lib/grape/validations/param_scope_tracker.rb,
lib/grape/validations/types/array_coercer.rb,
lib/grape/validations/types/invalid_value.rb,
lib/grape/exceptions/internal_server_error.rb,
lib/grape/exceptions/invalid_accept_header.rb,
lib/grape/exceptions/missing_vendor_option.rb,
lib/grape/exceptions/unknown_auth_strategy.rb,
lib/grape/validations/params_documentation.rb,
lib/grape/error_formatter/serializable_hash.rb,
lib/grape/exceptions/invalid_version_header.rb,
lib/grape/exceptions/unknown_params_builder.rb,
lib/grape/exceptions/unsupported_group_type.rb,
lib/grape/exceptions/unknown_error_formatter.rb,
lib/grape/exceptions/validation_array_errors.rb,
lib/grape/validations/types/dry_type_coercer.rb,
lib/grape/exceptions/invalid_versioner_option.rb,
lib/grape/validations/types/primitive_coercer.rb,
lib/grape/validations/validators/as_validator.rb,
lib/grape/middleware/precomputed_content_types.rb,
lib/grape/exceptions/incompatible_option_values.rb,
lib/grape/validations/single_attribute_iterator.rb,
lib/grape/validations/types/custom_type_coercer.rb,
lib/grape/validations/validators/oneof_validator.rb,
lib/grape/validations/types/multiple_type_coercer.rb,
lib/grape/validations/validators/coerce_validator.rb,
lib/grape/validations/validators/length_validator.rb,
lib/grape/validations/validators/regexp_validator.rb,
lib/grape/validations/validators/values_validator.rb,
lib/grape/validations/multiple_attributes_iterator.rb,
lib/grape/validations/validators/default_validator.rb,
lib/grape/validations/validators/same_as_validator.rb,
lib/grape/validations/validators/presence_validator.rb,
lib/grape/middleware/versioner/accept_version_header.rb,
lib/grape/params_builder/hash_with_indifferent_access.rb,
lib/grape/validations/validators/multiple_params_base.rb,
lib/grape/exceptions/invalid_with_option_for_represent.rb,
lib/grape/validations/types/variant_collection_coercer.rb,
lib/grape/validations/validators/allow_blank_validator.rb,
lib/grape/validations/validators/except_values_validator.rb,
lib/grape/validations/validators/all_or_none_of_validator.rb,
lib/grape/validations/validators/contract_scope_validator.rb,
lib/grape/validations/validators/exactly_one_of_validator.rb,
lib/grape/validations/types/custom_type_collection_coercer.rb,
lib/grape/validations/validators/at_least_one_of_validator.rb,
lib/grape/validations/validators/mutually_exclusive_validator.rb
Overview
Versioners set env when a version is defined on an API and on the requests. The current methods for determining version are:
:header - version from HTTP Accept header.
:accept_version_header - version from HTTP Accept-Version header
:path - version from uri. e.g. /v1/resource
:param - version from uri query string, e.g. /v1/resource?apiver=v1
See individual classes for details.
Defined Under Namespace
Modules: ContentTypes, DSL, DryTypes, Env, ErrorFormatter, Exceptions, Formatter, Json, Middleware, Mountable, ParamsBuilder, Parser, Presenters, ServeStream, Testing, Util, Validations Classes: API, Cookies, DeclaredParamsHandler, Endpoint, Namespace, PrecompiledJson, Railtie, Request, Router
Constant Summary collapse
- QUERY =
The HTTP QUERY method (RFC 10008): a safe, idempotent request whose content carries the query. Rack has no constant for it yet, hence the literal.
'QUERY'- HTTP_SUPPORTED_METHODS =
[ Rack::GET, QUERY, Rack::POST, Rack::PUT, Rack::PATCH, Rack::DELETE, Rack::HEAD, Rack::OPTIONS ].freeze
- RACK_ERRORS =
Rack errors that should be rescued and wrapped as Grape::Exceptions::RequestError. Rack 3.1.0 introduced Rack::BadRequest as a marker module included by all bad request exception classes, allowing a single rescue entry to cover them all. Before, these errors are raised as individual exception classes.
if Gem::Version.new(Rack.release) >= Gem::Version.new('3.1.0') [EOFError, Rack::BadRequest] else [ EOFError, Rack::Multipart::MultipartPartLimitError, Rack::Multipart::MultipartTotalPartLimitError, Rack::Utils::ParameterTypeError, Rack::Utils::InvalidParameterError, Rack::QueryParser::ParamsTooDeepError ] end.freeze
- Xml =
::ActiveSupport::XmlMini
- Path =
Deprecated.
Grape::Pathmoved to Router::Pattern::Path, since it is a router-internal detail that only exists to build a Router::Pattern. Reference the new constant instead. ActiveSupport::Deprecation::DeprecatedConstantProxy.new( 'Grape::Path', 'Grape::Router::Pattern::Path', Grape.deprecator )
- VERSION =
'4.0.1'
Class Method Summary collapse
-
.deprecator ⇒ Object
The deprecation horizon is the version a deprecation announces as its removal point, so it is the next major rather than the current one, and it is derived from VERSION rather than written out.
Class Method Details
.deprecator ⇒ Object
The deprecation horizon is the version a deprecation announces as its
removal point, so it is the next major rather than the current one, and
it is derived from VERSION rather than written out. Written out, it went
stale: it said '2.0' from 2023 (#2353) through all of 2.x, 3.x and 4.x, so
a method deprecated through this deprecator announced a removal version
that had already shipped, and every custom behavior lambda -- how a Rails
app consumes deprecations -- was handed the same wrong number.
105 106 107 |
# File 'lib/grape.rb', line 105 def self.deprecator @deprecator ||= ActiveSupport::Deprecation.new("#{Gem::Version.new(VERSION).segments.first + 1}.0", 'Grape') end |