Showing preview only (1,956K chars total). Download the full file or copy to clipboard to get everything.
Repository: ruby-grape/grape
Branch: master
Commit: 1d8e5e98839c
Files: 334
Total size: 1.8 MB
Directory structure:
gitextract_tszz0ncs/
├── .coveralls.yml
├── .dockerignore
├── .github/
│ ├── FUNDING.yml
│ └── workflows/
│ ├── danger-comment.yml
│ ├── danger.yml
│ ├── edge.yml
│ └── test.yml
├── .gitignore
├── .rspec
├── .rubocop.yml
├── .rubocop_todo.yml
├── .simplecov
├── .yardopts
├── CHANGELOG.md
├── CONTRIBUTING.md
├── Dangerfile
├── Gemfile
├── Guardfile
├── LICENSE
├── README.md
├── RELEASING.md
├── Rakefile
├── SECURITY.md
├── UPGRADING.md
├── benchmark/
│ ├── compile_many_routes.rb
│ ├── issue_mounting.rb
│ ├── large_model.rb
│ ├── nested_params.rb
│ ├── remounting.rb
│ ├── resource/
│ │ └── vrp_example.json
│ └── simple.rb
├── docker/
│ ├── Dockerfile
│ └── entrypoint.sh
├── docker-compose.yml
├── gemfiles/
│ ├── dry_validation.gemfile
│ ├── grape_entity.gemfile
│ ├── hashie.gemfile
│ ├── multi_json.gemfile
│ ├── multi_xml.gemfile
│ ├── rack_2_2.gemfile
│ ├── rack_3_0.gemfile
│ ├── rack_3_1.gemfile
│ ├── rack_3_2.gemfile
│ ├── rack_edge.gemfile
│ ├── rails_7_2.gemfile
│ ├── rails_8_0.gemfile
│ ├── rails_8_1.gemfile
│ └── rails_edge.gemfile
├── grape.gemspec
├── lib/
│ ├── grape/
│ │ ├── api/
│ │ │ └── instance.rb
│ │ ├── api.rb
│ │ ├── content_types.rb
│ │ ├── cookies.rb
│ │ ├── declared_params_handler.rb
│ │ ├── dry_types.rb
│ │ ├── dsl/
│ │ │ ├── callbacks.rb
│ │ │ ├── declared.rb
│ │ │ ├── desc.rb
│ │ │ ├── headers.rb
│ │ │ ├── helpers.rb
│ │ │ ├── inside_route.rb
│ │ │ ├── logger.rb
│ │ │ ├── middleware.rb
│ │ │ ├── parameters.rb
│ │ │ ├── request_response.rb
│ │ │ ├── routing.rb
│ │ │ ├── settings.rb
│ │ │ └── validations.rb
│ │ ├── endpoint.rb
│ │ ├── env.rb
│ │ ├── error_formatter/
│ │ │ ├── base.rb
│ │ │ ├── json.rb
│ │ │ ├── serializable_hash.rb
│ │ │ ├── txt.rb
│ │ │ └── xml.rb
│ │ ├── error_formatter.rb
│ │ ├── exceptions/
│ │ │ ├── base.rb
│ │ │ ├── conflicting_types.rb
│ │ │ ├── empty_message_body.rb
│ │ │ ├── incompatible_option_values.rb
│ │ │ ├── invalid_accept_header.rb
│ │ │ ├── invalid_formatter.rb
│ │ │ ├── invalid_message_body.rb
│ │ │ ├── invalid_parameters.rb
│ │ │ ├── invalid_response.rb
│ │ │ ├── invalid_version_header.rb
│ │ │ ├── invalid_versioner_option.rb
│ │ │ ├── invalid_with_option_for_represent.rb
│ │ │ ├── method_not_allowed.rb
│ │ │ ├── missing_group_type.rb
│ │ │ ├── missing_mime_type.rb
│ │ │ ├── missing_vendor_option.rb
│ │ │ ├── too_deep_parameters.rb
│ │ │ ├── too_many_multipart_files.rb
│ │ │ ├── unknown_auth_strategy.rb
│ │ │ ├── unknown_parameter.rb
│ │ │ ├── unknown_params_builder.rb
│ │ │ ├── unknown_validator.rb
│ │ │ ├── unsupported_group_type.rb
│ │ │ ├── validation.rb
│ │ │ ├── validation_array_errors.rb
│ │ │ └── validation_errors.rb
│ │ ├── formatter/
│ │ │ ├── base.rb
│ │ │ ├── json.rb
│ │ │ ├── serializable_hash.rb
│ │ │ ├── txt.rb
│ │ │ └── xml.rb
│ │ ├── formatter.rb
│ │ ├── json.rb
│ │ ├── locale/
│ │ │ └── en.yml
│ │ ├── middleware/
│ │ │ ├── auth/
│ │ │ │ ├── base.rb
│ │ │ │ ├── dsl.rb
│ │ │ │ ├── strategies.rb
│ │ │ │ └── strategy_info.rb
│ │ │ ├── base.rb
│ │ │ ├── error.rb
│ │ │ ├── filter.rb
│ │ │ ├── formatter.rb
│ │ │ ├── globals.rb
│ │ │ ├── stack.rb
│ │ │ ├── versioner/
│ │ │ │ ├── accept_version_header.rb
│ │ │ │ ├── base.rb
│ │ │ │ ├── header.rb
│ │ │ │ ├── param.rb
│ │ │ │ └── path.rb
│ │ │ └── versioner.rb
│ │ ├── namespace.rb
│ │ ├── params_builder/
│ │ │ ├── base.rb
│ │ │ ├── hash.rb
│ │ │ ├── hash_with_indifferent_access.rb
│ │ │ └── hashie_mash.rb
│ │ ├── params_builder.rb
│ │ ├── parser/
│ │ │ ├── base.rb
│ │ │ ├── json.rb
│ │ │ └── xml.rb
│ │ ├── parser.rb
│ │ ├── path.rb
│ │ ├── presenters/
│ │ │ └── presenter.rb
│ │ ├── railtie.rb
│ │ ├── request.rb
│ │ ├── router/
│ │ │ ├── base_route.rb
│ │ │ ├── greedy_route.rb
│ │ │ ├── pattern.rb
│ │ │ └── route.rb
│ │ ├── router.rb
│ │ ├── serve_stream/
│ │ │ ├── file_body.rb
│ │ │ ├── sendfile_response.rb
│ │ │ └── stream_response.rb
│ │ ├── util/
│ │ │ ├── api_description.rb
│ │ │ ├── base_inheritable.rb
│ │ │ ├── cache.rb
│ │ │ ├── endpoint_configuration.rb
│ │ │ ├── header.rb
│ │ │ ├── inheritable_setting.rb
│ │ │ ├── inheritable_values.rb
│ │ │ ├── lazy/
│ │ │ │ ├── block.rb
│ │ │ │ ├── value.rb
│ │ │ │ ├── value_array.rb
│ │ │ │ ├── value_enumerable.rb
│ │ │ │ └── value_hash.rb
│ │ │ ├── media_type.rb
│ │ │ ├── registry.rb
│ │ │ ├── reverse_stackable_values.rb
│ │ │ ├── stackable_values.rb
│ │ │ └── translation.rb
│ │ ├── validations/
│ │ │ ├── attributes_iterator.rb
│ │ │ ├── contract_scope.rb
│ │ │ ├── multiple_attributes_iterator.rb
│ │ │ ├── param_scope_tracker.rb
│ │ │ ├── params_documentation.rb
│ │ │ ├── params_scope.rb
│ │ │ ├── single_attribute_iterator.rb
│ │ │ ├── types/
│ │ │ │ ├── array_coercer.rb
│ │ │ │ ├── custom_type_coercer.rb
│ │ │ │ ├── custom_type_collection_coercer.rb
│ │ │ │ ├── dry_type_coercer.rb
│ │ │ │ ├── file.rb
│ │ │ │ ├── invalid_value.rb
│ │ │ │ ├── json.rb
│ │ │ │ ├── multiple_type_coercer.rb
│ │ │ │ ├── primitive_coercer.rb
│ │ │ │ ├── set_coercer.rb
│ │ │ │ └── variant_collection_coercer.rb
│ │ │ ├── types.rb
│ │ │ ├── validator_factory.rb
│ │ │ └── validators/
│ │ │ ├── all_or_none_of_validator.rb
│ │ │ ├── allow_blank_validator.rb
│ │ │ ├── as_validator.rb
│ │ │ ├── at_least_one_of_validator.rb
│ │ │ ├── base.rb
│ │ │ ├── coerce_validator.rb
│ │ │ ├── contract_scope_validator.rb
│ │ │ ├── default_validator.rb
│ │ │ ├── exactly_one_of_validator.rb
│ │ │ ├── except_values_validator.rb
│ │ │ ├── length_validator.rb
│ │ │ ├── multiple_params_base.rb
│ │ │ ├── mutually_exclusive_validator.rb
│ │ │ ├── presence_validator.rb
│ │ │ ├── regexp_validator.rb
│ │ │ ├── same_as_validator.rb
│ │ │ └── values_validator.rb
│ │ ├── validations.rb
│ │ ├── version.rb
│ │ └── xml.rb
│ └── grape.rb
└── spec/
├── grape/
│ ├── api/
│ │ ├── custom_validations_spec.rb
│ │ ├── deeply_included_options_spec.rb
│ │ ├── defines_boolean_in_params_spec.rb
│ │ ├── documentation_spec.rb
│ │ ├── inherited_helpers_spec.rb
│ │ ├── instance_spec.rb
│ │ ├── invalid_format_spec.rb
│ │ ├── mount_and_helpers_order_spec.rb
│ │ ├── mount_and_rescue_from_spec.rb
│ │ ├── mounted_helpers_inheritance_spec.rb
│ │ ├── namespace_parameters_in_route_spec.rb
│ │ ├── nested_helpers_spec.rb
│ │ ├── optional_parameters_in_route_spec.rb
│ │ ├── parameters_modification_spec.rb
│ │ ├── patch_method_helpers_spec.rb
│ │ ├── recognize_path_spec.rb
│ │ ├── required_parameters_in_route_spec.rb
│ │ ├── required_parameters_with_invalid_method_spec.rb
│ │ ├── routes_with_requirements_spec.rb
│ │ ├── shared_helpers_exactly_one_of_spec.rb
│ │ └── shared_helpers_spec.rb
│ ├── api_remount_spec.rb
│ ├── api_spec.rb
│ ├── content_types_spec.rb
│ ├── dsl/
│ │ ├── callbacks_spec.rb
│ │ ├── desc_spec.rb
│ │ ├── headers_spec.rb
│ │ ├── helpers_spec.rb
│ │ ├── inside_route_spec.rb
│ │ ├── logger_spec.rb
│ │ ├── middleware_spec.rb
│ │ ├── parameters_spec.rb
│ │ ├── request_response_spec.rb
│ │ ├── routing_spec.rb
│ │ ├── settings_spec.rb
│ │ └── validations_spec.rb
│ ├── endpoint/
│ │ └── declared_spec.rb
│ ├── endpoint_spec.rb
│ ├── exceptions/
│ │ ├── base_spec.rb
│ │ ├── body_parse_errors_spec.rb
│ │ ├── invalid_accept_header_spec.rb
│ │ ├── invalid_formatter_spec.rb
│ │ ├── invalid_response_spec.rb
│ │ ├── invalid_versioner_option_spec.rb
│ │ ├── missing_group_type_spec.rb
│ │ ├── missing_mime_type_spec.rb
│ │ ├── unknown_validator_spec.rb
│ │ ├── unsupported_group_type_spec.rb
│ │ ├── validation_errors_spec.rb
│ │ └── validation_spec.rb
│ ├── integration/
│ │ ├── global_namespace_function_spec.rb
│ │ ├── rack_sendfile_spec.rb
│ │ └── rack_spec.rb
│ ├── loading_spec.rb
│ ├── middleware/
│ │ ├── auth/
│ │ │ ├── base_spec.rb
│ │ │ ├── dsl_spec.rb
│ │ │ └── strategies_spec.rb
│ │ ├── base_spec.rb
│ │ ├── error_spec.rb
│ │ ├── exception_spec.rb
│ │ ├── formatter_spec.rb
│ │ ├── globals_spec.rb
│ │ ├── stack_spec.rb
│ │ ├── versioner/
│ │ │ ├── accept_version_header_spec.rb
│ │ │ ├── header_spec.rb
│ │ │ ├── param_spec.rb
│ │ │ └── path_spec.rb
│ │ └── versioner_spec.rb
│ ├── named_api_spec.rb
│ ├── params_builder/
│ │ ├── hash_spec.rb
│ │ └── hash_with_indifferent_access_spec.rb
│ ├── parser_spec.rb
│ ├── path_spec.rb
│ ├── presenters/
│ │ └── presenter_spec.rb
│ ├── request_spec.rb
│ ├── router/
│ │ └── greedy_route_spec.rb
│ ├── router_spec.rb
│ ├── util/
│ │ ├── inheritable_setting_spec.rb
│ │ ├── inheritable_values_spec.rb
│ │ ├── media_type_spec.rb
│ │ ├── registry_spec.rb
│ │ ├── reverse_stackable_values_spec.rb
│ │ ├── stackable_values_spec.rb
│ │ └── translation_spec.rb
│ ├── validations/
│ │ ├── multiple_attributes_iterator_spec.rb
│ │ ├── param_scope_tracker_spec.rb
│ │ ├── params_documentation_spec.rb
│ │ ├── params_scope_spec.rb
│ │ ├── single_attribute_iterator_spec.rb
│ │ ├── types/
│ │ │ ├── array_coercer_spec.rb
│ │ │ ├── primitive_coercer_spec.rb
│ │ │ └── set_coercer_spec.rb
│ │ ├── types_spec.rb
│ │ └── validators/
│ │ ├── all_or_none_validator_spec.rb
│ │ ├── allow_blank_validator_spec.rb
│ │ ├── at_least_one_of_validator_spec.rb
│ │ ├── base_i18n_spec.rb
│ │ ├── coerce_validator_spec.rb
│ │ ├── contract_scope_validator_spec.rb
│ │ ├── default_validator_spec.rb
│ │ ├── exactly_one_of_validator_spec.rb
│ │ ├── except_values_validator_spec.rb
│ │ ├── length_validator_spec.rb
│ │ ├── mutually_exclusive_spec.rb
│ │ ├── presence_validator_spec.rb
│ │ ├── regexp_validator_spec.rb
│ │ ├── same_as_validator_spec.rb
│ │ └── values_validator_spec.rb
│ └── validations_spec.rb
├── integration/
│ ├── dry_validation/
│ │ └── dry_validation_spec.rb
│ ├── grape_entity/
│ │ └── entity_spec.rb
│ ├── hashie/
│ │ └── hashie_spec.rb
│ ├── multi_json/
│ │ └── json_spec.rb
│ ├── multi_xml/
│ │ └── xml_spec.rb
│ └── rails/
│ ├── mounting_spec.rb
│ └── railtie_spec.rb
├── shared/
│ └── versioning_examples.rb
├── spec_helper.rb
└── support/
├── basic_auth_encode_helpers.rb
├── chunked_response.rb
├── content_type_helpers.rb
├── cookie_jar.rb
├── deprecated_warning_handlers.rb
├── deregister.rb
├── endpoint_faker.rb
├── file_streamer.rb
├── integer_helpers.rb
└── versioned_helpers.rb
================================================
FILE CONTENTS
================================================
================================================
FILE: .coveralls.yml
================================================
service_name: github
================================================
FILE: .dockerignore
================================================
## MAC OS
.DS_Store
.com.apple.timemachine.supported
## TEXTMATE
*.tmproj
tmtags
## EMACS
*~
\#*
.\#*
## REDCAR
.redcar
## VIM
*.swp
*.swo
## RUBYMINE
.idea
## PROJECT::GENERAL
coverage
doc
pkg
.rvmrc
.ruby-version
.ruby-gemset
.rspec_status
.bundle
.byebug_history
dist
Gemfile.lock
gemfiles/*.lock
tmp
.yardoc
## Rubinius
.rbx
## Bundler binstubs
bin
## ripper-tags and gem-ctags
tags
## PROJECT::SPECIFIC
.project
================================================
FILE: .github/FUNDING.yml
================================================
tidelift: "rubygems/grape"
github: [dblock, ericproulx]
================================================
FILE: .github/workflows/danger-comment.yml
================================================
name: Danger Comment
on:
workflow_run:
workflows: [Danger]
types: [completed]
jobs:
comment:
uses: numbata/danger-pr-comment/.github/workflows/danger-comment.yml@v0.1.0
secrets: inherit
================================================
FILE: .github/workflows/danger.yml
================================================
name: Danger
on:
pull_request:
types: [opened, reopened, edited, synchronize]
jobs:
danger:
uses: numbata/danger-pr-comment/.github/workflows/danger-run.yml@v0.1.0
secrets: inherit
with:
ruby-version: '3.4'
bundler-cache: true
================================================
FILE: .github/workflows/edge.yml
================================================
---
name: edge
on: workflow_dispatch
jobs:
test:
strategy:
fail-fast: false
matrix:
ruby: ['3.2', '3.3', '3.4', '4.0', ruby-head, truffleruby-head, jruby-head]
gemfile: [rails_edge, rack_edge]
runs-on: ubuntu-latest
continue-on-error: true
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run tests
run: "RUBYOPT='--enable=frozen-string-literal' bundle exec rspec"
- name: Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: run-${{ matrix.ruby }}-${{ matrix.gemfile }}
parallel: true
finish:
needs: test
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true
================================================
FILE: .github/workflows/test.yml
================================================
name: test
on: [push, pull_request]
jobs:
lint:
name: RuboCop
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.4
bundler-cache: true
rubygems: latest
- name: Run RuboCop
run: bundle exec rubocop
test:
strategy:
fail-fast: false
matrix:
ruby: ['3.2', '3.3', '3.4', '4.0']
gemfile:
- Gemfile
- gemfiles/rack_2_2.gemfile
- gemfiles/rack_3_0.gemfile
- gemfiles/rack_3_1.gemfile
- gemfiles/rack_3_2.gemfile
- gemfiles/rails_7_2.gemfile
- gemfiles/rails_8_0.gemfile
- gemfiles/rails_8_1.gemfile
specs: ['spec --exclude-pattern=spec/integration/{grape_entity,hashie,dry_validation,multi_*}/*_spec.rb']
include:
- ruby: '4.0'
gemfile: gemfiles/grape_entity.gemfile
specs: 'spec/integration/grape_entity'
- ruby: '4.0'
gemfile: gemfiles/hashie.gemfile
specs: 'spec/integration/hashie'
- ruby: '4.0'
gemfile: gemfiles/dry_validation.gemfile
specs: 'spec/integration/dry_validation'
- ruby: '4.0'
gemfile: gemfiles/multi_json.gemfile
specs: 'spec/integration/multi_json'
- ruby: '4.0'
gemfile: gemfiles/multi_xml.gemfile
specs: 'spec/integration/multi_xml'
runs-on: ubuntu-latest
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/${{ matrix.gemfile }}
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run Tests (${{ matrix.specs }})
run: "RUBYOPT='--enable=frozen-string-literal' bundle exec rspec ${{ matrix.specs }}"
- name: Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: run-${{ matrix.ruby }}-${{ matrix.gemfile }}
parallel: true
finish:
needs: test
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true
================================================
FILE: .gitignore
================================================
## MAC OS
.DS_Store
.com.apple.timemachine.supported
## TEXTMATE
*.tmproj
tmtags
## EMACS
*~
\#*
.\#*
## REDCAR
.redcar
## VIM
*.swp
*.swo
## RUBYMINE
.idea
## PROJECT::GENERAL
coverage
doc
pkg
.rvmrc
.ruby-version
.ruby-gemset
.rspec_status
.bundle
.byebug_history
dist
Gemfile.lock
gemfiles/*.lock
tmp
.yardoc
## Rubinius
.rbx
## Bundler binstubs
bin
## ripper-tags and gem-ctags
tags
## PROJECT::SPECIFIC
.project
================================================
FILE: .rspec
================================================
--require spec_helper
--color
--format=documentation
--order=rand
--warnings
================================================
FILE: .rubocop.yml
================================================
AllCops:
NewCops: enable
TargetRubyVersion: 3.2
SuggestExtensions: false
Exclude:
- vendor/**/*
- bin/**/*
plugins:
- rubocop-performance
- rubocop-rspec
inherit_from: .rubocop_todo.yml
Layout/LineLength:
Max: 215
Lint/EmptyBlock:
Exclude:
- spec/**/*_spec.rb
Style/Documentation:
Enabled: false
Style/MultilineIfModifier:
Enabled: false
Style/RaiseArgs:
Enabled: false
Style/RedundantArrayConstructor:
Enabled: false # doesn't work well with params definition
Style/Send:
Enabled: true
Metrics/AbcSize:
Max: 80 # TODO: revert to 50 once the refactor of public api is done.
Metrics/BlockLength:
Max: 30
Exclude:
- spec/**/*_spec.rb
Metrics/ClassLength:
Max: 305
Metrics/CyclomaticComplexity:
Max: 15
Metrics/ParameterLists:
CountKeywordArgs: false
MaxOptionalParameters: 4
Metrics/MethodLength:
Max: 32
Metrics/ModuleLength:
Max: 220
Metrics/PerceivedComplexity:
Max: 15
RSpec/ExampleLength:
Max: 60
RSpec/NestedGroups:
Max: 6
RSpec/SpecFilePathFormat:
Enabled: false
RSpec/SpecFilePathSuffix:
Enabled: true
RSpec/MultipleExpectations:
Enabled: false
RSpec/NamedSubject:
Enabled: false
RSpec/MultipleMemoizedHelpers:
Max: 11
RSpec/ContextWording:
Enabled: false
RSpec/MessageSpies:
EnforcedStyle: receive
================================================
FILE: .rubocop_todo.yml
================================================
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2026-01-31 18:13:50 UTC using RuboCop version 1.84.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.
# Offense count: 1
# Configuration parameters: CountComments, Max, CountAsOne, AllowedMethods, AllowedPatterns.
Metrics/MethodLength:
Exclude:
- 'lib/grape/endpoint.rb'
# Offense count: 18
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
# SupportedStyles: snake_case, normalcase, non_integer
# AllowedIdentifiers: TLS1_1, TLS1_2, capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
Naming/VariableNumber:
Exclude:
- 'spec/grape/dsl/settings_spec.rb'
- 'spec/grape/exceptions/validation_errors_spec.rb'
- 'spec/grape/validations_spec.rb'
# Offense count: 2
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: SkipBlocks, EnforcedStyle, OnlyStaticConstants.
# SupportedStyles: described_class, explicit
RSpec/DescribedClass:
Exclude:
- 'spec/grape/middleware/exception_spec.rb'
# Offense count: 3
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: CustomTransform, IgnoredWords, DisallowedExamples.
# DisallowedExamples: works
RSpec/ExampleWording:
Exclude:
- 'spec/grape/integration/global_namespace_function_spec.rb'
- 'spec/grape/validations_spec.rb'
# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
RSpec/ExpectActual:
Exclude:
- '**/spec/routing/**/*'
- 'spec/grape/middleware/exception_spec.rb'
# Offense count: 1
RSpec/ExpectInHook:
Exclude:
- 'spec/grape/validations/validators/values_validator_spec.rb'
# Offense count: 6
# Configuration parameters: Max, AllowedIdentifiers, AllowedPatterns.
RSpec/IndexedLet:
Exclude:
- 'spec/grape/exceptions/validation_errors_spec.rb'
- 'spec/grape/presenters/presenter_spec.rb'
- 'spec/shared/versioning_examples.rb'
# Offense count: 40
# Configuration parameters: AssignmentOnly.
RSpec/InstanceVariable:
Exclude:
- 'spec/grape/api_spec.rb'
- 'spec/grape/endpoint_spec.rb'
- 'spec/grape/middleware/base_spec.rb'
- 'spec/grape/middleware/versioner/accept_version_header_spec.rb'
- 'spec/grape/middleware/versioner/header_spec.rb'
# Offense count: 1
RSpec/LeakyLocalVariable:
Exclude:
- 'spec/grape/api_spec.rb'
# Offense count: 1
RSpec/MessageChain:
Exclude:
- 'spec/grape/middleware/formatter_spec.rb'
# Offense count: 10
RSpec/MissingExampleGroupArgument:
Exclude:
- 'spec/grape/middleware/exception_spec.rb'
# Offense count: 12
RSpec/RepeatedDescription:
Exclude:
- 'spec/grape/api_spec.rb'
- 'spec/grape/endpoint_spec.rb'
- 'spec/grape/validations/validators/allow_blank_validator_spec.rb'
- 'spec/grape/validations/validators/values_validator_spec.rb'
# Offense count: 6
RSpec/RepeatedExample:
Exclude:
- 'spec/grape/middleware/versioner/accept_version_header_spec.rb'
- 'spec/grape/validations/validators/allow_blank_validator_spec.rb'
# Offense count: 8
RSpec/RepeatedExampleGroupDescription:
Exclude:
- 'spec/grape/api_spec.rb'
- 'spec/grape/endpoint_spec.rb'
- 'spec/grape/util/inheritable_setting_spec.rb'
# Offense count: 2
RSpec/StubbedMock:
Exclude:
- 'spec/grape/dsl/inside_route_spec.rb'
- 'spec/grape/middleware/formatter_spec.rb'
# Offense count: 32
RSpec/SubjectStub:
Exclude:
- 'spec/grape/api_spec.rb'
- 'spec/grape/dsl/inside_route_spec.rb'
- 'spec/grape/dsl/parameters_spec.rb'
- 'spec/grape/dsl/routing_spec.rb'
- 'spec/grape/middleware/base_spec.rb'
- 'spec/grape/middleware/formatter_spec.rb'
- 'spec/grape/middleware/globals_spec.rb'
- 'spec/grape/middleware/stack_spec.rb'
# Offense count: 20
# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
RSpec/VerifiedDoubles:
Exclude:
- 'spec/grape/api_spec.rb'
- 'spec/grape/dsl/inside_route_spec.rb'
- 'spec/grape/integration/rack_sendfile_spec.rb'
- 'spec/grape/middleware/formatter_spec.rb'
# Offense count: 2
RSpec/VoidExpect:
Exclude:
- 'spec/grape/api_spec.rb'
- 'spec/grape/dsl/headers_spec.rb'
# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/CombinableLoops:
Exclude:
- 'spec/grape/endpoint_spec.rb'
# Offense count: 10
# Configuration parameters: AllowedMethods.
# AllowedMethods: respond_to_missing?
Style/OptionalBooleanParameter:
Exclude:
- 'lib/grape/dsl/parameters.rb'
- 'lib/grape/endpoint.rb'
- 'lib/grape/serve_stream/sendfile_response.rb'
- 'lib/grape/validations/params_scope.rb'
- 'lib/grape/validations/types/array_coercer.rb'
- 'lib/grape/validations/types/custom_type_collection_coercer.rb'
- 'lib/grape/validations/types/dry_type_coercer.rb'
- 'lib/grape/validations/types/primitive_coercer.rb'
- 'lib/grape/validations/types/set_coercer.rb'
================================================
FILE: .simplecov
================================================
# frozen_string_literal: true
if ENV['GITHUB_USER'] # only when running CI
require 'simplecov-lcov'
SimpleCov::Formatter::LcovFormatter.config do |c|
c.report_with_single_file = true
c.single_report_path = 'coverage/lcov.info'
end
SimpleCov.formatter = SimpleCov::Formatter::LcovFormatter
end
SimpleCov.start do
enable_coverage :branch
add_filter '/spec/'
end
================================================
FILE: .yardopts
================================================
--asset grape.png
--markup markdown
================================================
FILE: CHANGELOG.md
================================================
### 3.2.0 (Next)
#### Features
* [#2662](https://github.com/ruby-grape/grape/pull/2662): Extract `Grape::Util::Translation` for shared I18n fallback logic - [@ericproulx](https://github.com/ericproulx).
* [#2656](https://github.com/ruby-grape/grape/pull/2656): Remove useless instance_variable_defined? checks - [@ericproulx](https://github.com/ericproulx).
* [#2619](https://github.com/ruby-grape/grape/pull/2619): Remove TOC from README.md and danger-toc check - [@alexanderadam](https://github.com/alexanderadam).
* [#2663](https://github.com/ruby-grape/grape/pull/2663): Refactor `ParamsScope` and `Parameters` DSL to use named kwargs - [@ericproulx](https://github.com/ericproulx).
* [#2664](https://github.com/ruby-grape/grape/pull/2664): Drop `test-prof` dependency - [@ericproulx](https://github.com/ericproulx).
* [#2665](https://github.com/ruby-grape/grape/pull/2665): Pass `attrs` directly to `AttributesIterator` instead of `validator` - [@ericproulx](https://github.com/ericproulx).
* Your contribution here.
#### Fixes
* [#2655](https://github.com/ruby-grape/grape/pull/2655): Fix `before_each` method to handle `nil` parameter correctly - [@ericproulx](https://github.com/ericproulx).
* [#2660](https://github.com/ruby-grape/grape/pull/2660): Fix thread safety: move mutable `ParamsScope` state (`index`, `params_meeting_dependency`) into a per-request `ParamScopeTracker` stored in `Fiber[]` - [@ericproulx](https://github.com/ericproulx).
* Your contribution here.
### 3.1.0 (2026-01-25)
#### Features
* [#2629](https://github.com/ruby-grape/grape/pull/2629): Refactor Router Architecture - [@ericproulx](https://github.com/ericproulx).
* [#2633](https://github.com/ruby-grape/grape/pull/2633): Refactor API::Instance and reorganize DSL modules - [@ericproulx](https://github.com/ericproulx).
* [#2636](https://github.com/ruby-grape/grape/pull/2636): Refactor router to simplify method signatures and reduce duplication - [@ericproulx](https://github.com/ericproulx).
* [#2640](https://github.com/ruby-grape/grape/pull/2640): Compute available_media_types once - [@ericproulx](https://github.com/ericproulx).
* [#2637](https://github.com/ruby-grape/grape/pull/2637): Refactor declared method - [@ericproulx](https://github.com/ericproulx).
* [#2639](https://github.com/ruby-grape/grape/pull/2639): Refactor mime_types_for - [@ericproulx](https://github.com/ericproulx).
* [#2638](https://github.com/ruby-grape/grape/pull/2638): Remove unnecessary path string duplication - [@ericproulx](https://github.com/ericproulx).
* [#2643](https://github.com/ruby-grape/grape/pull/2638): Remove `try` method in codebase - [@ericproulx](https://github.com/ericproulx).
* [#2646](https://github.com/ruby-grape/grape/pull/2646): Call `valid_encoding?` before scrub - [@ericproulx](https://github.com/ericproulx).
* [#2644](https://github.com/ruby-grape/grape/pull/2644): Clean useless/not valuable dependencies - [@ericproulx](https://github.com/ericproulx).
* [#2649](https://github.com/ruby-grape/grape/pull/2644): Drop support Ruby 3.0 and ActiveSupport 7.0 - [@ericproulx](https://github.com/ericproulx).
* [#2648](https://github.com/ruby-grape/grape/pull/2648): Remove deprecated ParamsBuilders extensions - [@ericproulx](https://github.com/ericproulx).
* [#2645](https://github.com/ruby-grape/grape/pull/2645): Endpoints are compiled when API is compiled - [@ericproulx](https://github.com/ericproulx).
* [#2647](https://github.com/ruby-grape/grape/pull/2647): Explicit kwargs for `namespace` and `route_param` - [@ericproulx](https://github.com/ericproulx).
* [#2651](https://github.com/ruby-grape/grape/pull/2651): Migrate Danger to use danger-pr-comment workflow - [@dblock](https://github.com/dblock).
#### Fixes
* [#2633](https://github.com/ruby-grape/grape/pull/2633): Fix cascade reading - [@ericproulx](https://github.com/ericproulx).
* [#2641](https://github.com/ruby-grape/grape/pull/2641): Restore support for `return` in endpoint blocks - [@ericproulx](https://github.com/ericproulx).
* [#2642](https://github.com/ruby-grape/grape/pull/2642): Fix array allocation in base_route.rb - [@ericproulx](https://github.com/ericproulx).
* Fix `before_each` method to handle `nil` parameter correctly - [@ericproulx](https://github.com/ericproulx).
### 3.0.1 (2025-11-24)
#### Features
* [#2625](https://github.com/ruby-grape/grape/pull/2625): Update rubocop to 1.81.7 and fix style offenses - [@ericproulx](https://github.com/ericproulx).
* [#2626](https://github.com/ruby-grape/grape/pull/2626): Add rails 8.1 to CI test matrix - [@ericproulx](https://github.com/ericproulx).
#### Fixes
* [#2628](https://github.com/ruby-grape/grape/pull/2628): Fix helpers inheritance - [@giorni](https://github.com/giorni).
### 3.0.0 (2025-11-15)
#### Features
* [#2572](https://github.com/ruby-grape/grape/pull/2572): Drop support ruby 2.7 and active_support 6.1 - [@ericproulx](https://github.com/ericproulx).
* [#2573](https://github.com/ruby-grape/grape/pull/2573): Clean up deprecated code - [@ericproulx](https://github.com/ericproulx).
* [#2575](https://github.com/ruby-grape/grape/pull/2575): Refactor Api description class - [@ericproulx](https://github.com/ericproulx).
* [#2577](https://github.com/ruby-grape/grape/pull/2577): Deprecate `return` in endpoint execution - [@ericproulx](https://github.com/ericproulx).
* [#2580](https://github.com/ruby-grape/grape/pull/2580): Refactor endpoint helpers and error middleware integration - [@ericproulx](https://github.com/ericproulx).
* [#2581](https://github.com/ruby-grape/grape/pull/2581): Delegate `to_s` in Grape::API::Instance - [@ericproulx](https://github.com/ericproulx).
* [#2582](https://github.com/ruby-grape/grape/pull/2582): Fix leaky slash when normalizing - [@ericproulx](https://github.com/ericproulx).
* [#2583](https://github.com/ruby-grape/grape/pull/2583): Optimize api parameter documentation and memory usage - [@ericproulx](https://github.com/ericproulx).
* [#2589](https://github.com/ruby-grape/grape/pull/2589): Replace `send` by `__send__` in codebase - [@ericproulx](https://github.com/ericproulx).
* [#2598](https://github.com/ruby-grape/grape/pull/2598): Refactor settings DSL to use explicit methods instead of dynamic generation - [@ericproulx](https://github.com/ericproulx).
* [#2599](https://github.com/ruby-grape/grape/pull/2599): Simplify settings DSL get_or_set method and optimize logger implementation - [@ericproulx](https://github.com/ericproulx).
* [#2600](https://github.com/ruby-grape/grape/pull/2600): Refactor versioner middleware: simplify base class and improve consistency - [@ericproulx](https://github.com/ericproulx).
* [#2601](https://github.com/ruby-grape/grape/pull/2601): Refactor route_setting internal usage to use inheritable_setting.route for improved consistency and performance - [@ericproulx](https://github.com/ericproulx).
* [#2602](https://github.com/ruby-grape/grape/pull/2602): Remove `namespace_reverse_stackable` from public DSL interface and use direct inheritable_setting access - [@ericproulx](https://github.com/ericproulx).
* [#2603](https://github.com/ruby-grape/grape/pull/2603): Remove `namespace_stackable_with_hash` from public interface and move to internal InheritableSetting - [@ericproulx](https://github.com/ericproulx).
* [#2604](https://github.com/ruby-grape/grape/pull/2604): Enable branch coverage - [@ericproulx](https://github.com/ericproulx).
* [#2605](https://github.com/ruby-grape/grape/pull/2605): Add Rack 3.2 support with new gemfile and CI integration - [@ericproulx](https://github.com/ericproulx).
* [#2607](https://github.com/ruby-grape/grape/pull/2607): Remove namespace_stackable and namespace_inheritable from public API - [@ericproulx](https://github.com/ericproulx).
* [#2615](https://github.com/ruby-grape/grape/pull/2615): Remove manual toc and tod danger check - [@alexanderadam](https://github.com/alexanderadam).
* [#2612](https://github.com/ruby-grape/grape/pull/2612): Avoid multiple mount pollution - [@alexanderadam](https://github.com/alexanderadam).
* [#2617](https://github.com/ruby-grape/grape/pull/2617): Migrate from `ActiveSupport::Configurable` to `Dry::Configurable` - [@ericproulx](https://github.com/ericproulx).
* [#2618](https://github.com/ruby-grape/grape/pull/2618): Modernize argument delegation for Ruby 3+ compatibility - [@ericproulx](https://github.com/ericproulx).
* [#2623](https://github.com/ruby-grape/grape/pull/2623): Refactor coercer caching to use `Grape::Util::Cache` - [@ericproulx](https://github.com/ericproulx).
#### Fixes
* [#2586](https://github.com/ruby-grape/grape/pull/2586): Limit helpers DSL public scope - [@ericproulx](https://github.com/ericproulx).
* [#2588](https://github.com/ruby-grape/grape/pull/2588): Fix defaut format regression on */* - [@ericproulx](https://github.com/ericproulx).
* [#2593](https://github.com/ruby-grape/grape/pull/2593): Fix warning message when overriding global registry key - [@ericproulx](https://github.com/ericproulx).
* [#2594](https://github.com/ruby-grape/grape/pull/2594): Fix routes memoization - [@ericproulx](https://github.com/ericproulx).
* [#2595](https://github.com/ruby-grape/grape/pull/2595): Keep `within_namespace` as part of our internal api - [@ericproulx](https://github.com/ericproulx).
* [#2596](https://github.com/ruby-grape/grape/pull/2596): Remove `namespace_reverse_stackable_with_hash` from public scope - [@ericproulx](https://github.com/ericproulx).
* [#2621](https://github.com/ruby-grape/grape/pull/2621): Update upgrading notes regarding `return` usage and simplify endpoint execution - [@ericproulx](https://github.com/ericproulx).
* [#2622](https://github.com/ruby-grape/grape/pull/2622): Use `require_relative` instead of `$LOAD_PATH` in gemspec - [@ericproulx](https://github.com/ericproulx).
### 2.4.0 (2025-06-18)
#### Features
* [#2532](https://github.com/ruby-grape/grape/pull/2532): Update RuboCop 1.71.2 - [@ericproulx](https://github.com/ericproulx).
* [#2535](https://github.com/ruby-grape/grape/pull/2535): Delegate calls to inner objects - [@ericproulx](https://github.com/ericproulx).
* [#2537](https://github.com/ruby-grape/grape/pull/2537): Use activesupport `try` pattern - [@ericproulx](https://github.com/ericproulx).
* [#2536](https://github.com/ruby-grape/grape/pull/2536): Update normalize_path like Rails - [@ericproulx](https://github.com/ericproulx).
* [#2540](https://github.com/ruby-grape/grape/pull/2540): Introduce params builder with symbolized short name - [@ericproulx](https://github.com/ericproulx).
* [#2550](https://github.com/ruby-grape/grape/pull/2550): Drop ActiveSupport 6.0 - [@ericproulx](https://github.com/ericproulx).
* [#2549](https://github.com/ruby-grape/grape/pull/2549): Delegate cookies management to `Grape::Request` - [@ericproulx](https://github.com/ericproulx).
* [#2554](https://github.com/ruby-grape/grape/pull/2554): Remove `Grape::Http::Headers` and `Grape::Util::Lazy::Object` - [@ericproulx](https://github.com/ericproulx).
* [#2556](https://github.com/ruby-grape/grape/pull/2556): Remove unused `Grape::Request::DEFAULT_PARAMS_BUILDER` constant - [@eriklovmo](https://github.com/eriklovmo).
* [#2558](https://github.com/ruby-grape/grape/pull/2558): Add Ruby's option `enable_frozen_string_literal` in CI - [@ericproulx](https://github.com/ericproulx).
* [#2557](https://github.com/ruby-grape/grape/pull/2557): Add `lint!` - [@ericproulx](https://github.com/ericproulx).
* [#2561](https://github.com/ruby-grape/grape/pull/2561): Optimize hash alloc for middleware's default options - [@ericproulx](https://github.com/ericproulx).
* [#2563](https://github.com/ruby-grape/grape/pull/2563): Update `Grape::Middleware::Auth::Base` - [@ericproulx](https://github.com/ericproulx).
* [#2571](https://github.com/ruby-grape/grape/pull/2571): Update RuboCop 1.75.8 - [@pieterocp](https://github.com/pieterocp).
#### Fixes
* [#2538](https://github.com/ruby-grape/grape/pull/2538): Fix validating nested json array params - [@mohammednasser-32](https://github.com/mohammednasser-32).
* [#2543](https://github.com/ruby-grape/grape/pull/2543): Fix array allocation on mount - [@ericproulx](https://github.com/ericproulx).
* [#2546](https://github.com/ruby-grape/grape/pull/2546): Fix middleware with keywords - [@ericproulx](https://github.com/ericproulx).
* [#2547](https://github.com/ruby-grape/grape/pull/2547): Remove jsonapi related code - [@ericproulx](https://github.com/ericproulx).
* [#2548](https://github.com/ruby-grape/grape/pull/2548): Formatting from header acts like versioning from header - [@ericproulx](https://github.com/ericproulx).
* [#2552](https://github.com/ruby-grape/grape/pull/2552): Fix declared params optional array - [@ericproulx](https://github.com/ericproulx).
* [#2553](https://github.com/ruby-grape/grape/pull/2553): Improve performance of query params parsing - [@ericproulx](https://github.com/ericproulx).
### 2.3.0 (2025-02-08)
#### Features
* [#2497](https://github.com/ruby-grape/grape/pull/2497): Update RuboCop to 1.66.1 - [@ericproulx](https://github.com/ericproulx).
* [#2500](https://github.com/ruby-grape/grape/pull/2500): Remove deprecated `file` method - [@ericproulx](https://github.com/ericproulx).
* [#2501](https://github.com/ruby-grape/grape/pull/2501): Remove deprecated `except` and `proc` options in values validator - [@ericproulx](https://github.com/ericproulx).
* [#2502](https://github.com/ruby-grape/grape/pull/2502): Remove deprecation `options` in `desc` - [@ericproulx](https://github.com/ericproulx).
* [#2512](https://github.com/ruby-grape/grape/pull/2512): Optimize hash alloc - [@ericproulx](https://github.com/ericproulx).
* [#2513](https://github.com/ruby-grape/grape/pull/2513): Optimize Grape::Path - [@ericproulx](https://github.com/ericproulx).
* [#2514](https://github.com/ruby-grape/grape/pull/2514): Add rails 8.0 to CI - [@ericproulx](https://github.com/ericproulx).
* [#2516](https://github.com/ruby-grape/grape/pull/2516): Dynamic registration for parsers, formatters, versioners - [@ericproulx](https://github.com/ericproulx).
* [#2518](https://github.com/ruby-grape/grape/pull/2518): Add ruby 3.4 to CI - [@ericproulx](https://github.com/ericproulx).
#### Fixes
* [#2504](https://github.com/ruby-grape/grape/pull/2504): Fix leaky modules in specs - [@ericproulx](https://github.com/ericproulx).
* [#2506](https://github.com/ruby-grape/grape/pull/2506): Fix fetch_formatter api_format - [@ericproulx](https://github.com/ericproulx).
* [#2507](https://github.com/ruby-grape/grape/pull/2507): Fix type: Set with values - [@nikolai-b](https://github.com/nikolai-b).
* [#2510](https://github.com/ruby-grape/grape/pull/2510): Fix ContractScope's validator inheritance - [@ericproulx](https://github.com/ericproulx).
* [#2521](https://github.com/ruby-grape/grape/pull/2521): Fixed typo in README - [@datpmt](https://github.com/datpmt).
* [#2525](https://github.com/ruby-grape/grape/pull/2525): Require logger before active_support - [@ericproulx](https://github.com/ericproulx).
* [#2524](https://github.com/ruby-grape/grape/pull/2524): Fix validators bad encoding - [@ericproulx](https://github.com/ericproulx).
* [#2530](https://github.com/ruby-grape/grape/pull/2530): Fix endpoint's status when rescue_from without a block - [@ericproulx](https://github.com/ericproulx).
* [#2529](https://github.com/ruby-grape/grape/pull/2529): Fix missing settings on mounted routes (when settings are identical) - [@Haerezis](https://github.com/Haerezis).
### 2.2.0 (2024-09-14)
#### Features
* [#2475](https://github.com/ruby-grape/grape/pull/2475): Remove Grape::Util::Registrable - [@ericproulx](https://github.com/ericproulx).
* [#2484](https://github.com/ruby-grape/grape/pull/2484): Refactor versioner middlewares - [@ericproulx](https://github.com/ericproulx).
* [#2489](https://github.com/ruby-grape/grape/pull/2489): Add Rails 7.2 in CI workflow - [@ericproulx](https://github.com/ericproulx).
* [#2493](https://github.com/ruby-grape/grape/pull/2493): MFA required when releasing - [@ericproulx](https://github.com/ericproulx).
#### Fixes
* [#2471](https://github.com/ruby-grape/grape/pull/2471): Fix absence of original_exception and/or backtrace even if passed in error! - [@numbata](https://github.com/numbata).
* [#2478](https://github.com/ruby-grape/grape/pull/2478): Fix rescue_from with invalid response - [@ericproulx](https://github.com/ericproulx).
* [#2480](https://github.com/ruby-grape/grape/pull/2480): Fix rescue_from ValidationErrors exception - [@numbata](https://github.com/numbata).
* [#2464](https://github.com/ruby-grape/grape/pull/2464): The `length` validator only takes effect for parameters with types that support `#length` method - [@OuYangJinTing](https://github.com/OuYangJinTing).
* [#2485](https://github.com/ruby-grape/grape/pull/2485): Add `is:` param to length validator - [@dakad](https://github.com/dakad).
* [#2492](https://github.com/ruby-grape/grape/pull/2492): Fix `Grape::Endpoint#inspect` method - [@ericproulx](https://github.com/ericproulx).
* [#2496](https://github.com/ruby-grape/grape/pull/2496): Reduce object allocation when compiling - [@ericproulx](https://github.com/ericproulx).
### 2.1.3 (2024-07-13)
#### Fixes
* [#2467](https://github.com/ruby-grape/grape/pull/2467): Fix repo coverage - [@ericproulx](https://github.com/ericproulx).
* [#2468](https://github.com/ruby-grape/grape/pull/2468): Align `error!` method signatures across different places - [@numbata](https://github.com/numbata).
* [#2469](https://github.com/ruby-grape/grape/pull/2469): Fix full path building for lateral scopes - [@numbata](https://github.com/numbata).
### 2.1.2 (2024-06-28)
#### Fixes
* [#2459](https://github.com/ruby-grape/grape/pull/2459): Autocorrect cops - [@ericproulx](https://github.com/ericproulx).
* [#3458](https://github.com/ruby-grape/grape/pull/2458): Remove unused Grape::Util::Accept::Header - [@ericproulx](https://github.com/ericproulx).
* [#2463](https://github.com/ruby-grape/grape/pull/2463): Fix error message indices - [@ericproulx](https://github.com/ericproulx).
### 2.1.1 (2024-06-22)
#### Features
* [#2450](https://github.com/ruby-grape/grape/pull/2450): Update RuboCop to 1.64.1 - [@ericproulx](https://github.com/ericproulx).
#### Fixes
* [#2453](https://github.com/ruby-grape/grape/pull/2453): Fix context in rescue_from - [@ericproulx](https://github.com/ericproulx).
* [#2455](https://github.com/ruby-grape/grape/pull/2455): Fix default response headers to work with Rack 3 - [@ericproulx](https://github.com/ericproulx).
### 2.1.0 (2024/06/15)
#### Features
* [#2432](https://github.com/ruby-grape/grape/pull/2432): Deep merge for group parameter attributes - [@numbata](https://github.com/numbata).
* [#2419](https://github.com/ruby-grape/grape/pull/2419): Add the `contract` DSL - [@dgutov](https://github.com/dgutov).
* [#2371](https://github.com/ruby-grape/grape/pull/2371): Use a param value as the `default` value of other param - [@jcagarcia](https://github.com/jcagarcia).
* [#2377](https://github.com/ruby-grape/grape/pull/2377): Allow to use instance variables values inside `rescue_from` - [@jcagarcia](https://github.com/jcagarcia).
* [#2379](https://github.com/ruby-grape/grape/pull/2379): Take into account the `route_param` type in `recognize_path` - [@jcagarcia](https://github.com/jcagarcia).
* [#2383](https://github.com/ruby-grape/grape/pull/2383): Use regex block instead of if - [@ericproulx](https://github.com/ericproulx).
* [#2384](https://github.com/ruby-grape/grape/pull/2384): Allow to use `before/after/rescue_from` methods in any order when using `mount` - [@jcagarcia](https://github.com/jcagarcia).
* [#2390](https://github.com/ruby-grape/grape/pull/2390): Drop support for Ruby 2.6 and Rails 5 - [@ericproulx](https://github.com/ericproulx).
* [#2393](https://github.com/ruby-grape/grape/pull/2393): Optimize AttributeTranslator - [@ericproulx](https://github.com/ericproulx).
* [#2395](https://github.com/ruby-grape/grape/pull/2395): Set `max-age` to 0 when `cookies.delete` - [@ericproulx](https://github.com/ericproulx).
* [#2397](https://github.com/ruby-grape/grape/pull/2397): Add support for ruby 3.3 - [@ericproulx](https://github.com/ericproulx).
* [#2399](https://github.com/ruby-grape/grape/pull/2399): Update `rubocop` to 1.59.0, `rubocop-performance` to 1.20.1 and `rubocop-rspec` to 2.25.0 - [@ericproulx](https://github.com/ericproulx).
* [#2402](https://github.com/ruby-grape/grape/pull/2402): Grape::Deprecations will be raised when running specs - [@ericproulx](https://github.com/ericproulx).
* [#2406](https://github.com/ruby-grape/grape/pull/2406): Remove mime-types dependency in specs - [@ericproulx](https://github.com/ericproulx).
* [#2408](https://github.com/ruby-grape/grape/pull/2408): Fix params method redefined warnings - [@ericproulx](https://github.com/ericproulx).
* [#2410](https://github.com/ruby-grape/grape/pull/2410): Gem deprecations will raise a DeprecationWarning in specs - [@ericproulx](https://github.com/ericproulx).
* [#2389](https://github.com/ruby-grape/grape/pull/2389): Remove rack-accept dependency - [@ericproulx](https://github.com/ericproulx).
* [#2426](https://github.com/ruby-grape/grape/pull/2426): Drop support for rack 1.x series - [@ericproulx](https://github.com/ericproulx).
* [#2427](https://github.com/ruby-grape/grape/pull/2427): Use `rack-contrib` jsonp instead of rack-jsonp - [@ericproulx](https://github.com/ericproulx).
* [#2363](https://github.com/ruby-grape/grape/pull/2363): Replace autoload by zeitwerk - [@ericproulx](https://github.com/ericproulx).
* [#2425](https://github.com/ruby-grape/grape/pull/2425): Replace `{}` with `Rack::Header` or `Rack::Utils::HeaderHash` - [@dhruvCW](https://github.com/dhruvCW).
* [#2430](https://github.com/ruby-grape/grape/pull/2430): Isolate extensions within specific gemfile - [@ericproulx](https://github.com/ericproulx).
* [#2431](https://github.com/ruby-grape/grape/pull/2431): Drop appraisals in favor of eval_gemfile - [@ericproulx](https://github.com/ericproulx).
* [#2435](https://github.com/ruby-grape/grape/pull/2435): Use rack constants - [@ericproulx](https://github.com/ericproulx).
* [#2436](https://github.com/ruby-grape/grape/pull/2436): Update coverallsapp github-action - [@ericproulx](https://github.com/ericproulx).
* [#2434](https://github.com/ruby-grape/grape/pull/2434): Implement nested `with` support in parameter dsl - [@numbata](https://github.com/numbata).
* [#2438](https://github.com/ruby-grape/grape/pull/2438): Fix some Rack::Lint - [@ericproulx](https://github.com/ericproulx).
* [#2437](https://github.com/ruby-grape/grape/pull/2437): Add length validator - [@dhruvCW](https://github.com/dhruvCW).
* [#2445](https://github.com/ruby-grape/grape/pull/2445): Remove builder as a dependency - [@ericproulx](https://github.com/ericproulx).
#### Fixes
* [#2375](https://github.com/ruby-grape/grape/pull/2375): Fix setter methods for `Grape::Router::AttributeTranslator` - [@Jell](https://github.com/Jell).
* [#2370](https://github.com/ruby-grape/grape/pull/2370): Remove route_xyz method_missing deprecation - [@ericproulx](https://github.com/ericproulx).
* [#2372](https://github.com/ruby-grape/grape/pull/2372): Fix `declared` method for hash params with overlapping names - [@jcagarcia](https://github.com/jcagarcia).
* [#2373](https://github.com/ruby-grape/grape/pull/2373): Fix markdown files for following 1-line format - [@jcagarcia](https://github.com/jcagarcia).
* [#2382](https://github.com/ruby-grape/grape/pull/2382): Fix values validator for params wrapped in `with` block - [@numbata](https://github.com/numbata).
* [#2387](https://github.com/ruby-grape/grape/pull/2387): Fix rubygems version within workflows - [@ericproulx](https://github.com/ericproulx).
* [#2405](https://github.com/ruby-grape/grape/pull/2405): Fix edge workflow - [@ericproulx](https://github.com/ericproulx).
* [#2414](https://github.com/ruby-grape/grape/pull/2414): Fix Rack::Lint missing content-type - [@ericproulx](https://github.com/ericproulx).
* [#2378](https://github.com/ruby-grape/grape/pull/2378): Do not overwrite `route_param` with a regular one if they share same name - [@arg](https://github.com/arg).
* [#2444](https://github.com/ruby-grape/grape/pull/2444): Replace method_missing in endpoint - [@ericproulx](https://github.com/ericproulx).
* [#2441](https://github.com/ruby-grape/grape/pull/2441): Optimize memory alloc and retained - [@ericproulx](https://github.com/ericproulx).
* [#2449](https://github.com/ruby-grape/grape/pull/2449): Rack 3.1 fixes - [@ericproulx](https://github.com/ericproulx).
### 2.0.0 (2023/11/11)
#### Features
* [#2353](https://github.com/ruby-grape/grape/pull/2353): Added Rails 7.1 support - [@ericproulx](https://github.com/ericproulx).
* [#2355](https://github.com/ruby-grape/grape/pull/2355): Set response headers based on Rack version - [@schinery](https://github.com/schinery).
* [#2360](https://github.com/ruby-grape/grape/pull/2360): Reduce gem size by removing specs - [@ericproulx](https://github.com/ericproulx).
* [#2361](https://github.com/ruby-grape/grape/pull/2361): Remove `Rack::Auth::Digest` - [@ninoseki](https://github.com/ninoseki).
#### Fixes
* [#2364](https://github.com/ruby-grape/grape/pull/2364): Add missing requires - [@ericproulx](https://github.com/ericproulx).
* [#2366](https://github.com/ruby-grape/grape/pull/2366): Default quality to 1.0 in the `Accept` header when omitted - [@hiddewie](https://github.com/hiddewie).
* [#2368](https://github.com/ruby-grape/grape/pull/2368): Stripping the internals of `Grape::Endpoint` when `NoMethodError` is raised - [@jcagarcia](https://github.com/jcagarcia).
### 1.8.0 (2023/08/30)
#### Features
* [#2326](https://github.com/ruby-grape/grape/pull/2326): Use ActiveSupport extensions - [@ericproulx](https://github.com/ericproulx).
* [#2327](https://github.com/ruby-grape/grape/pull/2327): Use ActiveSupport deprecation - [@ericproulx](https://github.com/ericproulx).
* [#2330](https://github.com/ruby-grape/grape/pull/2330): Use ActiveSupport inflector - [@ericproulx](https://github.com/ericproulx).
* [#2331](https://github.com/ruby-grape/grape/pull/2331): Memory optimization when running validators - [@ericproulx](https://github.com/ericproulx).
* [#2332](https://github.com/ruby-grape/grape/pull/2332): Use ActiveSupport configurable - [@ericproulx](https://github.com/ericproulx).
* [#2333](https://github.com/ruby-grape/grape/pull/2333): Use custom messages in parameter validation with arity 1 - [@thedevjoao](https://github.com/TheDevJoao).
* [#2341](https://github.com/ruby-grape/grape/pull/2341): Stop yielding skip value - [@ericproulx](https://github.com/ericproulx).
* [#2342](https://github.com/ruby-grape/grape/pull/2342): Allow specifying a handler for grape_exceptions - [@mscrivo](https://github.com/mscrivo).
* [#2338](https://github.com/ruby-grape/grape/pull/2338): Fix unknown validator when using requires/optional with entity - [@mscrivo](https://github.com/mscrivo).
#### Fixes
* [#2339](https://github.com/ruby-grape/grape/pull/2339): Documentation and specs for remountable configuration in params - [@myxoh](https://github.com/myxoh).
* [#2328](https://github.com/ruby-grape/grape/pull/2328): Don't cache Class.instance_methods - [@byroot](https://github.com/byroot).
* [#2337](https://github.com/ruby-grape/grape/pull/2337): Fix: allow custom validators that do not end with _validator - [@ericproulx](https://github.com/ericproulx).
* [#2346](https://github.com/ruby-grape/grape/pull/2346): Adjust test expectations to conform to rack 3 - [@kbarrette](https://github.com/kbarrette).
## 1.7.1 (2023/05/14)
#### Features
* [#2288](https://github.com/ruby-grape/grape/pull/2288): Dropped support for Ruby 2.5 - [@ericproulx](https://github.com/ericproulx).
* [#2288](https://github.com/ruby-grape/grape/pull/2288): Updated rubocop to 1.41.0 - [@ericproulx](https://github.com/ericproulx).
* [#2296](https://github.com/ruby-grape/grape/pull/2296): Fix cops and enables some - [@ericproulx](https://github.com/ericproulx).
* [#2302](https://github.com/ruby-grape/grape/pull/2302): Rack < 3 and update rack-test - [@ericproulx](https://github.com/ericproulx).
* [#2303](https://github.com/ruby-grape/grape/pull/2302): Rack >= 1.3.0 - [@ericproulx](https://github.com/ericproulx).
* [#2301](https://github.com/ruby-grape/grape/pull/2301): Revisit GH workflows - [@ericproulx](https://github.com/ericproulx).
* [#2311](https://github.com/ruby-grape/grape/pull/2311): Fix tests by pinning rack-test to < 2.1 - [@duffn](https://github.com/duffn).
* [#2310](https://github.com/ruby-grape/grape/pull/2310): Fix YARD docs markdown rendering - [@duffn](https://github.com/duffn).
* [#2317](https://github.com/ruby-grape/grape/pull/2317): Remove maruku and rubocop-ast as direct development/testing dependencies - [@ericproulx](https://github.com/ericproulx).
* [#2292](https://github.com/ruby-grape/grape/pull/2292): Introduce Docker to local development - [@ericproulx](https://github.com/ericproulx).
* [#2325](https://github.com/ruby-grape/grape/pull/2325): Change edge test workflows only run on demand - [@dblock](https://github.com/dblock).
* [#2324](https://github.com/ruby-grape/grape/pull/2324): Expose default in the description dsl - [@dhruvCW](https://github.com/dhruvCW).
#### Fixes
* [#2299](https://github.com/ruby-grape/grape/pull/2299): Fix, do not use kwargs for empty args - [@dm1try](https://github.com/dm1try).
* [#2307](https://github.com/ruby-grape/grape/pull/2307): Fixed autoloading of InvalidValue - [@fixlr](https://github.com/fixlr).
* [#2315](https://github.com/ruby-grape/grape/pull/2315): Update rspec - [@ericproulx](https://github.com/ericproulx).
* [#2319](https://github.com/ruby-grape/grape/pull/2319): Update rubocop - [@ericproulx](https://github.com/ericproulx).
* [#2323](https://github.com/ruby-grape/grape/pull/2323): Fix using endless ranges for values parameter - [@dhruvCW](https://github.com/dhruvCW).
### 1.7.0 (2022/12/20)
#### Features
* [#2233](https://github.com/ruby-grape/grape/pull/2233): Added `do_not_document!` for disabling documentation to internal APIs - [@dnesteryuk](https://github.com/dnesteryuk).
* [#2235](https://github.com/ruby-grape/grape/pull/2235): Add support for Ruby 3.1 - [@petergoldstein](https://github.com/petergoldstein).
* [#2248](https://github.com/ruby-grape/grape/pull/2248): Upgraded to rspec 3.11.0 - [@dblock](https://github.com/dblock).
* [#2249](https://github.com/ruby-grape/grape/pull/2249): Split CI matrix, extract edge - [@dblock](https://github.com/dblock).
* [#2249](https://github.com/ruby-grape/grape/pull/2251): Upgraded to RuboCop 1.25.1 - [@dblock](https://github.com/dblock).
* [#2271](https://github.com/ruby-grape/grape/pull/2271): Fixed validation regression on Numeric type introduced in 1.3 - [@vasfed](https://github.com/Vasfed).
* [#2267](https://github.com/ruby-grape/grape/pull/2267): Standardized English error messages - [@dblock](https://github.com/dblock).
* [#2272](https://github.com/ruby-grape/grape/pull/2272): Added error on param init when provided type does not have `[]` coercion method, previously validation silently failed for any value - [@vasfed](https://github.com/Vasfed).
* [#2274](https://github.com/ruby-grape/grape/pull/2274): Error middleware support using rack util's symbols as status - [@dhruvCW](https://github.com/dhruvCW).
* [#2276](https://github.com/ruby-grape/grape/pull/2276): Fix exception super - [@ericproulx](https://github.com/ericproulx).
* [#2285](https://github.com/ruby-grape/grape/pull/2285), [#2287](https://github.com/ruby-grape/grape/pull/2287): Added :evaluate_given to declared(params) - [@zysend](https://github.com/zysend).
#### Fixes
* [#2263](https://github.com/ruby-grape/grape/pull/2263): Explicitly require `bigdecimal` and `date` - [@dblock](https://github.com/dblock).
* [#2222](https://github.com/ruby-grape/grape/pull/2222): Autoload types and validators - [@ericproulx](https://github.com/ericproulx).
* [#2232](https://github.com/ruby-grape/grape/pull/2232): Fix kwargs support in shared params definition - [@dm1try](https://github.com/dm1try).
* [#2229](https://github.com/ruby-grape/grape/pull/2229): Do not collect params in route settings - [@dnesteryuk](https://github.com/dnesteryuk).
* [#2234](https://github.com/ruby-grape/grape/pull/2234): Remove non-UTF8 characters from format before generating JSON error - [@bschmeck](https://github.com/bschmeck).
* [#2227](https://github.com/ruby-grape/grape/pull/2222): Rename `MissingGroupType` and `UnsupportedGroupType` exceptions - [@ericproulx](https://github.com/ericproulx).
* [#2244](https://github.com/ruby-grape/grape/pull/2244): Fix a breaking change in `Grape::Validations` provided in 1.6.1 - [@dm1try](https://github.com/dm1try).
* [#2250](https://github.com/ruby-grape/grape/pull/2250): Add deprecation warning for `UnsupportedGroupTypeError` and `MissingGroupTypeError` - [@ericproulx](https://github.com/ericproulx).
* [#2256](https://github.com/ruby-grape/grape/pull/2256): Raise `Grape::Exceptions::MultipartPartLimitError` from Rack when too many files are uploaded - [@bschmeck](https://github.com/bschmeck).
* [#2266](https://github.com/ruby-grape/grape/pull/2266): Fix code coverage - [@duffn](https://github.com/duffn).
* [#2284](https://github.com/ruby-grape/grape/pull/2284): Fix an unexpected backtick - [@zysend](https://github.com/zysend).
### 1.6.2 (2021/12/30)
#### Fixes
* [#2219](https://github.com/ruby-grape/grape/pull/2219): Revert the changes for autoloading provided in 1.6.1 - [@dm1try](https://github.com/dm1try).
### 1.6.1 (2021/12/28)
#### Features
* [#2196](https://github.com/ruby-grape/grape/pull/2196): Add support for `passwords_hashed` param for `digest_auth` - [@lHydra](https://github.com/lhydra).
* [#2208](https://github.com/ruby-grape/grape/pull/2208): Added Rails 7 support - [@ericproulx](https://github.com/ericproulx).
#### Fixes
* [#2206](https://github.com/ruby-grape/grape/pull/2206): Require main active_support lib before any of its extension definitions - [@annih](https://github.com/Annih).
* [#2193](https://github.com/ruby-grape/grape/pull/2193): Fixed the broken ruby-head NoMethodError spec - [@Jack12816](https://github.com/Jack12816).
* [#2192](https://github.com/ruby-grape/grape/pull/2192): Memoize the result of Grape::Middleware::Base#response - [@Jack12816](https://github.com/Jack12816).
* [#2200](https://github.com/ruby-grape/grape/pull/2200): Add validators module to all validators - [@ericproulx](https://github.com/ericproulx).
* [#2202](https://github.com/ruby-grape/grape/pull/2202): Fix random mock spec error - [@ericproulx](https://github.com/ericproulx).
* [#2203](https://github.com/ruby-grape/grape/pull/2203): Add rubocop-rspec - [@ericproulx](https://github.com/ericproulx).
* [#2207](https://github.com/ruby-grape/grape/pull/2207): Autoload Validations/Validators - [@ericproulx](https://github.com/ericproulx).
* [#2209](https://github.com/ruby-grape/grape/pull/2209): Autoload Validations/Types - [@ericproulx](https://github.com/ericproulx).
### 1.6.0 (2021/10/04)
#### Features
* [#2190](https://github.com/ruby-grape/grape/pull/2190): Upgrade dev deps & drop Ruby 2.4.x support - [@dnesteryuk](https://github.com/dnesteryuk).
#### Fixes
* [#2176](https://github.com/ruby-grape/grape/pull/2176): Fix: OPTIONS fails if matching all routes - [@myxoh](https://github.com/myxoh).
* [#2177](https://github.com/ruby-grape/grape/pull/2177): Fix: `default` validator fails if preceded by `as` validator - [@Catsuko](https://github.com/Catsuko).
* [#2180](https://github.com/ruby-grape/grape/pull/2180): Call `super` in `API.inherited` - [@yogeshjain999](https://github.com/yogeshjain999).
* [#2189](https://github.com/ruby-grape/grape/pull/2189): Fix: rename parameters when using `:as` (behaviour and grape-swagger documentation) - [@Jack12816](https://github.com/Jack12816).
### 1.5.3 (2021/03/07)
#### Fixes
* [#2161](https://github.com/ruby-grape/grape/pull/2157): Handle EOFError from Rack when given an empty multipart body - [@bschmeck](https://github.com/bschmeck).
* [#2162](https://github.com/ruby-grape/grape/pull/2162): Corrected a hash modification while iterating issue - [@Jack12816](https://github.com/Jack12816).
* [#2164](https://github.com/ruby-grape/grape/pull/2164): Fix: `coerce_with` is now called for params with `nil` value - [@braktar](https://github.com/braktar).
### 1.5.2 (2021/02/06)
#### Features
* [#2157](https://github.com/ruby-grape/grape/pull/2157): Custom types can set a message to be used in the response when invalid - [@dnesteryuk](https://github.com/dnesteryuk).
* [#2145](https://github.com/ruby-grape/grape/pull/2145): Ruby 3.0 compatibility - [@ericproulx](https://github.com/ericproulx).
* [#2143](https://github.com/ruby-grape/grape/pull/2143): Enable GitHub Actions with updated RuboCop and Danger - [@anakinj](https://github.com/anakinj).
#### Fixes
* [#2144](https://github.com/ruby-grape/grape/pull/2144): Fix compatibility issue with activesupport 6.1 and XML serialization of arrays - [@anakinj](https://github.com/anakinj).
* [#2137](https://github.com/ruby-grape/grape/pull/2137): Fix typos - [@johnny-miyake](https://github.com/johnny-miyake).
* [#2131](https://github.com/ruby-grape/grape/pull/2131): Fix Ruby 2.7 keyword deprecation warning in validators/coerce - [@K0H205](https://github.com/K0H205).
* [#2132](https://github.com/ruby-grape/grape/pull/2132): Use #ruby2_keywords for correct delegation on Ruby <= 2.6, 2.7 and 3 - [@eregon](https://github.com/eregon).
* [#2152](https://github.com/ruby-grape/grape/pull/2152): Fix configuration method inside namespaced params - [@fsainz](https://github.com/fsainz).
### 1.5.1 (2020/11/15)
#### Fixes
* [#2129](https://github.com/ruby-grape/grape/pull/2129): Fix validation error when Required Array nested inside an optional array, for Multiparam validators - [@dwhenry](https://github.com/dwhenry).
* [#2128](https://github.com/ruby-grape/grape/pull/2128): Fix validation error when Required Array nested inside an optional array - [@dwhenry](https://github.com/dwhenry).
* [#2127](https://github.com/ruby-grape/grape/pull/2127): Fix a performance issue with dependent params - [@dnesteryuk](https://github.com/dnesteryuk).
* [#2126](https://github.com/ruby-grape/grape/pull/2126): Fix warnings about redefined attribute accessors in `AttributeTranslator` - [@samsonjs](https://github.com/samsonjs).
* [#2121](https://github.com/ruby-grape/grape/pull/2121): Fix 2.7 deprecation warning in validator_factory - [@Legogris](https://github.com/Legogris).
* [#2115](https://github.com/ruby-grape/grape/pull/2115): Fix declared_params regression with multiple allowed types - [@stanhu](https://github.com/stanhu).
* [#2123](https://github.com/ruby-grape/grape/pull/2123): Fix 2.7 deprecation warning in middleware/stack - [@Legogris](https://github.com/Legogris).
### 1.5.0 (2020/10/05)
#### Fixes
* [#2104](https://github.com/ruby-grape/grape/pull/2104): Fix Ruby 2.7 keyword deprecation warning - [@stanhu](https://github.com/stanhu).
* [#2103](https://github.com/ruby-grape/grape/pull/2103): Ensure complete declared params structure is present - [@tlconnor](https://github.com/tlconnor).
* [#2099](https://github.com/ruby-grape/grape/pull/2099): Added truffleruby to Travis-CI - [@gogainda](https://github.com/gogainda).
* [#2089](https://github.com/ruby-grape/grape/pull/2089): Specify order of mounting Grape with Rack::Cascade in README - [@jonmchan](https://github.com/jonmchan).
* [#2088](https://github.com/ruby-grape/grape/pull/2088): Set `Cache-Control` header only for streamed responses - [@stanhu](https://github.com/stanhu).
* [#2092](https://github.com/ruby-grape/grape/pull/2092): Correct an example params in Include Missing doc - [@huyvohcmc](https://github.com/huyvohcmc).
* [#2091](https://github.com/ruby-grape/grape/pull/2091): Fix ruby 2.7 keyword deprecations - [@dim](https://github.com/dim).
* [#2097](https://github.com/ruby-grape/grape/pull/2097): Skip to set default value unless `meets_dependency?` - [@wanabe](https://github.com/wanabe).
* [#2096](https://github.com/ruby-grape/grape/pull/2096): Fix redundant dependency check - [@braktar](https://github.com/braktar).
* [#2096](https://github.com/ruby-grape/grape/pull/2098): Fix nested coercion - [@braktar](https://github.com/braktar).
* [#2102](https://github.com/ruby-grape/grape/pull/2102): Fix retaining setup blocks when remounting APIs - [@jylamont](https://github.com/jylamont).
### 1.4.0 (2020/07/10)
#### Features
* [#1520](https://github.com/ruby-grape/grape/pull/1520): Un-deprecate stream-like objects - [@urkle](https://github.com/urkle).
* [#2060](https://github.com/ruby-grape/grape/pull/2060): Drop support for Ruby 2.4 - [@dblock](https://github.com/dblock).
* [#2060](https://github.com/ruby-grape/grape/pull/2060): Upgraded Rubocop to 0.84.0 - [@dblock](https://github.com/dblock).
* [#2077](https://github.com/ruby-grape/grape/pull/2077): Simplify logic for defining declared params - [@dnesteryuk](https://github.com/dnesteryuk).
* [#2076](https://github.com/ruby-grape/grape/pull/2076): Make route information available for hooks when the automatically generated endpoints are invoked - [@anakinj](https://github.com/anakinj).
#### Fixes
* [#2067](https://github.com/ruby-grape/grape/pull/2067): Coerce empty String to `nil` for all primitive types except `String` - [@petekinnecom](https://github.com/petekinnecom).
* [#2064](https://github.com/ruby-grape/grape/pull/2064): Fix Ruby 2.7 deprecation warning in `Grape::Middleware::Base#initialize` - [@skarger](https://github.com/skarger).
* [#2072](https://github.com/ruby-grape/grape/pull/2072): Fix `Grape.eager_load!` and `compile!` - [@stanhu](https://github.com/stanhu).
* [#2084](https://github.com/ruby-grape/grape/pull/2084): Fix memory leak in path normalization - [@fcheung](https://github.com/fcheung).
### 1.3.3 (2020/05/23)
#### Features
* [#2048](https://github.com/ruby-grape/grape/issues/2034): Grape Enterprise support is now available [via TideLift](https://tidelift.com/subscription/request-a-demo?utm_source=rubygems-grape&utm_medium=referral&utm_campaign=enterprise) - [@dblock](https://github.com/dblock).
* [#2039](https://github.com/ruby-grape/grape/pull/2039): Travis - update rails versions - [@ericproulx](https://github.com/ericproulx).
* [#2038](https://github.com/ruby-grape/grape/pull/2038): Travis - update ruby versions - [@ericproulx](https://github.com/ericproulx).
* [#2050](https://github.com/ruby-grape/grape/pull/2050): Refactor route public_send to AttributeTranslator - [@ericproulx](https://github.com/ericproulx).
#### Fixes
* [#2049](https://github.com/ruby-grape/grape/pull/2049): Coerce an empty string to nil in case of the bool type - [@dnesteryuk](https://github.com/dnesteryuk).
* [#2043](https://github.com/ruby-grape/grape/pull/2043): Modify declared for nested array and hash - [@kadotami](https://github.com/kadotami).
* [#2040](https://github.com/ruby-grape/grape/pull/2040): Fix a regression with Array of type nil - [@ericproulx](https://github.com/ericproulx).
* [#2054](https://github.com/ruby-grape/grape/pull/2054): Coercing of nested arrays - [@dnesteryuk](https://github.com/dnesteryuk).
* [#2050](https://github.com/ruby-grape/grape/pull/2053): Fix broken multiple mounts - [@Jack12816](https://github.com/Jack12816).
### 1.3.2 (2020/04/12)
#### Features
* [#2020](https://github.com/ruby-grape/grape/pull/2020): Reduce array allocation - [@ericproulx](https://github.com/ericproulx).
* [#2015](https://github.com/ruby-grape/grape/pull/2014): Reduce MatchData allocation - [@ericproulx](https://github.com/ericproulx).
* [#2014](https://github.com/ruby-grape/grape/pull/2014): Reduce total allocated arrays - [@ericproulx](https://github.com/ericproulx).
* [#2011](https://github.com/ruby-grape/grape/pull/2011): Reduce total retained regexes - [@ericproulx](https://github.com/ericproulx).
#### Fixes
* [#2033](https://github.com/ruby-grape/grape/pull/2033): Ensure `Float` params are correctly coerced to `BigDecimal` - [@tlconnor](https://github.com/tlconnor).
* [#2031](https://github.com/ruby-grape/grape/pull/2031): Fix a regression with an array of a custom type - [@dnesteryuk](https://github.com/dnesteryuk).
* [#2026](https://github.com/ruby-grape/grape/pull/2026): Fix a regression in `coerce_with` when coercion returns `nil` - [@misdoro](https://github.com/misdoro).
* [#2025](https://github.com/ruby-grape/grape/pull/2025): Fix Decimal type category - [@kdoya](https://github.com/kdoya).
* [#2019](https://github.com/ruby-grape/grape/pull/2019): Avoid coercing parameter with multiple types to an empty Array - [@stanhu](https://github.com/stanhu).
### 1.3.1 (2020/03/11)
#### Features
* [#2005](https://github.com/ruby-grape/grape/pull/2005): Content types registrable - [@ericproulx](https://github.com/ericproulx).
* [#2003](https://github.com/ruby-grape/grape/pull/2003): Upgraded Rubocop to 0.80.1 - [@ericproulx](https://github.com/ericproulx).
* [#2002](https://github.com/ruby-grape/grape/pull/2002): Objects allocation optimization (lazy_lookup) - [@ericproulx](https://github.com/ericproulx).
#### Fixes
* [#2006](https://github.com/ruby-grape/grape/pull/2006): Fix explicit rescue StandardError - [@ericproulx](https://github.com/ericproulx).
* [#2004](https://github.com/ruby-grape/grape/pull/2004): Rubocop fixes - [@ericproulx](https://github.com/ericproulx).
* [#1995](https://github.com/ruby-grape/grape/pull/1995): Fix: "undefined instance variables" and "method redefined" warnings - [@nbeyer](https://github.com/nbeyer).
* [#1994](https://github.com/ruby-grape/grape/pull/1993): Fix typos in README - [@bellmyer](https://github.com/bellmyer).
* [#1993](https://github.com/ruby-grape/grape/pull/1993): Lazy join allow header - [@ericproulx](https://github.com/ericproulx).
* [#1987](https://github.com/ruby-grape/grape/pull/1987): Re-add exactly_one_of mutually exclusive error message - [@ZeroInputCtrl](https://github.com/ZeroInputCtrl).
* [#1977](https://github.com/ruby-grape/grape/pull/1977): Skip validation for a file if it is optional and nil - [@dnesteryuk](https://github.com/dnesteryuk).
* [#1976](https://github.com/ruby-grape/grape/pull/1976): Ensure classes/modules listed for autoload really exist - [@dnesteryuk](https://github.com/dnesteryuk).
* [#1971](https://github.com/ruby-grape/grape/pull/1971): Fix BigDecimal coercion - [@FlickStuart](https://github.com/FlickStuart).
* [#1968](https://github.com/ruby-grape/grape/pull/1968): Fix args forwarding in Grape::Middleware::Stack#merge_with for ruby 2.7.0 - [@dm1try](https://github.com/dm1try).
* [#1988](https://github.com/ruby-grape/grape/pull/1988): Refactor the full_messages method and stop overriding full_message - [@hosseintoussi](https://github.com/hosseintoussi).
* [#1956](https://github.com/ruby-grape/grape/pull/1956): Comply with Rack spec, fix `undefined method [] for nil:NilClass` error when upgrading Rack - [@ioquatix](https://github.com/ioquatix).
### 1.3.0 (2020/01/11)
#### Features
* [#1949](https://github.com/ruby-grape/grape/pull/1949): Add support for Ruby 2.7 - [@nbulaj](https://github.com/nbulaj).
* [#1948](https://github.com/ruby-grape/grape/pull/1948): Relax `dry-types` dependency version - [@nbulaj](https://github.com/nbulaj).
* [#1944](https://github.com/ruby-grape/grape/pull/1944): Reduces `attribute_translator` string allocations - [@ericproulx](https://github.com/ericproulx).
* [#1943](https://github.com/ruby-grape/grape/pull/1943): Reduces number of regex string allocations - [@ericproulx](https://github.com/ericproulx).
* [#1942](https://github.com/ruby-grape/grape/pull/1942): Optimizes retained memory methods - [@ericproulx](https://github.com/ericproulx).
* [#1941](https://github.com/ruby-grape/grape/pull/1941): Adds frozen string literal - [@ericproulx](https://github.com/ericproulx).
* [#1940](https://github.com/ruby-grape/grape/pull/1940): Gets rid of a needless step in `HashWithIndifferentAccess` - [@dnesteryuk](https://github.com/dnesteryuk).
* [#1938](https://github.com/ruby-grape/grape/pull/1938): Adds project metadata to the gemspec - [@orien](https://github.com/orien).
* [#1920](https://github.com/ruby-grape/grape/pull/1920): Replaces Virtus with dry-types - [@dnesteryuk](https://github.com/dnesteryuk).
* [#1930](https://github.com/ruby-grape/grape/pull/1930): Moves block call to separate method so it can be spied on - [@estolfo](https://github.com/estolfo).
#### Fixes
* [#1965](https://github.com/ruby-grape/grape/pull/1965): Fix typos in README - [@davidalee](https://github.com/davidalee).
* [#1963](https://github.com/ruby-grape/grape/pull/1963): The values validator must properly work with booleans - [@dnesteryuk](https://github.com/dnesteryuk).
* [#1950](https://github.com/ruby-grape/grape/pull/1950): Consider the allow_blank option in the values validator - [@dnesteryuk](https://github.com/dnesteryuk).
* [#1947](https://github.com/ruby-grape/grape/pull/1947): Careful check for empty params - [@dnesteryuk](https://github.com/dnesteryuk).
* [#1931](https://github.com/ruby-grape/grape/pull/1946): Fixes issue when using namespaces in `Grape::API::Instance` mounted directly - [@myxoh](https://github.com/myxoh).
### 1.2.5 (2019/12/01)
#### Features
* [#1931](https://github.com/ruby-grape/grape/pull/1931): Introduces LazyBlock to generate expressions that will executed at mount time - [@myxoh](https://github.com/myxoh).
* [#1918](https://github.com/ruby-grape/grape/pull/1918): Helper methods to access controller context from middleware - [@NikolayRys](https://github.com/NikolayRys).
* [#1915](https://github.com/ruby-grape/grape/pull/1915): Micro optimizations in allocating hashes and arrays - [@dnesteryuk](https://github.com/dnesteryuk).
* [#1904](https://github.com/ruby-grape/grape/pull/1904): Allows Grape to load files on startup rather than on the first call - [@myxoh](https://github.com/myxoh).
* [#1907](https://github.com/ruby-grape/grape/pull/1907): Adds outside configuration to Grape with `configure` - [@unleashy](https://github.com/unleashy).
* [#1914](https://github.com/ruby-grape/grape/pull/1914): Run specs in random order - [@splattael](https://github.com/splattael).
#### Fixes
* [#1917](https://github.com/ruby-grape/grape/pull/1917): Update access to rack constant - [@NikolayRys](https://github.com/NikolayRys).
* [#1916](https://github.com/ruby-grape/grape/pull/1916): Drop old appraisals - [@NikolayRys](https://github.com/NikolayRys).
* [#1911](https://github.com/ruby-grape/grape/pull/1911): Make sure `Grape::Valiations::AtLeastOneOfValidator` properly treats nested params in errors - [@dnesteryuk](https://github.com/dnesteryuk).
* [#1893](https://github.com/ruby-grape/grape/pull/1893): Allows `Grape::API` to behave like a Rack::app in some instances where it was misbehaving - [@myxoh](https://github.com/myxoh).
* [#1898](https://github.com/ruby-grape/grape/pull/1898): Refactor `ValidatorFactory` to improve memory allocation - [@Bhacaz](https://github.com/Bhacaz).
* [#1900](https://github.com/ruby-grape/grape/pull/1900): Define boolean for `Grape::Api::Instance` - [@Bhacaz](https://github.com/Bhacaz).
* [#1903](https://github.com/ruby-grape/grape/pull/1903): Allow nested params renaming (Hash/Array) - [@bikolya](https://github.com/bikolya).
* [#1913](https://github.com/ruby-grape/grape/pull/1913): Fix multiple params validators to return correct messages for nested params - [@bikolya](https://github.com/bikolya).
* [#1926](https://github.com/ruby-grape/grape/pull/1926): Fixes configuration within given or mounted blocks - [@myxoh](https://github.com/myxoh).
* [#1937](https://github.com/ruby-grape/grape/pull/1937): Fix bloat in released gem - [@dblock](https://github.com/dblock).
### 1.2.4 (2019/06/13)
#### Features
* [#1888](https://github.com/ruby-grape/grape/pull/1888): Makes the `configuration` hash widely available - [@myxoh](https://github.com/myxoh).
* [#1864](https://github.com/ruby-grape/grape/pull/1864): Adds `finally` on the API - [@myxoh](https://github.com/myxoh).
* [#1869](https://github.com/ruby-grape/grape/pull/1869): Fix issue with empty headers after `error!` method call - [@anaumov](https://github.com/anaumov).
#### Fixes
* [#1868](https://github.com/ruby-grape/grape/pull/1868): Fix NoMethodError with none hash params - [@ksss](https://github.com/ksss).
* [#1876](https://github.com/ruby-grape/grape/pull/1876): Fix const errors being hidden by bug in `const_missing` - [@dandehavilland](https://github.com/dandehavilland).
### 1.2.3 (2019/01/16)
#### Features
* [#1850](https://github.com/ruby-grape/grape/pull/1850): Adds `same_as` validator - [@glaucocustodio](https://github.com/glaucocustodio).
* [#1833](https://github.com/ruby-grape/grape/pull/1833): Allows to set the `ParamBuilder` globally - [@myxoh](https://github.com/myxoh).
#### Fixes
* [#1852](https://github.com/ruby-grape/grape/pull/1852): `allow_blank` called after `as` when the original param is not blank - [@glaucocustodio](https://github.com/glaucocustodio).
* [#1844](https://github.com/ruby-grape/grape/pull/1844): Enforce `:tempfile` to be a `Tempfile` object in `File` validator - [@Nyangawa](https://github.com/Nyangawa).
### 1.2.2 (2018/12/07)
#### Features
* [#1832](https://github.com/ruby-grape/grape/pull/1832): Support `body_name` in `desc` block - [@fotos](https://github.com/fotos).
* [#1831](https://github.com/ruby-grape/grape/pull/1831): Support `security` in `desc` block - [@fotos](https://github.com/fotos).
#### Fixes
* [#1836](https://github.com/ruby-grape/grape/pull/1836): Fix: memory leak not releasing `call` method calls from setup - [@myxoh](https://github.com/myxoh).
* [#1830](https://github.com/ruby-grape/grape/pull/1830), [#1829](https://github.com/ruby-grape/grape/issues/1829): Restores `self` sanity - [@myxoh](https://github.com/myxoh).
### 1.2.1 (2018/11/28)
#### Fixes
* [#1825](https://github.com/ruby-grape/grape/pull/1825): `to_s` on a mounted class now responses with the API name - [@myxoh](https://github.com/myxoh).
### 1.2.0 (2018/11/26)
#### Features
* [#1813](https://github.com/ruby-grape/grape/pull/1813): Add ruby 2.5 support, drop 2.2. Update rails version in travis - [@darren987469](https://github.com/darren987469).
* [#1803](https://github.com/ruby-grape/grape/pull/1803): Adds the ability to re-mount all endpoints in any location - [@myxoh](https://github.com/myxoh).
* [#1795](https://github.com/ruby-grape/grape/pull/1795): Fix vendor/subtype parsing of an invalid Accept header - [@bschmeck](https://github.com/bschmeck).
* [#1791](https://github.com/ruby-grape/grape/pull/1791): Support `summary`, `hidden`, `deprecated`, `is_array`, `nickname`, `produces`, `consumes`, `tags` options in `desc` block - [@darren987469](https://github.com/darren987469).
#### Fixes
* [#1796](https://github.com/ruby-grape/grape/pull/1796): Fix crash when available locales are enforced but fallback locale unavailable - [@Morred](https://github.com/Morred).
* [#1776](https://github.com/ruby-grape/grape/pull/1776): Validate response returned by the exception handler - [@darren987469](https://github.com/darren987469).
* [#1787](https://github.com/ruby-grape/grape/pull/1787): Add documented but not implemented ability to `.insert` a middleware in the stack - [@michaellennox](https://github.com/michaellennox).
* [#1788](https://github.com/ruby-grape/grape/pull/1788): Fix route requirements bug - [@darren987469](https://github.com/darren987469), [@darrellnash](https://github.com/darrellnash).
* [#1810](https://github.com/ruby-grape/grape/pull/1810): Fix support in `given` for aliased params - [@darren987469](https://github.com/darren987469).
* [#1811](https://github.com/ruby-grape/grape/pull/1811): Support nested dependent parameters - [@darren987469](https://github.com/darren987469), [@andreacfm](https://github.com/andreacfm).
* [#1822](https://github.com/ruby-grape/grape/pull/1822): Raise validation error when optional hash type parameter is received string type value and exactly_one_of be used - [@woshidan](https://github.com/woshidan).
### 1.1.0 (2018/8/4)
#### Features
* [#1759](https://github.com/ruby-grape/grape/pull/1759): Instrument serialization as `'format_response.grape'` - [@zvkemp](https://github.com/zvkemp).
#### Fixes
* [#1762](https://github.com/ruby-grape/grape/pull/1763): Fix unsafe HTML rendering on errors - [@ctennis](https://github.com/ctennis).
* [#1759](https://github.com/ruby-grape/grape/pull/1759): Update appraisal for rails_edge - [@zvkemp](https://github.com/zvkemp).
* [#1758](https://github.com/ruby-grape/grape/pull/1758): Fix expanding load_path in gemspec - [@2maz](https://github.com/2maz).
* [#1765](https://github.com/ruby-grape/grape/pull/1765): Use 415 when request body is of an unsupported media type - [@jdmurphy](https://github.com/jdmurphy).
* [#1771](https://github.com/ruby-grape/grape/pull/1771): Fix param aliases with 'given' blocks - [@jereynolds](https://github.com/jereynolds).
### 1.0.3 (2018/4/23)
#### Fixes
* [#1755](https://github.com/ruby-grape/grape/pull/1755): Fix shared params with exactly_one_of - [@milgner](https://github.com/milgner).
* [#1740](https://github.com/ruby-grape/grape/pull/1740): Fix dependent parameter validation using `given` when parameter is a `Hash` - [@jvortmann](https://github.com/jvortmann).
* [#1737](https://github.com/ruby-grape/grape/pull/1737): Fix translating error when passing symbols as params in custom validations - [@mlzhuyi](https://github.com/mlzhuyi).
* [#1749](https://github.com/ruby-grape/grape/pull/1749): Allow rescue from non-`StandardError` exceptions - [@dm1try](https://github.com/dm1try).
* [#1750](https://github.com/ruby-grape/grape/pull/1750): Fix a circular dependency warning due to router being loaded by API - [@salasrod](https://github.com/salasrod).
* [#1752](https://github.com/ruby-grape/grape/pull/1752): Fix `include_missing` behavior for aliased parameters - [@jonasoberschweiber](https://github.com/jonasoberschweiber).
* [#1754](https://github.com/ruby-grape/grape/pull/1754): Allow rescue from non-`StandardError` exceptions to use default error handling - [@jelkster](https://github.com/jelkster).
* [#1756](https://github.com/ruby-grape/grape/pull/1756): Allow custom Grape exception handlers when the built-in exception handling is enabled - [@soylent](https://github.com/soylent).
### 1.0.2 (2018/1/10)
#### Features
* [#1686](https://github.com/ruby-grape/grape/pull/1686): Avoid coercion of a value if it is valid - [@timothysu](https://github.com/timothysu).
* [#1688](https://github.com/ruby-grape/grape/pull/1688): Removes yard docs - [@ramkumar-kr](https://github.com/ramkumar-kr).
* [#1702](https://github.com/ruby-grape/grape/pull/1702): Added danger-toc, verify correct TOC in README - [@dblock](https://github.com/dblock).
* [#1711](https://github.com/ruby-grape/grape/pull/1711): Automatically coerce arrays and sets of types that implement a `parse` method - [@dslh](https://github.com/dslh).
#### Fixes
* [#1710](https://github.com/ruby-grape/grape/pull/1710): Fix wrong transformation of empty Array in declared params - [@pablonahuelgomez](https://github.com/pablonahuelgomez).
* [#1722](https://github.com/ruby-grape/grape/pull/1722): Fix catch-all hiding multiple versions of an endpoint after the first definition - [@zherr](https://github.com/zherr).
* [#1724](https://github.com/ruby-grape/grape/pull/1724): Optional nested array validation - [@ericproulx](https://github.com/ericproulx).
* [#1725](https://github.com/ruby-grape/grape/pull/1725): Fix `rescue_from :all` documentation - [@Jelkster](https://github.com/Jelkster).
* [#1726](https://github.com/ruby-grape/grape/pull/1726): Improved startup performance during API method generation - [@jkowens](https://github.com/jkowens).
* [#1727](https://github.com/ruby-grape/grape/pull/1727): Fix infinite loop when mounting endpoint with same superclass - [@jkowens](https://github.com/jkowens).
### 1.0.1 (2017/9/8)
#### Features
* [#1652](https://github.com/ruby-grape/grape/pull/1652): Add the original exception to the error_formatter the original exception - [@dcsg](https://github.com/dcsg).
* [#1665](https://github.com/ruby-grape/grape/pull/1665): Make helpers available in subclasses - [@pablonahuelgomez](https://github.com/pablonahuelgomez).
* [#1674](https://github.com/ruby-grape/grape/pull/1674): Add parameter alias (`as`) - [@glaucocustodio](https://github.com/glaucocustodio).
#### Fixes
* [#1652](https://github.com/ruby-grape/grape/pull/1652): Fix missing backtrace that was not being bubbled up to the `error_formatter` - [@dcsg](https://github.com/dcsg).
* [#1661](https://github.com/ruby-grape/grape/pull/1661): Handle deeply-nested dependencies correctly - [@rnubel](https://github.com/rnubel), [@jnardone](https://github.com/jnardone).
* [#1679](https://github.com/ruby-grape/grape/pull/1679): Treat StandardError from explicit values validator proc as false - [@jlfaber](https://github.com/jlfaber).
### 1.0.0 (2017/7/3)
#### Features
* [#1594](https://github.com/ruby-grape/grape/pull/1594): Replace `Hashie::Mash` parameters with `ActiveSupport::HashWithIndifferentAccess` - [@james2m](https://github.com/james2m), [@dblock](https://github.com/dblock).
* [#1622](https://github.com/ruby-grape/grape/pull/1622): Add `except_values` validator to replace `except` option of `values` validator - [@jlfaber](https://github.com/jlfaber).
* [#1635](https://github.com/ruby-grape/grape/pull/1635): Instrument validators with ActiveSupport::Notifications - [@ktimothy](https://github.com/ktimothy).
* [#1646](https://github.com/ruby-grape/grape/pull/1646): Add ability to include an array of modules as helpers - [@pablonahuelgomez](https://github.com/pablonahuelgomez).
* [#1623](https://github.com/ruby-grape/grape/pull/1623): Removed `multi_json` and `multi_xml` dependencies - [@dblock](https://github.com/dblock).
* [#1650](https://github.com/ruby-grape/grape/pull/1650): Add extra specs for Boolean type field - [@tiarly](https://github.com/tiarly).
#### Fixes
* [#1648](https://github.com/ruby-grape/grape/pull/1631): Declared now returns declared options using the class that params is set to use - [@thogg4](https://github.com/thogg4).
* [#1632](https://github.com/ruby-grape/grape/pull/1632): Silence warnings - [@thogg4](https://github.com/thogg4).
* [#1615](https://github.com/ruby-grape/grape/pull/1615): Fix default and type validator when values is a Hash with no value attribute - [@jlfaber](https://github.com/jlfaber).
* [#1625](https://github.com/ruby-grape/grape/pull/1625): Handle `given` correctly when nested in Array params - [@rnubel](https://github.com/rnubel), [@avellable](https://github.com/avellable).
* [#1649](https://github.com/ruby-grape/grape/pull/1649): Don't share validator instances between requests - [@anakinj](https://github.com/anakinj).
### 0.19.2 (2017/4/12)
#### Features
* [#1555](https://github.com/ruby-grape/grape/pull/1555): Added code coverage w/Coveralls - [@dblock](https://github.com/dblock).
* [#1568](https://github.com/ruby-grape/grape/pull/1568): Add `proc` option to `values` validator to allow custom checks - [@jlfaber](https://github.com/jlfaber).
* [#1575](https://github.com/ruby-grape/grape/pull/1575): Include nil values for missing nested params in declared - [@thogg4](https://github.com/thogg4).
* [#1585](https://github.com/ruby-grape/grape/pull/1585): Bugs in declared method - make sure correct options var is used and respect include missing for non children params - [@thogg4](https://github.com/thogg4).
#### Fixes
* [#1570](https://github.com/ruby-grape/grape/pull/1570): Make versioner consider the mount destination path - [@namusyaka](https://github.com/namusyaka).
* [#1579](https://github.com/ruby-grape/grape/pull/1579): Fix delete status with a return value - [@eproulx-petalmd](https://github.com/eproulx-petalmd).
* [#1559](https://github.com/ruby-grape/grape/pull/1559): You can once again pass `nil` to optional attributes with `values` validation set - [@ghiculescu](https://github.com/ghiculescu).
* [#1562](https://github.com/ruby-grape/grape/pull/1562): Fix rainbow gem installation failure above ruby 2.3.3 on travis-ci - [@brucehsu](https://github.com/brucehsu).
* [#1561](https://github.com/ruby-grape/grape/pull/1561): Fix performance issue introduced by duplicated calls in StackableValue#[] - [@brucehsu](https://github.com/brucehsu).
* [#1564](https://github.com/ruby-grape/grape/pull/1564): Fix declared params bug with nested namespaces - [@bmarini](https://github.com/bmarini).
* [#1567](https://github.com/ruby-grape/grape/pull/1567): Fix values validator when value is empty array and apply except to input array - [@jlfaber](https://github.com/jlfaber).
* [#1569](https://github.com/ruby-grape/grape/pull/1569), [#1511](https://github.com/ruby-grape/grape/issues/1511): Upgrade mustermann-grape to 1.0.0 - [@namusyaka](https://github.com/namusyaka).
* [#1589](https://github.com/ruby-grape/grape/pull/1589): [#726](https://github.com/ruby-grape/grape/issues/726): Use default_format when Content-type is missing and respond with 406 when Content-type is invalid - [@inclooder](https://github.com/inclooder).
### 0.19.1 (2017/1/9)
#### Features
* [#1536](https://github.com/ruby-grape/grape/pull/1536): Updated `invalid_versioner_option` translation - [@Lavode](https://github.com/Lavode).
* [#1543](https://github.com/ruby-grape/grape/pull/1543): Added support for ruby 2.4 - [@LeFnord](https://github.com/LeFnord), [@namusyaka](https://github.com/namusyaka).
#### Fixes
* [#1548](https://github.com/ruby-grape/grape/pull/1548): Fix: avoid failing even if given path does not match with prefix - [@thomas-peyric](https://github.com/thomas-peyric), [@namusyaka](https://github.com/namusyaka).
* [#1550](https://github.com/ruby-grape/grape/pull/1550): Fix: return 200 as default status for DELETE - [@jthornec](https://github.com/jthornec).
### 0.19.0 (2016/12/18)
#### Features
* [#1503](https://github.com/ruby-grape/grape/pull/1503): Allowed use of regexp validator with arrays - [@akoltun](https://github.com/akoltun).
* [#1507](https://github.com/ruby-grape/grape/pull/1507): Added group attributes for parameter definitions - [@304](https://github.com/304).
* [#1532](https://github.com/ruby-grape/grape/pull/1532): Set 204 as default status for DELETE - [@LeFnord](https://github.com/LeFnord).
#### Fixes
* [#1505](https://github.com/ruby-grape/grape/pull/1505): Run `before` and `after` callbacks, but skip the rest when handling OPTIONS - [@jlfaber](https://github.com/jlfaber).
* [#1517](https://github.com/ruby-grape/grape/pull/1517), [#1089](https://github.com/ruby-grape/grape/pull/1089): Fix: priority of ANY routes - [@namusyaka](https://github.com/namusyaka), [@wagenet](https://github.com/wagenet).
* [#1512](https://github.com/ruby-grape/grape/pull/1512): Fix: deeply nested parameters are included within `#declared(params)` - [@krbs](https://github.com/krbs).
* [#1510](https://github.com/ruby-grape/grape/pull/1510): Fix: inconsistent validation for multiple parameters - [@dgasper](https://github.com/dgasper).
* [#1526](https://github.com/ruby-grape/grape/pull/1526): Reduced warnings caused by instance variables not initialized - [@cpetschnig](https://github.com/cpetschnig).
### 0.18.0 (2016/10/7)
#### Features
* [#1480](https://github.com/ruby-grape/grape/pull/1480): Used the ruby-grape-danger gem for PR linting - [@dblock](https://github.com/dblock).
* [#1486](https://github.com/ruby-grape/grape/pull/1486): Implemented except in values validator - [@jonmchan](https://github.com/jonmchan).
* [#1470](https://github.com/ruby-grape/grape/pull/1470): Dropped support for Ruby 2.0 - [@namusyaka](https://github.com/namusyaka).
* [#1490](https://github.com/ruby-grape/grape/pull/1490): Switched to Ruby-2.x+ syntax - [@namusyaka](https://github.com/namusyaka).
* [#1499](https://github.com/ruby-grape/grape/pull/1499): Support `fail_fast` param validation option - [@dgasper](https://github.com/dgasper).
#### Fixes
* [#1498](https://github.com/ruby-grape/grape/pull/1498): Fix: skip validations in inactive given blocks - [@jlfaber](https://github.com/jlfaber).
* [#1479](https://github.com/ruby-grape/grape/pull/1479): Fix: support inserting middleware before/after anonymous classes in the middleware stack - [@rosa](https://github.com/rosa).
* [#1488](https://github.com/ruby-grape/grape/pull/1488): Fix: ensure calling before filters when receiving OPTIONS request - [@namusyaka](https://github.com/namusyaka), [@jlfaber](https://github.com/jlfaber).
* [#1493](https://github.com/ruby-grape/grape/pull/1493): Fix: coercion and lambda fails params validation - [@jonmchan](https://github.com/jonmchan).
### 0.17.0 (2016/7/29)
#### Features
* [#1393](https://github.com/ruby-grape/grape/pull/1393): Middleware can be inserted before or after default Grape middleware - [@ridiculous](https://github.com/ridiculous).
* [#1390](https://github.com/ruby-grape/grape/pull/1390): Allowed inserting middleware at arbitrary points in the middleware stack - [@rosa](https://github.com/rosa).
* [#1366](https://github.com/ruby-grape/grape/pull/1366): Stored `message_key` on `Grape::Exceptions::Validation` - [@mkou](https://github.com/mkou).
* [#1398](https://github.com/ruby-grape/grape/pull/1398): Added `rescue_from :grape_exceptions` - allow Grape to use the built-in `Grape::Exception` handing and use `rescue :all` behavior for everything else - [@mmclead](https://github.com/mmclead).
* [#1443](https://github.com/ruby-grape/grape/pull/1443): Extended `given` to receive a `Proc` - [@glaucocustodio](https://github.com/glaucocustodio).
* [#1455](https://github.com/ruby-grape/grape/pull/1455): Added an automated PR linter - [@orta](https://github.com/orta).
#### Fixes
* [#1463](https://github.com/ruby-grape/grape/pull/1463): Fix array indicies in error messages - [@ffloyd](https://github.com/ffloyd).
* [#1465](https://github.com/ruby-grape/grape/pull/1465): Fix 'before' being called twice when using not allowed method - [@jsteinberg](https://github.com/jsteinberg).
* [#1446](https://github.com/ruby-grape/grape/pull/1446): Fix for `env` inside `before` when using not allowed method - [@leifg](https://github.com/leifg).
* [#1438](https://github.com/ruby-grape/grape/pull/1439): Try to dup non-frozen default params with each use - [@jlfaber](https://github.com/jlfaber).
* [#1430](https://github.com/ruby-grape/grape/pull/1430): Fix for `declared(params)` inside `route_param` - [@Arkanain](https://github.com/Arkanain).
* [#1405](https://github.com/ruby-grape/grape/pull/1405): Fix priority of `rescue_from` clauses applying - [@hedgesky](https://github.com/hedgesky).
* [#1365](https://github.com/ruby-grape/grape/pull/1365): Fix finding exception handler in error middleware - [@ktimothy](https://github.com/ktimothy).
* [#1380](https://github.com/ruby-grape/grape/pull/1380): Fix `allow_blank: false` for `Time` attributes with valid values causes `NoMethodError` - [@ipkes](https://github.com/ipkes).
* [#1384](https://github.com/ruby-grape/grape/pull/1384): Fix parameter validation with an empty optional nested `Array` - [@ipkes](https://github.com/ipkes).
* [#1414](https://github.com/ruby-grape/grape/pull/1414): Fix multiple version definitions for path versioning - [@304](https://github.com/304).
* [#1415](https://github.com/ruby-grape/grape/pull/1415): Fix `declared(params, include_parent_namespaces: false)` - [@304](https://github.com/304).
* [#1421](https://github.com/ruby-grape/grape/pull/1421): Avoid polluting `Grape::Middleware::Error` - [@namusyaka](https://github.com/namusyaka).
* [#1422](https://github.com/ruby-grape/grape/pull/1422): Concat parent declared params with current one - [@plukevdh](https://github.com/plukevdh), [@rnubel](https://github.com/rnubel), [@namusyaka](https://github.com/namusyaka).
### 0.16.2 (2016/4/12)
#### Features
* [#1348](https://github.com/ruby-grape/grape/pull/1348): Fix global functions polluting Grape::API scope - [@dblock](https://github.com/dblock).
* [#1357](https://github.com/ruby-grape/grape/pull/1357): Expose Route#options - [@namusyaka](https://github.com/namusyaka).
#### Fixes
* [#1357](https://github.com/ruby-grape/grape/pull/1357): Don't include fixed named captures as route params - [@namusyaka](https://github.com/namusyaka).
* [#1359](https://github.com/ruby-grape/grape/pull/1359): Avoid evaluating the same route twice - [@namusyaka](https://github.com/namusyaka), [@dblock](https://github.com/dblock).
* [#1361](https://github.com/ruby-grape/grape/pull/1361): Return 405 correctly even if version is using as header and wrong request method - [@namusyaka](https://github.com/namusyaka), [@dblock](https://github.com/dblock).
### 0.16.1 (2016/4/3)
#### Features
* [#1276](https://github.com/ruby-grape/grape/pull/1276): Replace rack-mount with new router - [@namusyaka](https://github.com/namusyaka).
* [#1321](https://github.com/ruby-grape/grape/pull/1321): Serve files without using FileStreamer-like object - [@lfidnl](https://github.com/lfidnl).
* [#1339](https://github.com/ruby-grape/grape/pull/1339): Implement Grape::API.recognize_path - [@namusyaka](https://github.com/namusyaka).
#### Fixes
* [#1325](https://github.com/ruby-grape/grape/pull/1325): Params: Fix coerce_with helper with Array types - [@ngonzalez](https://github.com/ngonzalez).
* [#1326](https://github.com/ruby-grape/grape/pull/1326): Fix wrong behavior for OPTIONS and HEAD requests with catch-all - [@ekampp](https://github.com/ekampp), [@namusyaka](https://github.com/namusyaka).
* [#1330](https://github.com/ruby-grape/grape/pull/1330): Add `register` keyword for adding customized parsers and formatters - [@namusyaka](https://github.com/namusyaka).
* [#1336](https://github.com/ruby-grape/grape/pull/1336): Do not modify Hash argument to `error!` - [@tjwp](https://github.com/tjwp).
### 0.15.0 (2016/3/8)
#### Features
* [#1227](https://github.com/ruby-grape/grape/pull/1227): Store `message_key` on `Grape::Exceptions::Validation` - [@stjhimy](https://github.com/sthimy).
* [#1232](https://github.com/ruby-grape/grape/pull/1232): Helpers are now available inside `rescue_from` - [@namusyaka](https://github.com/namusyaka).
* [#1237](https://github.com/ruby-grape/grape/pull/1237): Allow multiple parameters in `given`, which behaves as if the scopes were nested in the inputted order - [@ochagata](https://github.com/ochagata).
* [#1238](https://github.com/ruby-grape/grape/pull/1238): Call `after` of middleware on error - [@namusyaka](https://github.com/namusyaka).
* [#1243](https://github.com/ruby-grape/grape/pull/1243): Add `header` support for middleware - [@namusyaka](https://github.com/namusyaka).
* [#1252](https://github.com/ruby-grape/grape/pull/1252): Allow default to be a subset or equal to allowed values without raising IncompatibleOptionValues - [@jeradphelps](https://github.com/jeradphelps).
* [#1255](https://github.com/ruby-grape/grape/pull/1255): Allow param type definition in `route_param` - [@namusyaka](https://github.com/namusyaka).
* [#1257](https://github.com/ruby-grape/grape/pull/1257): Allow Proc, Symbol or String in `rescue_from with: ...` - [@namusyaka](https://github.com/namusyaka).
* [#1280](https://github.com/ruby-grape/grape/pull/1280): Support `Rack::Sendfile` middleware - [@lfidnl](https://github.com/lfidnl).
* [#1285](https://github.com/ruby-grape/grape/pull/1285): Add a warning for errors appearing in `after` callbacks - [@gregormelhorn](https://github.com/gregormelhorn).
* [#1295](https://github.com/ruby-grape/grape/pull/1295): Add custom validation messages for parameter exceptions - [@railsmith](https://github.com/railsmith).
#### Fixes
* [#1216](https://github.com/ruby-grape/grape/pull/1142): Fix JSON error response when calling `error!` with non-Strings - [@jrforrest](https://github.com/jrforrest).
* [#1225](https://github.com/ruby-grape/grape/pull/1225): Fix `given` with nested params not returning correct declared params - [@JanStevens](https://github.com/JanStevens).
* [#1249](https://github.com/ruby-grape/grape/pull/1249): Don't fail even if invalid type value is passed to default validator - [@namusyaka](https://github.com/namusyaka).
* [#1266](https://github.com/ruby-grape/grape/pull/1266): Fix `Allow` header including `OPTIONS` when `do_not_route_options!` is active - [@arempe93](https://github.com/arempe93).
* [#1270](https://github.com/ruby-grape/grape/pull/1270): Fix `param` versioning with a custom parameter - [@wshatch](https://github.com/wshatch).
* [#1282](https://github.com/ruby-grape/grape/pull/1282): Fix specs circular dependency - [@304](https://github.com/304).
* [#1283](https://github.com/ruby-grape/grape/pull/1283): Fix 500 error for xml format when method is not allowed - [@304](https://github.com/304).
* [#1197](https://github.com/ruby-grape/grape/pull/1290): Fix using JSON and Array[JSON] as groups when parameter is optional - [@lukeivers](https://github.com/lukeivers).
### 0.14.0 (2015/12/07)
#### Features
* [#1218](https://github.com/ruby-grape/grape/pull/1218): Provide array index context in errors - [@towanda](https://github.com/towanda).
* [#1196](https://github.com/ruby-grape/grape/pull/1196): Allow multiple `before_each` blocks - [@huynhquancam](https://github.com/huynhquancam).
* [#1190](https://github.com/ruby-grape/grape/pull/1190): Bypass formatting for statuses with no entity-body - [@tylerdooling](https://github.com/tylerdooling).
* [#1188](https://github.com/ruby-grape/grape/pull/1188): Allow parameters with more than one type - [@dslh](https://github.com/dslh).
* [#1179](https://github.com/ruby-grape/grape/pull/1179): Allow all RFC6838 valid characters in header vendor - [@suan](https://github.com/suan).
* [#1170](https://github.com/ruby-grape/grape/pull/1170): Allow dashes and periods in header vendor - [@suan](https://github.com/suan).
* [#1167](https://github.com/ruby-grape/grape/pull/1167): Convenience wrapper `type: File` for validating multipart file parameters - [@dslh](https://github.com/dslh).
* [#1167](https://github.com/ruby-grape/grape/pull/1167): Refactor and extend coercion and type validation system - [@dslh](https://github.com/dslh).
* [#1163](https://github.com/ruby-grape/grape/pull/1163): First-class `JSON` parameter type - [@dslh](https://github.com/dslh).
* [#1161](https://github.com/ruby-grape/grape/pull/1161): Custom parameter coercion using `coerce_with` - [@dslh](https://github.com/dslh).
#### Fixes
* [#1194](https://github.com/ruby-grape/grape/pull/1194): Redirect as plain text with message - [@tylerdooling](https://github.com/tylerdooling).
* [#1185](https://github.com/ruby-grape/grape/pull/1185): Use formatters for custom vendored content types - [@tylerdooling](https://github.com/tylerdooling).
* [#1156](https://github.com/ruby-grape/grape/pull/1156): Fixed `no implicit conversion of Symbol into Integer` with nested `values` validation - [@quickpay](https://github.com/quickpay).
* [#1153](https://github.com/ruby-grape/grape/pull/1153): Fixes boolean declaration in an external file - [@towanda](https://github.com/towanda).
* [#1142](https://github.com/ruby-grape/grape/pull/1142): Makes #declared unavailable to before filters - [@jrforrest](https://github.com/jrforrest).
* [#1114](https://github.com/ruby-grape/grape/pull/1114): Fix regression which broke identical endpoints with different versions - [@suan](https://github.com/suan).
* [#1109](https://github.com/ruby-grape/grape/pull/1109): Memoize Virtus attribute and fix memory leak - [@marshall-lee](https://github.com/marshall-lee).
* [#1101](https://github.com/ruby-grape/grape/pull/1101): Fix: Incorrect media-type `Accept` header now correctly returns 406 with `strict: true` - [@elliotlarson](https://github.com/elliotlarson).
* [#1108](https://github.com/ruby-grape/grape/pull/1039): Raise a warning when `desc` is called with options hash and block - [@rngtng](https://github.com/rngtng).
### 0.13.0 (2015/8/10)
#### Features
* [#1039](https://github.com/ruby-grape/grape/pull/1039): Added support for custom parameter types - [@rnubel](https://github.com/rnubel).
* [#1047](https://github.com/ruby-grape/grape/pull/1047): Adds `given` to DSL::Parameters, allowing for dependent params - [@rnubel](https://github.com/rnubel).
* [#1064](https://github.com/ruby-grape/grape/pull/1064): Add public `Grape::Exception::ValidationErrors#full_messages` - [@romanlehnert](https://github.com/romanlehnert).
* [#1079](https://github.com/ruby-grape/grape/pull/1079): Added `stream` method to take advantage of `Rack::Chunked` - [@zbelzer](https://github.com/zbelzer).
* [#1086](https://github.com/ruby-grape/grape/pull/1086): Added `ActiveSupport::Notifications` instrumentation - [@wagenet](https://github.com/wagenet).
#### Fixes
* [#1062](https://github.com/ruby-grape/grape/issues/1062): Fix: `Grape::Exceptions::ValidationErrors` will include headers set by `header` - [@yairgo](https://github.com/yairgo).
* [#1038](https://github.com/ruby-grape/grape/pull/1038): Avoid dup-ing the `String` class when used in inherited params - [@rnubel](https://github.com/rnubel).
* [#1042](https://github.com/ruby-grape/grape/issues/1042): Fix coercion of complex arrays - [@dim](https://github.com/dim).
* [#1045](https://github.com/ruby-grape/grape/pull/1045): Do not convert `Rack::Response` to `Rack::Response` in middleware - [@dmitry](https://github.com/dmitry).
* [#1048](https://github.com/ruby-grape/grape/pull/1048): Only dup `InheritableValues`, remove support for `deep_dup` - [@toddmazierski](https://github.com/toddmazierski).
* [#1052](https://github.com/ruby-grape/grape/pull/1052): Reset `description[:params]` when resetting validations - [@marshall-lee](https://github.com/marshall-lee).
* [#1088](https://github.com/ruby-grape/grape/pull/1088): Support ActiveSupport 3.x by explicitly requiring `Hash#except` - [@wagenet](https://github.com/wagenet).
* [#1096](https://github.com/ruby-grape/grape/pull/1096): Fix coercion on booleans - [@towanda](https://github.com/towanda).
### 0.12.0 (2015/6/18)
#### Features
* [#995](https://github.com/ruby-grape/grape/issues/995): Added support for coercion to Set or Set[Other] - [@jordansexton](https://github.com/jordansexton) [@u2](https://github.com/u2).
* [#980](https://github.com/ruby-grape/grape/issues/980): Grape is now eager-loaded - [@u2](https://github.com/u2).
* [#956](https://github.com/ruby-grape/grape/issues/956): Support `present` with `Grape::Presenters::Presenter` - [@u2](https://github.com/u2).
* [#974](https://github.com/ruby-grape/grape/pull/974): Added `error!` to `rescue_from` blocks - [@whatasunnyday](https://github.com/whatasunnyday).
* [#950](https://github.com/ruby-grape/grape/pull/950): Status method can now accept one of Rack::Utils status code symbols (:ok, :found, :bad_request, etc.) - [@dabrorius](https://github.com/dabrorius).
* [#952](https://github.com/ruby-grape/grape/pull/952): Status method now raises error when called with invalid status code - [@dabrorius](https://github.com/dabrorius).
* [#957](https://github.com/ruby-grape/grape/pull/957): Regexp validator now supports `allow_blank`, `nil` value behavior changed - [@calfzhou](https://github.com/calfzhou).
* [#962](https://github.com/ruby-grape/grape/pull/962): The `default` attribute with `false` value is documented now - [@ajvondrak](https://github.com/ajvondrak).
* [#1026](https://github.com/ruby-grape/grape/pull/1026): Added `file` method, explicitly setting a file-like response object - [@dblock](https://github.com/dblock).
#### Fixes
* [#994](https://github.com/ruby-grape/grape/pull/994): Fixed optional Array params default to Hash - [@u2](https://github.com/u2).
* [#988](https://github.com/ruby-grape/grape/pull/988): Fixed duplicate identical endpoints - [@u2](https://github.com/u2).
* [#936](https://github.com/ruby-grape/grape/pull/936): Fixed default params processing for optional groups - [@dm1try](https://github.com/dm1try).
* [#942](https://github.com/ruby-grape/grape/pull/942): Fixed forced presence for optional params when based on a reused entity that was also required in another context - [@croeck](https://github.com/croeck).
* [#1001](https://github.com/ruby-grape/grape/pull/1001): Fixed calling endpoint with specified format with format in its path - [@hodak](https://github.com/hodak).
* [#1005](https://github.com/ruby-grape/grape/pull/1005): Fixed the Grape::Middleware::Globals - [@urkle](https://github.com/urkle).
* [#1012](https://github.com/ruby-grape/grape/pull/1012): Fixed `allow_blank: false` with a Boolean value of `false` - [@mfunaro](https://github.com/mfunaro).
* [#1023](https://github.com/ruby-grape/grape/issues/1023): Fixes unexpected behavior with `present` and an object that responds to `merge` but isn't a Hash - [@dblock](https://github.com/dblock).
* [#1017](https://github.com/ruby-grape/grape/pull/1017): Fixed `undefined method stringify_keys` with nested mutual exclusive params - [@quickpay](https://github.com/quickpay).
### 0.11.0 (2015/2/23)
* [#925](https://github.com/ruby-grape/grape/pull/925): Fixed `toplevel constant DateTime referenced by Virtus::Attribute::DateTime` - [@u2](https://github.com/u2).
* [#916](https://github.com/ruby-grape/grape/pull/916): Added `DateTime/Date/Numeric/Boolean` type support `allow_blank` - [@u2](https://github.com/u2).
* [#871](https://github.com/ruby-grape/grape/pull/871): Fixed `Grape::Middleware::Base#response` - [@galathius](https://github.com/galathius).
* [#559](https://github.com/ruby-grape/grape/issues/559): Added support for Rack 1.6.0, which parses requests larger than 128KB - [@myitcv](https://github.com/myitcv).
* [#876](https://github.com/ruby-grape/grape/pull/876): Call to `declared(params)` now returns a `Hashie::Mash` - [@rodzyn](https://github.com/rodzyn).
* [#879](https://github.com/ruby-grape/grape/pull/879): The `route_info` value is no longer included in `params` Hash - [@rodzyn](https://github.com/rodzyn).
* [#881](https://github.com/ruby-grape/grape/issues/881): Fixed `Grape::Validations::ValuesValidator` support for `Range` type - [@ajvondrak](https://github.com/ajvondrak).
* [#901](https://github.com/ruby-grape/grape/pull/901): Fix: callbacks defined in a version block are only called for the routes defined in that block - [@kushkella](https://github.com/kushkella).
* [#886](https://github.com/ruby-grape/grape/pull/886): Group of parameters made to require an explicit type of Hash or Array - [@jrichter1](https://github.com/jrichter1).
* [#912](https://github.com/ruby-grape/grape/pull/912): Extended the `:using` feature for param documentation to `optional` fields - [@croeck](https://github.com/croeck).
* [#906](https://github.com/ruby-grape/grape/pull/906): Fix: invalid body parse errors are not rescued by handlers - [@croeck](https://github.com/croeck).
* [#913](https://github.com/ruby-grape/grape/pull/913): Fix: Invalid accept headers are not processed by rescue handlers - [@croeck](https://github.com/croeck).
* [#913](https://github.com/ruby-grape/grape/pull/913): Fix: Invalid accept headers cause internal processing errors (500) when http_codes are defined - [@croeck](https://github.com/croeck).
* [#917](https://github.com/ruby-grape/grape/pull/917): Use HTTPS for rubygems.org - [@O-I](https://github.com/O-I).
### 0.10.1 (2014/12/28)
* [#868](https://github.com/ruby-grape/grape/pull/868), [#862](https://github.com/ruby-grape/grape/pull/862), [#861](https://github.com/ruby-grape/grape/pull/861): Fixed `version`, `prefix`, and other settings being overridden or changing scope when mounting API - [@yesmeck](https://github.com/yesmeck).
* [#864](https://github.com/ruby-grape/grape/pull/864): Fixed `declared(params, include_missing: false)` now returning attributes with `nil` and `false` values - [@ppadron](https://github.com/ppadron).
### 0.10.0 (2014/12/19)
* [#803](https://github.com/ruby-grape/grape/pull/803), [#820](https://github.com/ruby-grape/grape/pull/820): Added `all_or_none_of` parameter validator - [@loveltyoic](https://github.com/loveltyoic), [@natecj](https://github.com/natecj).
* [#774](https://github.com/ruby-grape/grape/pull/774): Extended `mutually_exclusive`, `exactly_one_of`, `at_least_one_of` to work inside any kind of group: `requires` or `optional`, `Hash` or `Array` - [@ShPakvel](https://github.com/ShPakvel).
* [#743](https://github.com/ruby-grape/grape/pull/743): Added `allow_blank` parameter validator to validate non-empty strings - [@elado](https://github.com/elado).
* [#745](https://github.com/ruby-grape/grape/pull/745): Removed `atom+xml`, `rss+xml`, and `jsonapi` content-types - [@akabraham](https://github.com/akabraham).
* [#745](https://github.com/ruby-grape/grape/pull/745): Added `:binary, application/octet-stream` content-type - [@akabraham](https://github.com/akabraham).
* [#757](https://github.com/ruby-grape/grape/pull/757): Changed `desc` can now be used with a block syntax - [@dspaeth-faber](https://github.com/dspaeth-faber).
* [#779](https://github.com/ruby-grape/grape/pull/779): Fixed using `values` with a `default` proc - [@ShPakvel](https://github.com/ShPakvel).
* [#799](https://github.com/ruby-grape/grape/pull/799): Fixed custom validators with required `Hash`, `Array` types - [@bwalex](https://github.com/bwalex).
* [#784](https://github.com/ruby-grape/grape/pull/784): Fixed `present` to not overwrite the previously added contents of the response body whebn called more than once - [@mfunaro](https://github.com/mfunaro).
* [#809](https://github.com/ruby-grape/grape/pull/809): Removed automatic `(.:format)` suffix on paths if you're using only one format (e.g., with `format :json`, `/path` will respond with JSON but `/path.xml` will be a 404) - [@ajvondrak](https://github.com/ajvondrak).
* [#816](https://github.com/ruby-grape/grape/pull/816): Added ability to filter out missing params if params is a nested hash with `declared(params, include_missing: false)` - [@georgimitev](https://github.com/georgimitev).
* [#819](https://github.com/ruby-grape/grape/pull/819): Allowed both `desc` and `description` in the params DSL - [@mzikherman](https://github.com/mzikherman).
* [#821](https://github.com/ruby-grape/grape/pull/821): Fixed passing string value when hash is expected in params - [@rebelact](https://github.com/rebelact).
* [#824](https://github.com/ruby-grape/grape/pull/824): Validate array params against list of acceptable values - [@dnd](https://github.com/dnd).
* [#813](https://github.com/ruby-grape/grape/pull/813): Routing methods dsl refactored to get rid of explicit `paths` parameter - [@AlexYankee](https://github.com/AlexYankee).
* [#826](https://github.com/ruby-grape/grape/pull/826): Find `coerce_type` for `Array` when not specified - [@manovotn](https://github.com/manovotn).
* [#645](https://github.com/ruby-grape/grape/issues/645): Invoking `body false` will return `204 No Content` - [@dblock](https://github.com/dblock).
* [#801](https://github.com/ruby-grape/grape/issues/801): Only evaluate permitted parameter `values` and `default` lazily on each request when declared as a proc - [@dblock](https://github.com/dblock).
* [#679](https://github.com/ruby-grape/grape/issues/679): Fixed `OPTIONS` method returning 404 when combined with `prefix` - [@dblock](https://github.com/dblock).
* [#679](https://github.com/ruby-grape/grape/issues/679): Fixed unsupported methods returning 404 instead of 405 when combined with `prefix` - [@dblock](https://github.com/dblock).
### 0.9.0 (2014/8/27)
#### Features
* [#691](https://github.com/ruby-grape/grape/issues/691): Added `at_least_one_of` parameter validator - [@dblock](https://github.com/dblock).
* [#698](https://github.com/ruby-grape/grape/pull/698): `error!` sets `status` for `Endpoint` too - [@dspaeth-faber](https://github.com/dspaeth-faber).
* [#703](https://github.com/ruby-grape/grape/pull/703): Added support for Auth-Middleware extension - [@dspaeth-faber](https://github.com/dspaeth-faber).
* [#703](https://github.com/ruby-grape/grape/pull/703): Removed `Grape::Middleware::Auth::Basic` - [@dspaeth-faber](https://github.com/dspaeth-faber).
* [#703](https://github.com/ruby-grape/grape/pull/703): Removed `Grape::Middleware::Auth::Digest` - [@dspaeth-faber](https://github.com/dspaeth-faber).
* [#703](https://github.com/ruby-grape/grape/pull/703): Removed `Grape::Middleware::Auth::OAuth2` - [@dspaeth-faber](https://github.com/dspaeth-faber).
* [#719](https://github.com/ruby-grape/grape/pull/719): Allow passing options hash to a custom validator - [@elado](https://github.com/elado).
* [#716](https://github.com/ruby-grape/grape/pull/716): Calling `content-type` will now return the current content-type - [@dblock](https://github.com/dblock).
* [#705](https://github.com/ruby-grape/grape/pull/705): Errors can now be presented with a `Grape::Entity` class - [@dspaeth-faber](https://github.com/dspaeth-faber).
#### Fixes
* [#687](https://github.com/ruby-grape/grape/pull/687): Fix: `mutually_exclusive` and `exactly_one_of` validation error messages now label parameters as strings, consistently with `requires` and `optional` - [@dblock](https://github.com/dblock).
### 0.8.0 (2014/7/10)
#### Features
* [#639](https://github.com/ruby-grape/grape/pull/639): Added support for blocks with reusable params - [@mibon](https://github.com/mibon).
* [#637](https://github.com/ruby-grape/grape/pull/637): Added support for `exactly_one_of` parameter validation - [@Morred](https://github.com/Morred).
* [#626](https://github.com/ruby-grape/grape/pull/626): Added support for `mutually_exclusive` parameters - [@oliverbarnes](https://github.com/oliverbarnes).
* [#617](https://github.com/ruby-grape/grape/pull/617): Running tests on Ruby 2.1.1, Rubinius 2.1 and 2.2, Ruby and JRuby HEAD - [@dblock](https://github.com/dblock).
* [#397](https://github.com/ruby-grape/grape/pull/397): Adds `Grape::Endpoint.before_each` to allow easy helper stubbing - [@mbleigh](https://github.com/mbleigh).
* [#673](https://github.com/ruby-grape/grape/pull/673): Avoid requiring non-existent fields when using Grape::Entity documentation - [@qqshfox](https://github.com/qqshfox).
#### Fixes
* [#671](https://github.com/ruby-grape/grape/pull/671): Allow required param with predefined set of values to be nil inside optional group - [@dm1try](https://github.com/dm1try).
* [#651](https://github.com/ruby-grape/grape/pull/651): The `rescue_from` keyword now properly defaults to rescuing subclasses of exceptions - [@xevix](https://github.com/xevix).
* [#614](https://github.com/ruby-grape/grape/pull/614): Params with `nil` value are now refused by `RegexpValidator` - [@dm1try](https://github.com/dm1try).
* [#494](https://github.com/ruby-grape/grape/issues/494): Fixed performance issue with requests carrying a large payload - [@dblock](https://github.com/dblock).
* [#619](https://github.com/ruby-grape/grape/pull/619): Convert specs to RSpec 3 syntax with Transpec - [@danielspector](https://github.com/danielspector).
* [#632](https://github.com/ruby-grape/grape/pull/632): `Grape::Endpoint#present` causes ActiveRecord to make an extra query during entity's detection - [@fixme](https://github.com/fixme).
### 0.7.0 (2014/4/2)
#### Features
* [#558](https://github.com/ruby-grape/grape/pull/558): Support lambda-based values for params - [@wpschallenger](https://github.com/wpschallenger).
* [#510](https://github.com/ruby-grape/grape/pull/510): Support lambda-based default values for params - [@myitcv](https://github.com/myitcv).
* [#511](https://github.com/ruby-grape/grape/pull/511): Added `required` option for OAuth2 middleware - [@bcm](https://github.com/bcm).
* [#520](https://github.com/ruby-grape/grape/pull/520): Use `default_error_status` to specify the default status code returned from `error!` - [@salimane](https://github.com/salimane).
* [#525](https://github.com/ruby-grape/grape/pull/525): The default status code returned from `error!` has been changed from 403 to 500 - [@dblock](https://github.com/dblock).
* [#526](https://github.com/ruby-grape/grape/pull/526): Allowed specifying headers in `error!` - [@dblock](https://github.com/dblock).
* [#527](https://github.com/ruby-grape/grape/pull/527): The `before_validation` callback is now a distinct one - [@myitcv](https://github.com/myitcv).
* [#530](https://github.com/ruby-grape/grape/pull/530): Added ability to restrict `declared(params)` to the local endpoint with `include_parent_namespaces: false` - [@myitcv](https://github.com/myitcv).
* [#531](https://github.com/ruby-grape/grape/pull/531): Helpers are now available to auth middleware, executing in the context of the endpoint - [@joelvh](https://github.com/joelvh).
* [#540](https://github.com/ruby-grape/grape/pull/540): Ruby 2.1.0 is now supported - [@salimane](https://github.com/salimane).
* [#544](https://github.com/ruby-grape/grape/pull/544): The `rescue_from` keyword now handles subclasses of exceptions by default - [@xevix](https://github.com/xevix).
* [#545](https://github.com/ruby-grape/grape/pull/545): Added `type` (`Array` or `Hash`) support to `requires`, `optional` and `group` - [@bwalex](https://github.com/bwalex).
* [#550](https://github.com/ruby-grape/grape/pull/550): Added possibility to define reusable params - [@dm1try](https://github.com/dm1try).
* [#560](https://github.com/ruby-grape/grape/pull/560): Use `Grape::Entity` documentation to define required and optional parameters with `requires using:` - [@reynardmh](https://github.com/reynardmh).
* [#572](https://github.com/ruby-grape/grape/pull/572): Added `documentation` support to `requires`, `optional` and `group` parameters - [@johnallen3d](https://github.com/johnallen3d).
#### Fixes
* [#600](https://github.com/ruby-grape/grape/pull/600): Don't use an `Entity` constant that is available in the namespace as presenter - [@fuksito](https://github.com/fuksito).
* [#590](https://github.com/ruby-grape/grape/pull/590): Fix issue where endpoint param of type `Integer` cannot set values array - [@xevix](https://github.com/xevix).
* [#586](https://github.com/ruby-grape/grape/pull/586): Do not repeat the same validation error messages - [@kiela](https://github.com/kiela).
* [#508](https://github.com/ruby-grape/grape/pull/508): Allow parameters, such as content encoding, in `content_type` - [@dm1try](https://github.com/dm1try).
* [#492](https://github.com/ruby-grape/grape/pull/492): Don't allow to have nil value when a param is required and has a list of allowed values - [@Antti](https://github.com/Antti).
* [#495](https://github.com/ruby-grape/grape/pull/495): Fixed `ParamsScope#params` for parameters nested inside arrays - [@asross](https://github.com/asross).
* [#498](https://github.com/ruby-grape/grape/pull/498): Dry'ed up options and headers logic, allow headers to be passed to OPTIONS requests - [@karlfreeman](https://github.com/karlfreeman).
* [#500](https://github.com/ruby-grape/grape/pull/500): Skip entity auto-detection when explicitly passed - [@yaneq](https://github.com/yaneq).
* [#503](https://github.com/ruby-grape/grape/pull/503): Calling declared(params) from child namespace fails to include parent namespace defined params - [@myitcv](https://github.com/myitcv).
* [#512](https://github.com/ruby-grape/grape/pull/512): Don't create `Grape::Request` multiple times - [@dblock](https://github.com/dblock).
* [#538](https://github.com/ruby-grape/grape/pull/538): Fixed default values for grouped params - [@dm1try](https://github.com/dm1try).
* [#549](https://github.com/ruby-grape/grape/pull/549): Fixed handling of invalid version headers to return 406 if a header cannot be parsed - [@bwalex](https://github.com/bwalex).
* [#557](https://github.com/ruby-grape/grape/pull/557): Pass `content_types` option to `Grape::Middleware::Error` to fix the content-type header for custom formats - [@bernd](https://github.com/bernd).
* [#585](https://github.com/ruby-grape/grape/pull/585): Fix after boot thread-safety issue - [@etehtsea](https://github.com/etehtsea).
* [#587](https://github.com/ruby-grape/grape/pull/587): Fix oauth2 middleware compatibility with [draft-ietf-oauth-v2-31](http://tools.ietf.org/html/draft-ietf-oauth-v2-31) spec - [@etehtsea](https://github.com/etehtsea).
* [#610](https://github.com/ruby-grape/grape/pull/610): Fixed group keyword was not working with type parameter - [@klausmeyer](https://github.com/klausmeyer).
### 0.6.1 (2013/10/19)
#### Features
* [#475](https://github.com/ruby-grape/grape/pull/475): Added support for the `:jsonapi`, `application/vnd.api+json` media type registered at http://jsonapi.org - [@bcm](https://github.com/bcm).
* [#471](https://github.com/ruby-grape/grape/issues/471): Added parameter validator for a list of allowed values - [@vickychijwani](https://github.com/vickychijwani).
* [#488](https://github.com/ruby-grape/grape/issues/488): Upgraded to Virtus 1.0 - [@dblock](https://github.com/dblock).
#### Fixes
* [#477](https://github.com/ruby-grape/grape/pull/477): Fixed `default_error_formatter` which takes a format symbol - [@vad4msiu](https://github.com/vad4msiu).
#### Development
* Implemented Rubocop, a Ruby code static code analyzer - [@dblock](https://github.com/dblock).
### 0.6.0 (2013/9/16)
#### Features
* Grape is no longer tested against Ruby 1.8.7 - [@dblock](https://github.com/dblock).
* [#442](https://github.com/ruby-grape/grape/issues/442): Enable incrementally building on top of a previous API version - [@dblock](https://github.com/dblock).
* [#442](https://github.com/ruby-grape/grape/issues/442): API `version` can now take an array of multiple versions - [@dblock](https://github.com/dblock).
* [#444](https://github.com/ruby-grape/grape/issues/444): Added `:en` as fallback locale for I18n - [@aew](https://github.com/aew).
* [#448](https://github.com/ruby-grape/grape/pull/448): Adding POST style parameters for DELETE requests - [@dquimper](https://github.com/dquimper).
* [#450](https://github.com/ruby-grape/grape/pull/450): Added option to pass an exception handler lambda as an argument to `rescue_from` - [@robertopedroso](https://github.com/robertopedroso).
* [#443](https://github.com/ruby-grape/grape/pull/443): Let `requires` and `optional` take blocks that initialize new scopes - [@asross](https://github.com/asross).
* [#452](https://github.com/ruby-grape/grape/pull/452): Added `with` as a hash option to specify handlers for `rescue_from` and `error_formatter` - [@robertopedroso](https://github.com/robertopedroso).
* [#433](https://github.com/ruby-grape/grape/issues/433), [#462](https://github.com/ruby-grape/grape/issues/462): Validation errors are now collected and `Grape::Exceptions::ValidationErrors` is raised - [@stevschmid](https://github.com/stevschmid).
#### Fixes
* [#428](https://github.com/ruby-grape/grape/issues/428): Removes memoization from `Grape::Request` params to prevent middleware from freezing parameter values before `Formatter` can get them - [@mbleigh](https://github.com/mbleigh).
### 0.5.0 (2013/6/14)
#### Features
* [#344](https://github.com/ruby-grape/grape/pull/344): Added `parser :type, nil` which disables input parsing for a given content-type - [@dblock](https://github.com/dblock).
* [#381](https://github.com/ruby-grape/grape/issues/381): Added `cascade false` option at API level to remove the `X-Cascade: true` header from the API response - [@dblock](https://github.com/dblock).
* [#392](https://github.com/ruby-grape/grape/pull/392): Extracted headers and params from `Endpoint` to `Grape::Request` - [@niedhui](https://github.com/niedhui).
* [#376](https://github.com/ruby-grape/grape/pull/376): Added `route_param`, syntax sugar for quick declaration of route parameters - [@mbleigh](https://github.com/mbleigh).
* [#390](https://github.com/ruby-grape/grape/pull/390): Added default value for an `optional` parameter - [@oivoodoo](https://github.com/oivoodoo).
* [#403](https://github.com/ruby-grape/grape/pull/403): Added support for versioning using the `Accept-Version` header - [@politician](https://github.com/politician).
* [#407](https://github.com/ruby-grape/grape/issues/407): Specifying `default_format` will also set the default POST/PUT data parser to the given format - [@dblock](https://github.com/dblock).
* [#241](https://github.com/ruby-grape/grape/issues/241): Present with multiple entities using an optional Symbol - [@niedhui](https://github.com/niedhui).
#### Fixes
* [#378](https://github.com/ruby-grape/grape/pull/378): Fix: stop rescuing all exceptions during formatting - [@kbarrette](https://github.com/kbarrette).
* [#380](https://github.com/ruby-grape/grape/pull/380): Fix: `Formatter#read_body_input` when transfer encoding is chunked - [@paulnicholon](https://github.com/paulnicholson).
* [#347](https://github.com/ruby-grape/grape/issues/347): Fix: handling non-hash body params - [@paulnicholon](https://github.com/paulnicholson).
* [#394](https://github.com/ruby-grape/grape/pull/394): Fix: path version no longer overwrites a `version` parameter - [@tmornini](https://github.com/tmornini).
* [#412](https://github.com/ruby-grape/grape/issues/412): Fix: specifying `content_type` will also override the selection of the data formatter - [@dblock](https://github.com/dblock).
* [#383](https://github.com/ruby-grape/grape/issues/383): Fix: Mounted APIs aren't inheriting settings (including `before` and `after` filters) - [@seanmoon](https://github.com/seanmoon).
* [#408](https://github.com/ruby-grape/grape/pull/408): Fix: Goliath passes request header keys as symbols not strings - [@bobek](https://github.com/bobek).
* [#417](https://github.com/ruby-grape/grape/issues/417): Fix: Rails 4 does not rewind input, causes POSTed data to be empty - [@dblock](https://github.com/dblock).
* [#423](https://github.com/ruby-grape/grape/pull/423): Fix: `Grape::Endpoint#declared` now correctly handles nested params (ie. declared with `group`) - [@jbarreneche](https://github.com/jbarreneche).
* [#427](https://github.com/ruby-grape/grape/issues/427): Fix: `declared(params)` breaks when `params` contains array - [@timhabermaas](https://github.com/timhabermaas).
### 0.4.1 (2013/4/1)
* [#375](https://github.com/ruby-grape/grape/pull/375): Fix: throwing an `:error` inside a middleware doesn't respect the `format` settings - [@dblock](https://github.com/dblock).
### 0.4.0 (2013/3/17)
* [#356](https://github.com/ruby-grape/grape/pull/356): Fix: presenting collections other than `Array` (eg. `ActiveRecord::Relation`) - [@zimbatm](https://github.com/zimbatm).
* [#352](https://github.com/ruby-grape/grape/pull/352): Fix: using `Rack::JSONP` with `Grape::Entity` responses - [@deckchair](https://github.com/deckchair).
* [#347](https://github.com/ruby-grape/grape/issues/347): Grape will accept any valid JSON as PUT or POST, including strings, symbols and arrays - [@qqshfox](https://github.com/qqshfox), [@dblock](https://github.com/dblock).
* [#347](https://github.com/ruby-grape/grape/issues/347): JSON format APIs always return valid JSON, eg. strings are now returned as `"string"` and no longer `string` - [@dblock](https://github.com/dblock).
* Raw body input from POST and PUT requests (`env['rack.input'].read`) is now available in `api.request.input` - [@dblock](https://github.com/dblock).
* Parsed body input from POST and PUT requests is now available in `api.request.body` - [@dblock](https://github.com/dblock).
* [#343](https://github.com/ruby-grape/grape/pull/343): Fix: return `Content-Type: text/plain` with error 405 - [@gustavosaume](https://github.com/gustavosaume), [@wyattisimo](https://github.com/wyattisimo).
* [#357](https://github.com/ruby-grape/grape/pull/357): Grape now requires Rack 1.3.0 or newer - [@jhecking](https://github.com/jhecking).
* [#320](https://github.com/ruby-grape/grape/issues/320): API `namespace` now supports `requirements` - [@niedhui](https://github.com/niedhui).
* [#353](https://github.com/ruby-grape/grape/issues/353): Revert to standard Ruby logger formatter, `require active_support/all` if you want old behavior - [@rhunter](https://github.com/rhunter), [@dblock](https://github.com/dblock).
* Fix: `undefined method 'call' for nil:NilClass` for an API method implementation without a block, now returns an empty string - [@dblock](https://github.com/dblock).
### 0.3.2 (2013/2/28)
* [#355](https://github.com/ruby-grape/grape/issues/355): Relax dependency constraint on Hashie - [@reset](https://github.com/reset).
### 0.3.1 (2013/2/25)
* [#351](https://github.com/ruby-grape/grape/issues/351): Compatibility with Ruby 2.0 - [@mbleigh](https://github.com/mbleigh).
### 0.3.0 (2013/02/21)
* [#294](https://github.com/ruby-grape/grape/issues/294): Extracted `Grape::Entity` into a [grape-entity](https://github.com/agileanimal/grape-entity) gem - [@agileanimal](https://github.com/agileanimal).
* [#340](https://github.com/ruby-grape/grape/pull/339), [#342](https://github.com/ruby-grape/grape/pull/342): Added `:cascade` option to `version` to allow disabling of rack/mount cascade behavior - [@dieb](https://github.com/dieb).
* [#333](https://github.com/ruby-grape/grape/pull/333): Added support for validation of arrays in `params` - [@flyerhzm](https://github.com/flyerhzm).
* [#306](https://github.com/ruby-grape/grape/issues/306): Added I18n support for all Grape exceptions - [@niedhui](https://github.com/niedhui).
* [#309](https://github.com/ruby-grape/grape/pull/309): Added XML support to the entity presenter - [@johnnyiller](https://github.com/johnnyiller), [@dblock](https://github.com/dblock).
* [#131](https://github.com/ruby-grape/grape/issues/131): Added instructions for Grape API reloading in Rails - [@jyn](https://github.com/jyn), [@dblock](https://github.com/dblock).
* [#317](https://github.com/ruby-grape/grape/issues/317): Added `headers` that returns a hash of parsed HTTP request headers - [@dblock](https://github.com/dblock).
* [#332](https://github.com/ruby-grape/grape/pull/332): `Grape::Exceptions::Validation` now contains full nested parameter names - [@alovak](https://github.com/alovak).
* [#328](https://github.com/ruby-grape/grape/issues/328): API version can now be specified as both String and Symbol - [@dblock](https://github.com/dblock).
* [#190](https://github.com/ruby-grape/grape/issues/190): When you add a `GET` route for a resource, a route for the `HEAD` method will also be added automatically. You can disable this behavior with `do_not_route_head!` - [@dblock](https://github.com/dblock).
* Added `do_not_route_options!`, which disables the automatic creation of the `OPTIONS` route - [@dblock](https://github.com/dblock).
* [#309](https://github.com/ruby-grape/grape/pull/309): An XML format API will return an error instead of returning a string representation of the response if the latter cannot be converted to XML - [@dblock](https://github.com/dblock).
* A formatter that raises an exception will cause the API to return a 500 error - [@dblock](https://github.com/dblock).
* [#322](https://github.com/ruby-grape/grape/issues/322): When returning a 406 status, Grape will include the requested format or content-type in the response body - [@dblock](https://github.com/dblock).
* [#60](https://github.com/ruby-grape/grape/issues/60): Fix: mounting of a Grape API onto a path - [@dblock](https://github.com/dblock).
* [#335](https://github.com/ruby-grape/grape/pull/335): Fix: request body parameters from a `PATCH` request not available in `params` - [@FreakenK](https://github.com/FreakenK).
### 0.2.6 (2013/01/11)
* Fix: support content-type with character set when parsing POST and PUT input - [@dblock](https://github.com/dblock).
* Fix: CVE-2013-0175, multi_xml parse vulnerability, require multi_xml 0.5.2 - [@dblock](https://github.com/dblock).
### 0.2.5 (2013/01/10)
* Added support for custom parsers via `parser`, in addition to built-in multipart, JSON and XML parsers - [@dblock](https://github.com/dblock).
* Removed `body_params`, data sent via a POST or PUT with a supported content-type is merged into `params` - [@dblock](https://github.com/dblock).
* Setting `format` will automatically remove other content-types by calling `content_type` - [@dblock](https://github.com/dblock).
* Setting `content_type` will prevent any input data other than the matching content-type or any Rack-supported form and parseable media types (`application/x-www-form-urlencoded`, `multipart/form-data`, `multipart/related` and `multipart/mixed`) from being parsed - [@dblock](https://github.com/dblock).
* [#305](https://github.com/ruby-grape/grape/issues/305): Fix: presenting arrays of objects via `represent` or when auto-detecting an `Entity` constant in the objects being presented - [@brandonweiss](https://github.com/brandonweiss).
* [#306](https://github.com/ruby-grape/grape/issues/306): Added i18n support for validation error messages - [@niedhui](https://github.com/niedhui).
### 0.2.4 (2013/01/06)
* [#297](https://github.com/ruby-grape/grape/issues/297): Added `default_error_formatter` - [@dblock](https://github.com/dblock).
* [#297](https://github.com/ruby-grape/grape/issues/297): Setting `format` will automatically set `default_error_formatter` - [@dblock](https://github.com/dblock).
* [#295](https://github.com/ruby-grape/grape/issues/295): Storing original API source block in endpoint's `source` attribute - [@dblock](https://github.com/dblock).
* [#293](https://github.com/ruby-grape/grape/pull/293): Added options to `cookies.delete`, enables passing a path - [@inst](https://github.com/inst).
* [#174](https://github.com/ruby-grape/grape/issues/174): The value of `env['PATH_INFO']` is no longer altered with `path` versioning - [@dblock](https://github.com/dblock).
* [#296](https://github.com/ruby-grape/grape/issues/296): Fix: ArgumentError with default error formatter - [@dblock](https://github.com/dblock).
* [#298](https://github.com/ruby-grape/grape/pull/298): Fix: subsequent calls to `body_params` would fail due to IO read - [@justinmcp](https://github.com/justinmcp).
* [#301](https://github.com/ruby-grape/grape/issues/301): Fix: symbol memory leak in cookie and formatter middleware - [@dblock](https://github.com/dblock).
* [#300](https://github.com/ruby-grape/grape/issues/300): Fix `Grape::API.routes` to include mounted api routes - [@aiwilliams](https://github.com/aiwilliams).
* [#302](https://github.com/ruby-grape/grape/pull/302): Fix: removed redundant `autoload` entries - [@ugisozols](https://github.com/ugisozols).
* [#172](https://github.com/ruby-grape/grape/issues/172): Fix: MultiJson deprecated methods warnings - [@dblock](https://github.com/dblock).
* [#133](https://github.com/ruby-grape/grape/issues/133): Fix: header-based versioning with use of `prefix` - [@seanmoon](https://github.com/seanmoon), [@dblock](https://github.com/dblock).
* [#280](https://github.com/ruby-grape/grape/issues/280): Fix: grouped parameters mangled in `route_params` hash - [@marcusg](https://github.com/marcusg), [@dblock](https://github.com/dblock).
* [#304](https://github.com/ruby-grape/grape/issues/304): Fix: `present x, :with => Entity` returns class references with `format :json` - [@dblock](https://github.com/dblock).
* [#196](https://github.com/ruby-grape/grape/issues/196): Fix: root requests don't work with `prefix` - [@dblock](https://github.com/dblock).
### 0.2.3 (2012/12/24)
* [#179](https://github.com/ruby-grape/grape/issues/178): Using `content_type` will remove all default content-types - [@dblock](https://github.com/dblock).
* [#265](https://github.com/ruby-grape/grape/issues/264): Fix: Moved `ValidationError` into `Grape::Exceptions` - [@thepumpkin1979](https://github.com/thepumpkin1979).
* [#269](https://github.com/ruby-grape/grape/pull/269): Fix: `LocalJumpError` will not be raised when using explict return in API methods - [@simulacre](https://github.com/simulacre).
* [#86](https://github.com/ruby-grape/grape/issues/275): Fix Path-based versioning not recognizing `/` route - [@walski](https://github.com/walski).
* [#273](https://github.com/ruby-grape/grape/pull/273): Disabled formatting via `serializable_hash` and added support for `format :serializable_hash` - [@dblock](https://github.com/dblock).
* [#277](https://github.com/ruby-grape/grape/pull/277): Added a DSL to declare `formatter` in API settings - [@tim-vandecasteele](https://github.com/tim-vandecasteele).
* [#284](https://github.com/ruby-grape/grape/pull/284): Added a DSL to declare `error_formatter` in API settings - [@dblock](https://github.com/dblock).
* [#285](https://github.com/ruby-grape/grape/pull/285): Removed `error_format` from API settings, now matches request format - [@dblock](https://github.com/dblock).
* [#290](https://github.com/ruby-grape/grape/pull/290): The default error format for XML is now `error/message` instead of `hash/error` - [@dpsk](https://github.com/dpsk).
* [#44](https://github.com/ruby-grape/grape/issues/44): Pass `env` into formatters to enable templating - [@dblock](https://github.com/dblock).
### 0.2.2 (2012/12/10)
#### Features
* [#201](https://github.com/ruby-grape/grape/pull/201), [#236](https://github.com/ruby-grape/grape/pull/236), [#221](https://github.com/ruby-grape/grape/pull/221): Added coercion and validations support to `params` DSL - [@schmurfy](https://github.com/schmurfy), [@tim-vandecasteele](https://github.com/tim-vandecasteele), [@adamgotterer](https://github.com/adamgotterer).
* [#204](https://github.com/ruby-grape/grape/pull/204): Added ability to declare shared `params` at `namespace` level - [@tim-vandecasteele](https://github.com/tim-vandecasteele).
* [#234](https://github.com/ruby-grape/grape/pull/234): Added a DSL for creating entities via mixin - [@mbleigh](https://github.com/mbleigh).
* [#240](https://github.com/ruby-grape/grape/pull/240): Define API response format from a query string `format` parameter, if specified - [@neetiraj](https://github.com/neetiraj).
* Adds Endpoint#declared to easily filter out unexpected params - [@mbleigh](https://github.com/mbleigh).
#### Fixes
* [#248](https://github.com/ruby-grape/grape/pull/248): Fix: API `version` returns last version set - [@narkoz](https://github.com/narkoz).
* [#242](https://github.com/ruby-grape/grape/issues/242): Fix: permanent redirect status should be `301`, was `304` - [@adamgotterer](https://github.com/adamgotterer).
* [#211](https://github.com/ruby-grape/grape/pull/211): Fix: custom validations are no longer triggered when optional and parameter is not present - [@adamgotterer](https://github.com/adamgotterer).
* [#210](https://github.com/ruby-grape/grape/pull/210): Fix: `Endpoint#body_params` causing undefined method 'size' - [@adamgotterer](https://github.com/adamgotterer).
* [#205](https://github.com/ruby-grape/grape/pull/205): Fix: Corrected parsing of empty JSON body on POST/PUT - [@tim-vandecasteele](https://github.com/tim-vandecasteele).
* [#181](https://github.com/ruby-grape/grape/pull/181): Fix: Corrected JSON serialization of nested hashes containing `Grape::Entity` instances - [@benrosenblum](https://github.com/benrosenblum).
* [#203](https://github.com/ruby-grape/grape/pull/203): Added a check to `Entity#serializable_hash` that verifies an entity exists on an object - [@adamgotterer](https://github.com/adamgotterer).
* [#208](https://github.com/ruby-grape/grape/pull/208): `Entity#serializable_hash` must also check if attribute is generated by a user supplied block - [@ppadron](https://github.com/ppadron).
* [#252](https://github.com/ruby-grape/grape/pull/252): Resources that don't respond to a requested HTTP method return 405 (Method Not Allowed) instead of 404 (Not Found) - [@simulacre](https://github.com/simulacre).
### 0.2.1 (2012/7/11)
* [#186](https://github.com/ruby-grape/grape/issues/186): Fix: helpers allow multiple calls with modules and blocks - [@ppadron](https://github.com/ppadron).
* [#188](https://github.com/ruby-grape/grape/pull/188): Fix: multi-method routes append '(.:format)' only once - [@kainosnoema](https://github.com/kainosnoema).
* [#64](https://github.com/ruby-grape/grape/issues/64), [#180](https://github.com/ruby-grape/grape/pull/180): Added support to `GET` request bodies as parameters - [@bobbytables](https://github.com/bobbytables).
* [#175](https://github.com/ruby-grape/grape/pull/175): Added support for API versioning based on a request parameter - [@jackcasey](https://github.com/jackcasey).
* [#168](https://github.com/ruby-grape/grape/pull/168): Fix: Formatter can parse symbol keys in the headers hash - [@netmask](https://github.com/netmask).
* [#169](https://github.com/ruby-grape/grape/pull/169): Silence multi_json deprecation warnings - [@whiteley](https://github.com/whiteley).
* [#166](https://github.com/ruby-grape/grape/pull/166): Added support for `redirect`, including permanent and temporary - [@allenwei](https://github.com/allenwei).
* [#159](https://github.com/ruby-grape/grape/pull/159): Added `:requirements` to routes, allowing to use reserved characters in paths - [@gaiottino](https://github.com/gaiottino).
* [#156](https://github.com/ruby-grape/grape/pull/156): Added support for adding formatters to entities - [@bobbytables](https://github.com/bobbytables).
* [#183](https://github.com/ruby-grape/grape/pull/183): Added ability to include documentation in entities - [@flah00](https://github.com/flah00).
* [#189](https://github.com/ruby-grape/grape/pull/189): `HEAD` requests no longer return a body - [@stephencelis](https://github.com/stephencelis).
* [#97](https://github.com/ruby-grape/grape/issues/97): Allow overriding `Content-Type` - [@dblock](https://github.com/dblock).
### 0.2.0 (2012/3/28)
* Added support for inheriting exposures from entities - [@bobbytables](https://github.com/bobbytables).
* Extended formatting with `default_format` - [@dblock](https://github.com/dblock).
* Added support for cookies - [@lukaszsliwa](https://github.com/lukaszsliwa).
* Added support for declaring additional content-types - [@joeyAghion](https://github.com/joeyAghion).
* Added support for HTTP PATCH - [@LTe](https://github.com/LTe).
* Added support for describing, documenting and reflecting APIs - [@dblock](https://github.com/dblock).
* Added support for anchoring and vendoring - [@jwkoelewijn](https://github.com/jwkoelewijn).
* Added support for HTTP OPTIONS - [@grimen](https://github.com/grimen).
* Added support for silencing logger - [@evansj](https://github.com/evansj).
* Added support for helper modules - [@freelancing-god](https://github.com/freelancing-god).
* Added support for Accept header-based versioning - [@jch](https://github.com/jch), [@rodzyn](https://github.com/rodzyn).
* Added support for mounting APIs and other Rack applications within APIs - [@mbleigh](https://github.com/mbleigh).
* Added entities, multiple object representations - [@mbleigh](https://github.com/mbleigh).
* Added ability to handle XML in the incoming request body - [@jwillis](https://github.com/jwillis).
* Added support for a configurable logger - [@mbleigh](https://github.com/mbleigh).
* Added support for before and after filters - [@mbleigh](https://github.com/mbleigh).
* Extended `rescue_from`, which can now take a block - [@dblock](https://github.com/dblock).
### 0.1.5 (2011/6/14)
* Extended exception handling to all exceptions - [@dblock](https://github.com/dblock).
* Added support for returning JSON objects from within error blocks - [@dblock](https://github.com/dblock).
* Added support for handling incoming JSON in body - [@tedkulp](https://github.com/tedkulp).
* Added support for HTTP digest authentication - [@daddz](https://github.com/daddz).
### 0.1.4 (2011/4/8)
* Allow multiple definitions of the same endpoint under multiple versions - [@chrisrhoden](https://github.com/chrisrhoden).
* Added support for multipart URL parameters - [@mcastilho](https://github.com/mcastilho).
* Added support for custom formatters - [@spraints](https://github.com/spraints).
### 0.1.3 (2011/1/10)
* Added support for JSON format in route matching - [@aiwilliams](https://github.com/aiwilliams).
* Added suport for custom middleware - [@mbleigh](https://github.com/mbleigh).
### 0.1.1 (2010/11/14)
* Endpoints properly reset between each request - [@mbleigh](https://github.com/mbleigh).
### 0.1.0 (2010/11/13)
* Initial public release - [@mbleigh](https://github.com/mbleigh).
================================================
FILE: CONTRIBUTING.md
================================================
Contributing to Grape
=====================
Grape is work of [hundreds of contributors](https://github.com/ruby-grape/grape/graphs/contributors). You're encouraged to submit [pull requests](https://github.com/ruby-grape/grape/pulls), [propose features and discuss issues](https://github.com/ruby-grape/grape/issues).
#### Fork the Project
Fork the [project on Github](https://github.com/ruby-grape/grape) and check out your copy.
```
git clone https://github.com/contributor/grape.git
cd grape
git remote add upstream https://github.com/ruby-grape/grape.git
```
#### Create a Topic Branch
Make sure your fork is up-to-date and create a topic branch for your feature or bug fix.
```
git checkout master
git pull upstream master
git checkout -b my-feature-branch
```
### Docker
If you're familiar with [Docker](https://www.docker.com/), you can run everything through the following command:
```
docker-compose run --rm --build grape <command_and_parameters>
```
About the execution process:
- displays Ruby, Rubygems, Bundle and Gemfile version when starting:
```
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux-musl]
rubygems 3.4.12
Bundler version 2.4.1 (2022-12-24 commit f3175f033c)
Running default Gemfile
```
- keeps the gems to the latest possible version
- executes under `bundle exec`
Here are some examples:
- running all specs `docker-compose run --rm --build grape rspec`
- running rspec on a specific file `docker-compose run --rm --build grape rspec spec/:file_path`
- running task `docker-compose run --rm --build grape rake <task_name>`
- running rubocop `docker-compose run --rm --build grape rubocop`
- running all specs on a specific ruby version (e.g 3.4) `RUBY_VERSION=3.4 docker-compose run --rm --build grape rspec`
- running specs on a specific gemfile (e.g rails_8_1.gemfile) `docker-compose run -e GEMFILE=rails_8_1 --rm --build grape rspec`
#### Bundle Install and Test
Ensure that you can build the project and run tests.
```
bundle install
bundle exec rake
```
#### Write Tests
Try to write a test that reproduces the problem you're trying to fix or describes a feature that you want to build. Add to [spec/grape](spec/grape).
We definitely appreciate pull requests that highlight or reproduce a problem, even without a fix.
#### Write Code
Implement your feature or bug fix.
Ruby style is enforced with [Rubocop](https://github.com/bbatsov/rubocop), run `bundle exec rubocop` and fix any style issues highlighted.
Make sure that `bundle exec rake` completes without errors.
#### Write Documentation
Document any external behavior in the [README](README.md).
You should also document code as necessary, using current code as examples. This project uses [YARD](https://yardoc.org/). You can run and preview the docs locally by [installing `yard`](https://yardoc.org/), running `yard server --reload` and view the docs at http://localhost:8808.
#### Update Changelog
Add a line to [CHANGELOG](CHANGELOG.md) under *Next Release*. Make it look like every other line, including your name and link to your Github account.
#### Commit Changes
Make sure git knows your name and email address:
```
git config --global user.name "Your Name"
git config --global user.email "contributor@example.com"
```
Writing good commit logs is important. A commit log should describe what changed and why.
```
git add ...
git commit
```
#### Push
```
git push origin my-feature-branch
```
#### Make a Pull Request
Go to https://github.com/contributor/grape and select your feature branch. Click the 'Pull Request' button and fill out the form. Pull requests are usually reviewed within a few days.
#### Rebase
If you've been working on a change for a while, rebase with upstream/master.
```
git fetch upstream
git rebase upstream/master
git push origin my-feature-branch -f
```
#### Update CHANGELOG Again
Update the [CHANGELOG](CHANGELOG.md) with the pull request number. A typical entry looks as follows.
```
* [#123](https://github.com/ruby-grape/grape/pull/123): Reticulated splines - [@contributor](https://github.com/contributor).
```
Amend your previous commit and force push the changes.
```
git commit --amend
git push origin my-feature-branch -f
```
#### Check on Your Pull Request
Go back to your pull request after a few minutes and see whether it passed muster with CI. Everything should look green, otherwise fix issues and amend your commit as described above.
#### Be Patient
It's likely that your change will not be merged and that the nitpicky maintainers will ask you to do more, or fix seemingly benign problems. Hang in there!
#### Thank You
Please do know that we really appreciate and value your time and work. We love you, really.
================================================
FILE: Dangerfile
================================================
# frozen_string_literal: true
danger.import_dangerfile(gem: 'danger-pr-comment')
changelog.check!
================================================
FILE: Gemfile
================================================
# frozen_string_literal: true
source('https://rubygems.org')
gemspec
group :development, :test do
gem 'builder', require: false
gem 'bundler'
gem 'rake'
gem 'rubocop', '1.84.0', require: false
gem 'rubocop-performance', '1.26.1', require: false
gem 'rubocop-rspec', '3.9.0', require: false
end
group :development do
gem 'benchmark-ips'
gem 'benchmark-memory'
gem 'guard'
gem 'guard-rspec'
gem 'guard-rubocop'
gem 'irb'
end
group :test do
gem 'danger', require: false
gem 'danger-changelog', require: false
gem 'danger-pr-comment', require: false
gem 'rack-contrib', require: false
gem 'rack-test', '~> 2.1'
gem 'rspec', '~> 3.13'
gem 'simplecov', '~> 0.21', require: false
gem 'simplecov-lcov', '~> 0.8', require: false
end
platforms :jruby do
gem 'racc'
end
================================================
FILE: Guardfile
================================================
# frozen_string_literal: true
guard :rspec, all_on_start: true, cmd: 'bundle exec rspec' do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { 'spec' }
end
guard :rubocop do
watch(/.+\.rb$/)
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
end
================================================
FILE: LICENSE
================================================
Copyright (c) 2010-2020 Michael Bleigh, Intridea Inc. and Contributors.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
================================================
FILE: README.md
================================================

[](http://badge.fury.io/rb/grape)
[](https://github.com/ruby-grape/grape/actions/workflows/test.yml)
[](https://coveralls.io/github/ruby-grape/grape?branch=master)
## What is Grape?
Grape is a REST-like API framework for Ruby. It's designed to run on Rack or complement existing web application frameworks such as Rails and Sinatra by providing a simple DSL to easily develop RESTful APIs. It has built-in support for common conventions, including multiple formats, subdomain/prefix restriction, content negotiation, versioning and much more.
## Stable Release
You're reading the documentation for the next release of Grape, which should be 3.2.0.
The current stable release is [3.1.1](https://github.com/ruby-grape/grape/blob/v3.1.1/README.md).
## Project Resources
* [Grape Website](http://www.ruby-grape.org)
* [Documentation](http://www.rubydoc.info/gems/grape)
* Need help? [Open an Issue](https://github.com/ruby-grape/grape/issues)
* [Follow us on Twitter](https://twitter.com/grapeframework)
## Grape for Enterprise
Available as part of the Tidelift Subscription.
The maintainers of Grape are working with Tidelift to deliver commercial support and maintenance. Save time, reduce risk, and improve code health, while paying the maintainers of Grape. Click [here](https://tidelift.com/subscription/request-a-demo?utm_source=rubygems-grape&utm_medium=referral&utm_campaign=enterprise) for more details.
## Installation
Ruby 3.2 or newer is required.
Grape is available as a gem, to install it run:
bundle add grape
## Basic Usage
Grape APIs are Rack applications that are created by subclassing `Grape::API`.
Below is a simple example showing some of the more common features of Grape in the context of recreating parts of the Twitter API.
```ruby
module Twitter
class API < Grape::API
version 'v1', using: :header, vendor: 'twitter'
format :json
prefix :api
helpers do
def current_user
@current_user ||= User.authorize!(env)
end
def authenticate!
error!('401 Unauthorized', 401) unless current_user
end
end
resource :statuses do
desc 'Return a public timeline.'
get :public_timeline do
Status.limit(20)
end
desc 'Return a personal timeline.'
get :home_timeline do
authenticate!
current_user.statuses.limit(20)
end
desc 'Return a status.'
params do
requires :id, type: Integer, desc: 'Status ID.'
end
route_param :id do
get do
Status.find(params[:id])
end
end
desc 'Create a status.'
params do
requires :status, type: String, desc: 'Your status.'
end
post do
authenticate!
Status.create!({
user: current_user,
text: params[:status]
})
end
desc 'Update a status.'
params do
requires :id, type: String, desc: 'Status ID.'
requires :status, type: String, desc: 'Your status.'
end
put ':id' do
authenticate!
current_user.statuses.find(params[:id]).update({
user: current_user,
text: params[:status]
})
end
desc 'Delete a status.'
params do
requires :id, type: String, desc: 'Status ID.'
end
delete ':id' do
authenticate!
current_user.statuses.find(params[:id]).destroy
end
end
end
end
```
## Rails 7.1
Grape's [deprecator](https://api.rubyonrails.org/v7.1.0/classes/ActiveSupport/Deprecation.html) will be added to your application's deprecators [automatically](lib/grape/railtie.rb) as `:grape`, so that your application's configuration can be applied to it.
## Mounting
### All
By default Grape will compile the routes on the first route, but it is possible to pre-load routes using the `compile!` method.
```ruby
Twitter::API.compile!
```
This can be added to your `config.ru` (if using rackup), `application.rb` (if using rails), or any file that loads your server.
### Rack
The above sample creates a Rack application that can be run from a rackup `config.ru` file with `rackup`:
```ruby
run Twitter::API
```
(With pre-loading you can use)
```ruby
Twitter::API.compile!
run Twitter::API
```
And would respond to the following routes:
GET /api/statuses/public_timeline
GET /api/statuses/home_timeline
GET /api/statuses/:id
POST /api/statuses
PUT /api/statuses/:id
DELETE /api/statuses/:id
Grape will also automatically respond to HEAD and OPTIONS for all GET, and just OPTIONS for all other routes.
### Alongside Sinatra (or other frameworks)
If you wish to mount Grape alongside another Rack framework such as Sinatra, you can do so easily using `Rack::Cascade`:
```ruby
# Example config.ru
require 'sinatra'
require 'grape'
class API < Grape::API
get :hello do
{ hello: 'world' }
end
end
class Web < Sinatra::Base
get '/' do
'Hello world.'
end
end
use Rack::Session::Cookie
run Rack::Cascade.new [Web, API]
```
Note that order of loading apps using `Rack::Cascade` matters. The grape application must be last if you want to raise custom 404 errors from grape (such as `error!('Not Found',404)`). If the grape application is not last and returns 404 or 405 response, [cascade utilizes that as a signal to try the next app](https://www.rubydoc.info/gems/rack/Rack/Cascade). This may lead to undesirable behavior showing the [wrong 404 page from the wrong app](https://github.com/ruby-grape/grape/issues/1515).
### Rails
Place API files into `app/api`. Rails expects a subdirectory that matches the name of the Ruby module and a file name that matches the name of the class. In our example, the file name location and directory for `Twitter::API` should be `app/api/twitter/api.rb`.
Modify `config/routes`:
```ruby
mount Twitter::API => '/'
```
#### Zeitwerk
Rails's default autoloader is `Zeitwerk`. By default, it inflects `api` as `Api` instead of `API`. To make our example work, you need to uncomment the lines at the bottom of `config/initializers/inflections.rb`, and add `API` as an acronym:
```ruby
ActiveSupport::Inflector.inflections(:en) do |inflect|
inflect.acronym 'API'
end
```
### Modules
You can mount multiple API implementations inside another one. These don't have to be different versions, but may be components of the same API.
```ruby
class Twitter::API < Grape::API
mount Twitter::APIv1
mount Twitter::APIv2
end
```
You can also mount on a path, which is similar to using `prefix` inside the mounted API itself.
```ruby
class Twitter::API < Grape::API
mount Twitter::APIv1 => '/v1'
end
```
Declarations as `before/after/rescue_from` can be placed before or after `mount`. In any case they will be inherited.
```ruby
class Twitter::API < Grape::API
before do
header 'X-Base-Header', 'will be defined for all APIs that are mounted below'
end
rescue_from :all do
error!({ "error" => "Internal Server Error" }, 500)
end
mount Twitter::Users
mount Twitter::Search
after do
clean_cache!
end
rescue_from ZeroDivisionError do
error!({ "error" => "Not found" }, 404)
end
end
```
## Remounting
You can mount the same endpoints in two different locations.
```ruby
class Voting::API < Grape::API
namespace 'votes' do
get do
# Your logic
end
post do
# Your logic
end
end
end
class Post::API < Grape::API
mount Voting::API
end
class Comment::API < Grape::API
mount Voting::API
end
```
Assuming that the post and comment endpoints are mounted in `/posts` and `/comments`, you should now be able to do `get /posts/votes`, `post /posts/votes`, `get /comments/votes` and `post /comments/votes`.
### Mount Configuration
You can configure remountable endpoints to change how they behave according to where they are mounted.
```ruby
class Voting::API < Grape::API
namespace 'votes' do
desc "Vote for your #{configuration[:votable]}"
get do
# Your logic
end
end
end
class Post::API < Grape::API
mount Voting::API, with: { votable: 'posts' }
end
class Comment::API < Grape::API
mount Voting::API, with: { votable: 'comments' }
end
```
Note that if you're passing a hash as the first parameter to `mount`, you will need to explicitly put `()` around parameters:
```ruby
# good
mount({ ::Some::Api => '/some/api' }, with: { condition: true })
# bad
mount ::Some::Api => '/some/api', with: { condition: true }
```
You can access `configuration` on the class (to use as dynamic attributes), inside blocks (like namespace)
If you want logic happening given on an `configuration`, you can use the helper `given`.
```ruby
class ConditionalEndpoint::API < Grape::API
given configuration[:some_setting] do
get 'mount_this_endpoint_conditionally' do
configuration[:configurable_response]
end
end
end
```
If you want a block of logic running every time an endpoint is mounted (within which you can access the `configuration` Hash)
```ruby
class ConditionalEndpoint::API < Grape::API
mounted do
YourLogger.info "This API was mounted at: #{Time.now}"
get configuration[:endpoint_name] do
configuration[:configurable_response]
end
end
end
```
More complex results can be achieved by using `mounted` as an expression within which the `configuration` is already evaluated as a Hash.
```ruby
class ExpressionEndpointAPI < Grape::API
get(mounted { configuration[:route_name] || 'default_name' }) do
# some logic
end
end
```
```ruby
class BasicAPI < Grape::API
desc 'Statuses index' do
params: (configuration[:entity] || API::Entities::Status).documentation
end
params do
requires :all, using: (configuration[:entity] || API::Entities::Status).documentation
end
get '/statuses' do
statuses = Status.all
type = current_user.admin? ? :full : :default
present statuses, with: (configuration[:entity] || API::Entities::Status), type: type
end
end
class V1 < Grape::API
version 'v1'
mount BasicAPI, with: { entity: mounted { configuration[:entity] || API::Entities::Status } }
end
class V2 < Grape::API
version 'v2'
mount BasicAPI, with: { entity: mounted { configuration[:entity] || API::Entities::V2::Status } }
end
```
## Versioning
You have the option to provide various versions of your API by establishing a separate `Grape::API` class for each offered version and then integrating them into a primary `Grape::API` class. Ensure that newer versions are mounted before older ones. The default approach to versioning directs the request to the subsequent Rack middleware if a specific version is not found.
```ruby
require 'v1'
require 'v2'
require 'v3'
class App < Grape::API
mount V3
mount V2
mount V1
end
```
To maintain the same endpoints from earlier API versions without rewriting them, you can indicate multiple versions within the previous API versions.
```ruby
class V1 < Grape::API
version 'v1', 'v2', 'v3'
get '/foo' do
# your code for GET /foo
end
get '/other' do
# your code for GET /other
end
end
class V2 < Grape::API
version 'v2', 'v3'
get '/var' do
# your code for GET /var
end
end
class V3 < Grape::API
version 'v3'
get '/foo' do
# your new code for GET /foo
end
end
```
Using the example provided, the subsequent endpoints will be accessible across various versions:
```shell
GET /v1/foo
GET /v1/other
GET /v2/foo # => Same behavior as v1
GET /v2/other # => Same behavior as v1
GET /v2/var # => New endpoint not available in v1
GET /v3/foo # => Different behavior to v1 and v2
GET /v3/other # => Same behavior as v1 and v2
GET /v3/var # => Same behavior as v2
```
There are four strategies in which clients can reach your API's endpoints: `:path`, `:header`, `:accept_version_header` and `:param`. The default strategy is `:path`.
### Strategies
#### Path
```ruby
version 'v1', using: :path
```
Using this versioning strategy, clients should pass the desired version in the URL.
curl http://localhost:9292/v1/statuses/public_timeline
#### Header
```ruby
version 'v1', using: :header, vendor: 'twitter'
```
Currently, Grape only supports versioned media types in the following format:
```
vnd.vendor-and-or-resource-v1234+format
```
Basically all tokens between the final `-` and the `+` will be interpreted as the version.
Using this versioning strategy, clients should pass the desired version in the HTTP `Accept` head.
curl -H Accept:application/vnd.twitter-v1+json http://localhost:9292/statuses/public_timeline
By default, the first matching version is used when no `Accept` header is supplied. This behavior is similar to routing in Rails. To circumvent this default behavior, one could use the `:strict` option. When this option is set to `true`, a `406 Not Acceptable` error is returned when no correct `Accept` header is supplied.
When an invalid `Accept` header is supplied, a `406 Not Acceptable` error is returned if the `:cascade` option is set to `false`. Otherwise a `404 Not Found` error is returned by Rack if no other route matches.
Grape will evaluate the relative quality preference included in Accept headers and default to a quality of 1.0 when omitted. In the following example a Grape API that supports XML and JSON in that order will return JSON:
curl -H "Accept: text/xml;q=0.8, application/json;q=0.9" localhost:1234/resource
#### Accept-Version Header
```ruby
version 'v1', using: :accept_version_header
```
Using this versioning strategy, clients should pass the desired version in the HTTP `Accept-Version` header.
curl -H "Accept-Version:v1" http://localhost:9292/statuses/public_timeline
By default, the first matching version is used when no `Accept-Version` header is supplied. This behavior is similar to routing in Rails. To circumvent this default behavior, one could use the `:strict` option. When this option is set to `true`, a `406 Not Acceptable` error is returned when no correct `Accept` header is supplied and the `:cascade` option is set to `false`. Otherwise a `404 Not Found` error is returned by Rack if no other route matches.
#### Param
```ruby
version 'v1', using: :param
```
Using this versioning strategy, clients should pass the desired version as a request parameter, either in the URL query string or in the request body.
curl http://localhost:9292/statuses/public_timeline?apiver=v1
The default name for the query parameter is 'apiver' but can be specified using the `:parameter` option.
```ruby
version 'v1', using: :param, parameter: 'v'
```
curl http://localhost:9292/statuses/public_timeline?v=v1
## Linting
You can check whether your API is in conformance with the [Rack's specification](https://github.com/rack/rack/blob/main/SPEC.rdoc) by calling `lint!` at the API level or through [configuration](#configuration).
```ruby
class Api < Grape::API
lint!
end
```
```ruby
Grape.configure do |config|
config.lint = true
end
```
```ruby
Grape.config.lint = true
```
### Bug in Rack::ETag under Rack 3.X
If you're using Rack 3.X and the `Rack::Etag` middleware (used by [Rails](https://guides.rubyonrails.org/rails_on_rack.html#inspecting-middleware-stack)), a [bug](https://github.com/rack/rack/pull/2324) related to linting has been fixed in [3.1.13](https://github.com/rack/rack/blob/v3.1.13/CHANGELOG.md#3113---2025-04-13) and [3.0.15](https://github.com/rack/rack/blob/v3.1.13/CHANGELOG.md#3015---2025-04-13) respectively.
## Describing Methods
You can add a description to API methods and namespaces. The description would be used by [grape-swagger][grape-swagger] to generate swagger compliant documentation.
Note: Description block is only for documentation and won't affects API behavior.
```ruby
desc 'Returns your public timeline.' do
summary 'summary'
detail 'more details'
params API::Entities::Status.documentation
success API::Entities::Entity
failure [[401, 'Unauthorized', 'Entities::Error']]
default { code: 500, message: 'InvalidRequest', model: Entities::Error }
named 'My named route'
headers XAuthToken: {
description: 'Validates your identity',
required: true
},
XOptionalHeader: {
description: 'Not really needed',
required: false
}
hidden false
deprecated false
is_array true
nickname 'nickname'
produces ['application/json']
consumes ['application/json']
tags ['tag1', 'tag2']
end
get :public_timeline do
Status.limit(20)
end
```
* `detail`: A more enhanced description
* `params`: Define parameters directly from an `Entity`
* `success`: (former entity) The `Entity` to be used to present the success response for this route.
* `failure`: (former http_codes) A definition of the used failure HTTP Codes and Entities.
* `default`: The definition and `Entity` used to present the default response for this route.
* `named`: A helper to give a route a name and find it with this name in the documentation Hash
* `headers`: A definition of the used Headers
* Other options can be found in [grape-swagger][grape-swagger]
[grape-swagger]: https://github.com/ruby-grape/grape-swagger
## Configuration
Use `Grape.configure` to set up global settings at load time.
Currently the configurable settings are:
* `param_builder`: Sets the [Parameter Builder](#parameters), defaults to `Grape::Extensions::ActiveSupport::HashWithIndifferentAccess::ParamBuilder`.
To change a setting value make sure that at some point during load time the following code runs
```ruby
Grape.configure do |config|
config.setting = value
end
```
For example, for the `param_builder`, the following code could run in an initializer:
```ruby
Grape.configure do |config|
config.param_builder = :hashie_mash
end
```
Available parameter builders are `:hash`, `:hash_with_indifferent_access`, and `:hashie_mash`.
See [params_builder](lib/grape/params_builder).
You can also configure a single API:
```ruby
API.configure do |config|
config[key] = value
end
```
This will be available inside the API with `configuration`, as if it were [mount configuration](#mount-configuration).
## Parameters
Request parameters are available through the `params` hash object. This includes `GET`, `POST` and `PUT` parameters, along with any named parameters you specify in your route strings.
```ruby
get :public_timeline do
Status.order(params[:sort_by])
end
```
Parameters are automatically populated from the request body on `POST` and `PUT` for form input, JSON and XML content-types.
The request:
```
curl -d '{"text": "140 characters"}' 'http://localhost:9292/statuses' -H Content-Type:application/json -v
```
The Grape endpoint:
```ruby
post '/statuses' do
Status.create!(text: params[:text])
end
```
Multipart POSTs and PUTs are supported as well.
The request:
```
curl --form image_file='@image.jpg;type=image/jpg' http://localhost:9292/upload
```
The Grape endpoint:
```ruby
post 'upload' do
# file in params[:image_file]
end
```
In the case of conflict between either of:
* route string parameters
* `GET`, `POST` and `PUT` parameters
* the contents of the request body on `POST` and `PUT`
Route string parameters will have precedence.
### Params Class
By default parameters are available as `ActiveSupport::HashWithIndifferentAccess`. This can be changed to, for example, Ruby `Hash` or `Hashie::Mash` for the entire API.
```ruby
class API < Grape::API
build_with :hashie_mash
params do
optional :color, type: String
end
get do
params.color # instead of params[:color]
end
```
The class can also be overridden on individual parameter blocks using `build_with` as follows.
```ruby
params do
build_with :hash
optional :color, type: String
end
```
In the example above, `params["color"]` will return `nil` since `params` is a plain `Hash`.
Available parameter builders are `:hash`, `:hash_with_indifferent_access`, and `:hashie_mash`.
See [params_builder](lib/grape/params_builder).
### Declared
Grape allows you to access only the parameters that have been declared by your `params` block. It will:
* Filter out the params that have been passed, but are not allowed.
* Include any optional params that are declared but not passed.
* Perform any parameter renaming on the resulting hash.
Consider the following API endpoint:
````ruby
format :json
post 'users/signup' do
{ 'declared_params' => declared(params) }
end
````
If you do not specify any parameters, `declared` will return an empty hash.
**Request**
````bash
curl -X POST -H "Content-Type: application/json" localhost:9292/users/signup -d '{"user": {"first_name":"first name", "last_name": "last name"}}'
````
**Response**
````json
{
"declared_params": {}
}
````
Once we add parameters requirements, grape will start returning only the declared parameters.
````ruby
format :json
params do
optional :user, type: Hash do
optional :first_name, type: String
optional :last_name, type: String
end
end
post 'users/signup' do
{ 'declared_params' => declared(params) }
end
````
**Request**
````bash
curl -X POST -H "Content-Type: application/json" localhost:9292/users/signup -d '{"user": {"first_name":"first name", "last_name": "last name", "random": "never shown"}}'
````
**Response**
````json
{
"declared_params": {
"user": {
"first_name": "first name",
"last_name": "last name"
}
}
}
````
Missing params that are declared as type `Hash` or `Array` will be included.
````ruby
format :json
params do
optional :user, type: Hash do
optional :first_name, type: String
optional :last_name, type: String
end
optional :widgets, type: Array
end
post 'users/signup' do
{ 'declared_params' => declared(params) }
end
````
**Request**
````bash
curl -X POST -H "Content-Type: application/json" localhost:9292/users/signup -d '{}'
````
**Response**
````json
{
"declared_params": {
"user": {
"first_name": null,
"last_name": null
},
"widgets": []
}
}
````
The returned hash is an `ActiveSupport::HashWithIndifferentAccess`.
The `#declared` method is not available to `before` filters, as those are evaluated prior to parameter coercion.
### Include Parent Namespaces
By default `declared(params)` includes parameters that were defined in all parent namespaces. If you want to return only parameters from your current namespace, you can set `include_parent_namespaces` option to `false`.
````ruby
format :json
namespace :parent do
params do
requires :parent_name, type: String
end
namespace ':parent_name' do
params do
requires :child_name, type: String
end
get ':child_name' do
{
'without_parent_namespaces' => declared(params, include_parent_namespaces: false),
'with_parent_namespaces' => declared(params, include_parent_namespaces: true),
}
end
end
end
````
**Request**
````bash
curl -X GET -H "Content-Type: application/json" localhost:9292/parent/foo/bar
````
**Response**
````json
{
"without_parent_namespaces": {
"child_name": "bar"
},
"with_parent_namespaces": {
"parent_name": "foo",
"child_name": "bar"
},
}
````
### Include Missing
By default `declared(params)` includes parameters that have `nil` values. If you want to return only the parameters that are not `nil`, you can use the `include_missing` option. By default, `include_missing` is set to `true`. Consider the following API:
````ruby
format :json
params do
requires :user, type: Hash do
requires :first_name, type: String
optional :last_name, type: String
end
end
post 'users/signup' do
{ 'declared_params' => declared(params, include_missing: false) }
end
````
**Request**
````bash
curl -X POST -H "Content-Type: application/json" localhost:9292/users/signup -d '{"user": {"first_name":"first name", "random": "never shown"}}'
````
**Response with include_missing:false**
````json
{
"declared_params": {
"user": {
"first_name": "first name"
}
}
}
````
**Response with include_missing:true**
````json
{
"declared_params": {
"user": {
"first_name": "first name",
"last_name": null
}
}
}
````
It also works on nested hashes:
````ruby
format :json
params do
requires :user, type: Hash do
requires :first_name, type: String
optional :last_name, type: String
requires :address, type: Hash do
requires :city, type: String
optional :region, type: String
end
end
end
post 'users/signup' do
{ 'declared_params' => declared(params, include_missing: false) }
end
````
**Request**
````bash
curl -X POST -H "Content-Type: application/json" localhost:9292/users/signup -d '{"user": {"first_name":"first name", "random": "never shown", "address": { "city": "SF"}}}'
````
**Response with include_missing:false**
````json
{
"declared_params": {
"user": {
"first_name": "first name",
"address": {
"city": "SF"
}
}
}
}
````
**Response with include_missing:true**
````json
{
"declared_params": {
"user": {
"first_name": "first name",
"last_name": null,
"address": {
"city": "Zurich",
"region": null
}
}
}
}
````
Note that an attribute with a `nil` value is not considered *missing* and will also be returned when `include_missing` is set to `false`:
**Request**
````bash
curl -X POST -H "Content-Type: application/json" localhost:9292/users/signup -d '{"user": {"first_name":"first name", "last_name": null, "address": { "city": "SF"}}}'
````
**Response with include_missing:false**
````json
{
"declared_params": {
"user": {
"first_name": "first name",
"last_name": null,
"address": { "city": "SF"}
}
}
}
````
### Evaluate Given
By default `declared(params)` will not evaluate `given` and return all parameters. Use `evaluate_given` to evaluate all `given` blocks and return only parameters that satisfy `given` conditions. Consider the following API:
````ruby
format :json
params do
optional :child_id, type: Integer
given :child_id do
requires :father_id, type: Integer
end
end
post 'child' do
{ 'declared_params' => declared(params, evaluate_given: true) }
end
````
**Request**
````bash
curl -X POST -H "Content-Type: application/json" localhost:9292/child -d '{"father_id": 1}'
````
**Response with evaluate_given:false**
````json
{
"declared_params": {
"child_id": null,
"father_id": 1
}
}
````
**Response with evaluate_given:true**
````json
{
"declared_params": {
"child_id": null
}
}
````
It also works on nested hashes:
````ruby
format :json
params do
requires :child, type: Hash do
optional :child_id, type: Integer
given :child_id do
requires :father_id, type: Integer
end
end
end
post 'child' do
{ 'declared_params' => declared(params, evaluate_given: true) }
end
````
**Request**
````bash
curl -X POST -H "Content-Type: application/json" localhost:9292/child -d '{"child": {"father_id": 1}}'
````
**Response with evaluate_given:false**
````json
{
"declared_params": {
"child": {
"child_id": null,
"father_id": 1
}
}
}
````
**Response with evaluate_given:true**
````json
{
"declared_params": {
"child": {
"child_id": null
}
}
}
````
### Parameter Precedence
Using `route_param` takes higher precedence over a regular parameter defined with same name:
```ruby
params do
requires :foo, type: String
end
route_param :foo do
get do
{ value: params[:foo] }
end
end
```
**Request**
```bash
curl -X POST -H "Content-Type: application/json" localhost:9292/bar -d '{"foo": "baz"}'
```
**Response**
```json
{
"value": "bar"
}
```
## Parameter Validation and Coercion
You can define validations and coercion options for your parameters using a `params` block.
```ruby
params do
requires :id, type: Integer
optional :text, type: String, regexp: /\A[a-z]+\z/
group :media, type: Hash do
requires :url
end
optional :audio, type: Hash do
requires :format, type: Symbol, values: [:mp3, :wav, :aac, :ogg], default: :mp3
end
mutually_exclusive :media, :audio
end
put ':id' do
# params[:id] is an Integer
end
```
When a type is specified an implicit validation is done after the coercion to ensure the output type is the one declared.
Optional parameters can have a default value.
```ruby
params do
optional :color, type: String, default: 'blue'
optional :random_number, type: Integer, default: -> { Random.rand(1..100) }
optional :non_random_number, type: Integer, default: Random.rand(1..100)
end
```
Default values are eagerly evaluated. Above `:non_random_number` will evaluate to the same number for each call to the endpoint of this `params` block. To have the default evaluate lazily with each request use a lambda, like `:random_number` above.
Note that default values will be passed through to any validation options specified.
The following example will always fail if `:color` is not explicitly provided.
```ruby
params do
optional :color, type: String, default: 'blue', values: ['red', 'green']
end
```
The correct implementation is to ensure the default value passes all validations.
```ruby
params do
optional :color, type: String, default: 'blue', values: ['blue', 'red', 'green']
end
```
You can use the value of one parameter as the default value of some other parameter. In this case, if the `primary_color` parameter is not provided, it will have the same value as the `color` one. If both of them not provided, both of them will have `blue` value.
```ruby
params do
optional :color, type: String, default: 'blue'
optional :primary_color, type: String, default: -> (params) { params[:color] }
end
```
### Supported Parameter Types
The following are all valid types, supported out of the box by Grape:
* Integer
* Float
* BigDecimal
* Numeric
* Date
* DateTime
* Time
* Boolean
* String
* Symbol
* Rack::Multipart::UploadedFile (alias `File`)
* JSON
### Integer/Fixnum and Coercions
Please be aware that the behavior differs between Ruby 2.4 and earlier versions.
In Ruby 2.4, values consisting of numbers are converted to Integer, but in earlier versions it will be treated as Fixnum.
```ruby
params do
requires :integers, type: Hash do
requires :int, coerce: Integer
end
end
get '/int' do
params[:integers][:int].class
end
...
get '/int' integers: { int: '45' }
#=> Integer in ruby 2.4
#=> Fixnum in earlier ruby versions
```
### Custom Types and Coercions
Aside from the default set of supported types listed above, any class can be used as a type as long as an explicit coercion method is supplied. If the type implements a class-level `parse` method, Grape will use it automatically. This method must take one string argument and return an instance of the correct type, or return an instance of `Grape::Types::InvalidValue` which optionally accepts a message to be returned in the response.
```ruby
class Color
attr_reader :value
def initialize(color)
@value = color
end
def self.parse(value)
return new(value) if %w[blue red green].include?(value)
Grape::Types::InvalidValue.new('Unsupported color')
end
end
params do
requires :color, type: Color, default: Color.new('blue')
requires :more_colors, type: Array[Color] # Collections work
optional :unique_colors, type: Set[Color] # Duplicates discarded
end
get '/stuff' do
# params[:color] is already a Color.
params[:color].value
end
```
Alternatively, a custom coercion method may be supplied for any type of parameter using `coerce_with`. Any class or object may be given that implements a `parse` or `call` method, in that order of precedence. The method must accept a single string parameter, and the return value must match the given `type`.
```ruby
params do
requires :passwd, type: String, coerce_with: Base64.method(:decode64)
requires :loud_color, type: Color, coerce_with: ->(c) { Color.parse(c.downcase) }
requires :obj, type: Hash, coerce_with: JSON do
requires :words, type: Array[String], coerce_with: ->(val) { val.split(/\s+/) }
optional :time, type: Time, coerce_with: Chronic
end
end
```
Note that, a `nil` value will call the custom coercion method, while a missing parameter will not.
Example of use of `coerce_with` with a lambda (a class with a `parse` method could also have been used)
It will parse a string and return an Array of Integers, matching the `Array[Integer]` `type`.
```ruby
params do
requires :values, type: Array[Integer], coerce_with: ->(val) { val.split(/\s+/).map(&:to_i) }
end
```
Grape will assert that coerced values match the given `type`, and will reject the request if they do not. To override this behaviour, custom types may implement a `parsed?` method that should accept a single argument and return `true` if the value passes type validation.
```ruby
class SecureUri
def self.parse(value)
URI.parse value
end
def self.parsed?(value)
value.is_a? URI::HTTPS
end
end
params do
requires :secure_uri, type: SecureUri
end
```
### Multipart File Parameters
Grape makes use of `Rack::Request`'s built-in support for multipart file parameters. Such parameters can be declared with `type: File`:
```ruby
params do
requires :avatar, type: File
end
post '/' do
params[:avatar][:filename] # => 'avatar.png'
params[:avatar][:type] # => 'image/png'
params[:avatar][:tempfile] # => #<File>
end
```
### First-Class `JSON` Types
Grape supports complex parameters given as JSON-formatted strings using the special `type: JSON` declaration. JSON objects and arrays of objects are accepted equally, with nested validation rules applied to all objects in either case:
```ruby
params do
requires :json, type: JSON do
requires :int, type: Integer, values: [1, 2, 3]
end
end
get '/' do
params[:json].inspect
end
client.get('/', json: '{"int":1}') # => "{:int=>1}"
client.get('/', json: '[{"int":"1"}]') # => "[{:int=>1}]"
client.get('/', json: '{"int":4}') # => HTTP 400
client.get('/', json: '[{"int":4}]') # => HTTP 400
```
Additionally `type: Array[JSON]` may be used, which explicitly marks the parameter as an array of objects. If a single object is supplied it will be wrapped.
```ruby
params do
requires :json, type: Array[JSON] do
requires :int, type: Integer
end
end
get '/' do
params[:json].each { |obj| ... } # always works
end
```
For stricter control over the type of JSON structure which may be supplied, use `type: Array, coerce_with: JSON` or `type: Hash, coerce_with: JSON`.
### Multiple Allowed Types
Variant-type parameters can be declared using the `types` option rather than `type`:
```ruby
params do
requires :status_code, types: [Integer, String, Array[Integer, String]]
end
get '/' do
params[:status_code].inspect
end
client.get('/', status_code: 'OK_GOOD') # => "OK_GOOD"
client.get('/', status_code: 300) # => 300
client.get('/', status_code: %w(404 NOT FOUND)) # => [404, "NOT", "FOUND"]
```
As a special case, variant-member-type collections may also be declared, by passing a `Set` or `Array` with more than one member to `type`:
```ruby
params do
requires :status_codes, type: Array[Integer,String]
end
get '/' do
params[:status_codes].inspect
end
client.get('/', status_codes: %w(1 two)) # => [1, "two"]
```
### Validation of Nested Parameters
Parameters can be nested using `group` or by calling `requires` or `optional` with a block.
In the [above example](#parameter-validation-and-coercion), this means `params[:media][:url]` is required along with `params[:id]`, and `params[:audio][:format]` is required only if `params[:audio]` is present.
With a block, `group`, `requires` and `optional` accept an additional option `type` which can be either `Array` or `Hash`, and defaults to `Array`. Depending on the value, the nested parameters will be treated either as values of a hash or as values of hashes in an array.
```ruby
params do
optional :preferences, type: Array do
requires :key
requires :value
end
requires :name, type: Hash do
requires :first_name
requires :last_name
end
end
```
### Dependent Parameters
Suppose some of your parameters are only relevant if another parameter is given; Grape allows you to express this relationship through the `given` method in your parameters block, like so:
```ruby
params do
optional :shelf_id, type: Integer
given :shelf_id do
requires :bin_id, type: Integer
end
end
```
In the example above Grape will use `blank?` to check whether the `shelf_id` param is present.
`given` also takes a `Proc` with custom code. Below, the param `description` is required only if the value of `category` is equal `foo`:
```ruby
params do
optional :category
given category: ->(val) { val == 'foo' } do
requires :description
end
end
```
You can rename parameters:
```ruby
params do
optional :category, as: :type
given type: ->(val) { val == 'foo' } do
requires :description
end
end
```
Note: param in `given` should be the renamed one. In the example, it should be `type`, not `category`.
### Group Options
Parameters options can be grouped. It can be useful if you want to extract common validation or types for several parameters.
Within these groups, individual parameters can extend or selectively override the common settings, allowing you to maintain the defaults at the group level while still applying parameter-specific rules where necessary.
The example below presents a typical case when parameters share common options.
```ruby
params do
requires :first_name, type: String, regexp: /w+/, desc: 'First name', documentation: { in: 'body' }
optional :middle_name, type: String, regexp: /w+/, desc: 'Middle name', documentation: { in: 'body', x: { nullable: true } }
requires :last_name, type: String, regexp: /w+/, desc: 'Last name', documentation: { in: 'body' }
end
```
Grape allows you to present the same logic through the `with` method in your parameters block, like so:
```ruby
params do
with(type: String, regexp: /w+/, documentation: { in: 'body' }) do
requires :first_name, desc: 'First name'
optional :middle_name, desc: 'Middle name', documentation: { x: { nullable: true } }
requires :last_name, desc: 'Last name'
end
end
```
You can organize settings into layers using nested `with' blocks. Each layer can use, add to, or change the settings of the layer above it. This helps to keep complex parameters organized and consistent, while still allowing for specific customizations to be made.
```ruby
params do
with(documentation: { in: 'body' }) do # Applies documentation to all nested parameters
with(type: String, regexp: /\w+/) do # Applies type and validation to names
requires :first_name, desc: 'First name'
requires :last_name, desc: 'Last name'
end
optional :age, type: Integer, desc: 'Age', documentation: { x: { nullable: true } } # Specific settings for 'age'
end
end
```
### Renaming
You can rename parameters using `as`, which can be useful when refactoring existing APIs:
```ruby
resource :users do
params do
requires :email_address, as: :email
requires :password
end
post do
User.create!(declared(params)) # User takes email and password
end
end
```
The value passed to `as` will be the key when calling `declared(params)`.
### Built-in Validators
#### `allow_blank`
Parameters can be defined as `allow_blank`, ensuring that they contain a value. By default, `requires` only validates that a parameter was sent in the request, regardless its value. With `allow_blank: false`, empty values or whitespace only values are invalid.
`allow_blank` can be combined with both `requires` and `optional`. If the parameter is required, it has to contain a value. If it's optional, it's possible to not send it in the request, but if it's being sent, it has to have some value, and not an empty string/only whitespaces.
```ruby
params do
requires :username, allow_blank: false
optional :first_name, allow_blank: false
end
```
#### `values`
Parameters can be restricted to a specific set of values with the `:values` option.
```ruby
params do
requires :status, type: Symbol, values: [:not_started, :processing, :done]
optional :numbers, type: Array[Integer], default: 1, values: [1, 2, 3, 5, 8]
end
```
Supplying a range to the `:values` option ensures that the parameter is (or parameters are) included in that range (using `Range#include?`).
```ruby
params do
requires :latitude, type: Float, values: -90.0..+90.0
requires :longitude, type: Float, values: -180.0..+180.0
optional :letters, type: Array[String], values: 'a'..'z'
end
```
Note endless ranges are also supported with ActiveSupport >= 6.0, but they require that the type be provided.
```ruby
params do
requires :minimum, type: Integer, values: 10..
optional :maximum, type: Integer, values: ..10
end
```
Note that *both* range endpoints have to be a `#kind_of?` your `:type` option (if you don't supply the `:type` option, it will be guessed to be equal to the class of the range's first endpoint). So the following is invalid:
```ruby
params do
requires :invalid1, type: Float, values: 0..10 # 0.kind_of?(Float) => false
optional :invalid2, values: 0..10.0 # 10.0.kind_of?(0.class) => false
end
```
The `:values` option can also be supplied with a `Proc`, evaluated lazily with each request.
If the Proc has arity zero (i.e. it takes no arguments) it is expected to return either a list or a range which will then be used to validate the parameter.
For example, given a status model you may want to restrict by hashtags that you have previously defined in the `HashTag` model.
```ruby
params do
requires :hashtag, type: String, values: -> { Hashtag.all.map(&:tag) }
end
```
Alternatively, a Proc with arity one (i.e. taking one argument) can be used to explicitly validate each parameter value. In that case, the Proc is expected to return a truthy value if the parameter value is valid. The parameter will be considered invalid if the Proc returns a falsy value or if it raises a StandardError.
```ruby
params do
requires :number, type: Integer, values: ->(v) { v.even? && v < 25 }
end
```
While Procs are convenient for single cases, consider using [Custom Validators](#custom-validators) in cases where a validation is used more than once.
Note that [allow_blank](#allow_blank) validator applies while using `:values`. In the following example the absence of `:allow_blank` does not prevent `:state` from receiving blank values because `:allow_blank` defaults to `true`.
```ruby
params do
requires :state, type: Symbol, values: [:active, :inactive]
end
```
#### `except_values`
Parameters can be restricted from having a specific set of values with the `:except_values` option.
The `except_values` validator behaves similarly to the `values` validator in that it accepts either an Array, a Range, or a Proc. Unlike the `values` validator, however, `except_values` only accepts Procs with arity zero.
```ruby
params do
requires :browser, except_values: [ 'ie6', 'ie7', 'ie8' ]
requires :port, except_values: { value: 0..1024, message: 'is not allowed' }
requires :hashtag, except_values: -> { Hashtag.FORBIDDEN_LIST }
end
```
#### `same_as`
A `same_as` option can be given to ensure that values of parameters match.
```ruby
params do
requires :password
requires :password_confirmation, same_as: :password
end
```
#### `length`
Parameters with types that support `#length` method can be restricted to have a specific length with the `:length` option.
The validator accepts `:min` or `:max` or both options or only `:is` to validate that the value of the parameter is within the given limits.
```ruby
params do
requires :code, type: String, length: { is: 2 }
requires :str, type: String, length: { min: 3 }
requires :list, type: [Integer], length: { min: 3, max: 5 }
requires :hash, type: Hash, length: { max: 5 }
end
```
#### `regexp`
Parameters can be restricted to match a specific regular expression with the `:regexp` option. If the value does not match the regular expression an error will be returned. Note that this is true for both `requires` and `optional` parameters.
```ruby
params do
requires :email, regexp: /.+@.+/
end
```
The validator will pass if the parameter was sent without value. To ensure that the parameter contains a value, use `allow_blank: false`.
```ruby
params do
requires :email, allow_blank: false, regexp: /.+@.+/
end
```
#### `mutually_exclusive`
Parameters can be defined as `mutually_exclusive`, ensuring that they aren't present at the same time in a request.
```ruby
params do
optional :beer
optional :wine
mutually_exclusive :beer, :wine
end
```
Multiple sets can be defined:
```ruby
params do
optional :beer
optional :wine
mutually_exclusive :beer, :wine
optional :scotch
optional :aquavit
mutually_exclusive :scotch, :aquavit
end
```
**Warning**: Never define mutually exclusive sets with any required params. Two mutually exclusive required params will mean params are never valid, thus making the endpoint useless. One required param mutually exclusive with an optional param will mean the latter is never valid.
#### `exactly_one_of`
Parameters can be defined as 'exactly_one_of', ensuring that exactly one parameter gets selected.
```ruby
params do
optional :beer
optional :wine
exactly_one_of :beer, :wine
end
```
Note that using `:default` with `mutually_exclusive` will cause multiple parameters to always have a default value and raise a `Grape::Exceptions::Validation` mutually exclusive exception.
#### `at_least_one_of`
Parameters can be defined as 'at_least_one_of', ensuring that at least one parameter gets selected.
```ruby
params do
optional :beer
optional :wine
optional :juice
at_least_one_of :beer, :wine, :juice
end
```
#### `all_or_none_of`
Parameters can be defined as 'all_or_none_of', ensuring that all or none of parameters gets selected.
```ruby
params do
optional :beer
optional :wine
optional :juice
all_or_none_of :beer, :wine, :juice
end
```
#### Nested `mutually_exclusive`, `exactly_one_of`, `at_least_one_of`, `all_or_none_of`
All of these methods can be used at any nested level.
```ruby
params do
requires :food, type: Hash do
optional :meat
optional :fish
optional :rice
at_least_one_of :meat, :fish, :rice
end
group :drink, type: Hash do
optional :beer
optional :wine
optional :juice
exactly_one_of :beer, :wine, :juice
end
optional :dessert, type: Hash do
optional :cake
optional :icecream
mutually_exclusive :cake, :icecream
end
optional :recipe, type: Hash do
optional :oil
optional :meat
all_or_none_of :oil, :meat
end
end
```
### Namespace Validation and Coercion
Namespaces allow parameter definitions and apply to every method within the namespace.
```ruby
namespace :statuses do
params do
requires :user_id, type: Integer, desc: 'A user ID.'
end
namespace ':user_id' do
desc "Retrieve a user's status."
params do
requires :status_id, type: Integer, desc: 'A status ID.'
end
get ':status_id' do
User.find(params[:user_id]).statuses.find(params[:status_id])
end
end
end
```
The `namespace` method has a number of aliases, including: `group`, `resource`, `resources`, and `segment`. Use whichever reads the best for your API.
You can conveniently define a route parameter as a namespace using `route_param`.
```ruby
namespace :statuses do
route_param :id do
desc 'Returns all replies for a status.'
get 'replies' do
Status.find(params[:id]).replies
end
desc 'Returns a status.'
get do
Status.find(params[:id])
end
end
end
```
You can also define a route parameter type by passing to `route_param`'s options.
```ruby
namespace :arithmetic do
route_param :n, type: Integer do
desc 'Returns in power'
get 'power' do
params[:n] ** params[:n]
end
end
end
```
### Custom Validators
```ruby
class AlphaNumeric < Grape::Validations::Validators::Base
def validate_param!(attr_name, params)
unless params[attr_name] =~ /\A[[:alnum:]]+\z/
raise Grape::Exceptions::Validation.new params: [@scope.full_name(attr_name)], message: 'must consist of alpha-numeric characters'
end
end
end
```
```ruby
params do
requires :text, alpha_numeric: true
end
```
You can also create custom classes that take parameters.
```ruby
class Length < Grape::Validations::Validators::Base
def validate_param!(attr_name, params)
unless params[attr_name].length <= @option
raise Grape::Exceptions::Validation.new params: [@scope.full_name(attr_name)], message: "must be at the most #{@option} characters long"
end
end
end
```
```ruby
params do
requires :text, length: 140
end
```
You can also create custom validation that use request to validate the attribute. For example if you want to have parameters that are available to only admins, you can do the following.
```ruby
class Admin < Grape::Validations::Validators::Base
def validate(request)
# return if the param we are checking was not in request
# @attrs is a list containing the attribute we are currently validating
# in our sample case this method once will get called with
# @attrs being [:admin_field] and once with @attrs being [:admin_false_field]
return unless request.params.key?(@attrs.first)
# check if admin flag is set to true
return unless @option
# check if user is admin or not
# as an example get a token from request and check if it's admin or not
raise Grape::Exceptions::Validation.new params: @attrs, message: 'Can not set admin-only field.' unless request.headers['X-Access-Token'] == 'admin'
end
end
```
And use it in your endpoint definition as:
```ruby
params do
optional :admin_field, type: String, admin: true
optional :non_admin_field, type: String
optional :admin_false_field, type: String, admin: false
end
```
Every validation will have its own instance of the validator, which means that the validator can have a state.
### Validation Errors
Validation and coercion errors are collected and an exception of type `Grape::Exceptions::ValidationErrors` is raised. If the exception goes uncaught it will respond with a status of 400 and an error message. The validation errors are grouped by parameter name and can be accessed via `Grape::Exceptions::ValidationErrors#errors`.
The default response from a `Grape::Exceptions::ValidationErrors` is a humanly readable string, such as "beer, wine are mutually exclusive", in the following example.
```ruby
params do
optional :beer
optional :wine
optional :juice
exactly_one_of :beer, :wine, :juice
end
```
You can rescue a `Grape::Exceptions::ValidationErrors` and respond with a custom response or turn the response into well-formatted JSON for a JSON API that separates individual parameters and the corresponding error messages. The following `rescue_from` example produces `[{"params":["beer","wine"],"messages":["are mutually exclusive"]}]`.
```ruby
format :json
subject.rescue_from Grape::Exceptions::ValidationErrors do |e|
error! e, 400
end
```
`Grape::Exceptions::ValidationErrors#full_messages` returns the validation messages as an array. `Grape::Exceptions::ValidationErrors#message` joins the messages to one string.
For responding with an array of validation messages, you can use `Grape::Exceptions::ValidationErrors#full_messages`.
```ruby
format :json
subject.rescue_from Grape::Exceptions::ValidationErrors do |e|
error!({ messages: e.full_messages }, 400)
end
```
Grape returns all validation and coercion errors found by default.
To skip all subsequent validation checks when a specific param is found invalid, use `fail_fast: true`.
The following example will not check if `:wine` is present unless it finds `:beer`.
```ruby
params do
required :beer, fail_fast: true
required :wine
end
```
The result of empty params would be a single `Grape::Exceptions::ValidationErrors` error.
Similarly, no regular expression test will be performed if `:blah` is blank in the following example.
```ruby
params do
required :blah, allow_blank: false, regexp: /blah/, fail_fast: true
end
```
### I18n
Grape supports I18n for parameter-related error messages, but will fallback to English if translations for the default locale have not been provided. See [en.yml](lib/grape/locale/en.yml) for message keys.
In case your app enforces available locales only and :en is not included in your available locales, Grape cannot fall back to English and will return the translation key for the error message. To avoid this behaviour, either provide a translation for your default locale or add :en to your available locales.
Custom validators that inherit from `Grape::Validations::Validators::Base` have access to a `translate` helper (see `Grape::Util::Translation`) and should use it instead of calling `I18n` directly. It applies the same `:en` fallback as built-in validators, defaults `scope` to `'grape.errors.messages'`, and handles interpolation without needing `format`:
```ruby
# Good — scope defaults to 'grape.errors.messages', interpolation forwarded automatically
translate(:special, min: 2, max: 10)
# Bad — format is unnecessary and risks conflicting with I18n reserved keys
format I18n.t(:special, scope: 'grape.errors.messages'), min: 2, max: 10
```
Example custom validator:
```ruby
class SpecialValidator < Grape::Validations::Validators::Base
def validate_param!(attr_name, params)
return if valid?(params[attr_name])
raise Grape::Exceptions::Validation.new(
params: [@scope.full_name(attr_name)],
message: translate(:special, min: 2, max: 10)
)
end
end
```
### Custom Validation messages
G
gitextract_tszz0ncs/
├── .coveralls.yml
├── .dockerignore
├── .github/
│ ├── FUNDING.yml
│ └── workflows/
│ ├── danger-comment.yml
│ ├── danger.yml
│ ├── edge.yml
│ └── test.yml
├── .gitignore
├── .rspec
├── .rubocop.yml
├── .rubocop_todo.yml
├── .simplecov
├── .yardopts
├── CHANGELOG.md
├── CONTRIBUTING.md
├── Dangerfile
├── Gemfile
├── Guardfile
├── LICENSE
├── README.md
├── RELEASING.md
├── Rakefile
├── SECURITY.md
├── UPGRADING.md
├── benchmark/
│ ├── compile_many_routes.rb
│ ├── issue_mounting.rb
│ ├── large_model.rb
│ ├── nested_params.rb
│ ├── remounting.rb
│ ├── resource/
│ │ └── vrp_example.json
│ └── simple.rb
├── docker/
│ ├── Dockerfile
│ └── entrypoint.sh
├── docker-compose.yml
├── gemfiles/
│ ├── dry_validation.gemfile
│ ├── grape_entity.gemfile
│ ├── hashie.gemfile
│ ├── multi_json.gemfile
│ ├── multi_xml.gemfile
│ ├── rack_2_2.gemfile
│ ├── rack_3_0.gemfile
│ ├── rack_3_1.gemfile
│ ├── rack_3_2.gemfile
│ ├── rack_edge.gemfile
│ ├── rails_7_2.gemfile
│ ├── rails_8_0.gemfile
│ ├── rails_8_1.gemfile
│ └── rails_edge.gemfile
├── grape.gemspec
├── lib/
│ ├── grape/
│ │ ├── api/
│ │ │ └── instance.rb
│ │ ├── api.rb
│ │ ├── content_types.rb
│ │ ├── cookies.rb
│ │ ├── declared_params_handler.rb
│ │ ├── dry_types.rb
│ │ ├── dsl/
│ │ │ ├── callbacks.rb
│ │ │ ├── declared.rb
│ │ │ ├── desc.rb
│ │ │ ├── headers.rb
│ │ │ ├── helpers.rb
│ │ │ ├── inside_route.rb
│ │ │ ├── logger.rb
│ │ │ ├── middleware.rb
│ │ │ ├── parameters.rb
│ │ │ ├── request_response.rb
│ │ │ ├── routing.rb
│ │ │ ├── settings.rb
│ │ │ └── validations.rb
│ │ ├── endpoint.rb
│ │ ├── env.rb
│ │ ├── error_formatter/
│ │ │ ├── base.rb
│ │ │ ├── json.rb
│ │ │ ├── serializable_hash.rb
│ │ │ ├── txt.rb
│ │ │ └── xml.rb
│ │ ├── error_formatter.rb
│ │ ├── exceptions/
│ │ │ ├── base.rb
│ │ │ ├── conflicting_types.rb
│ │ │ ├── empty_message_body.rb
│ │ │ ├── incompatible_option_values.rb
│ │ │ ├── invalid_accept_header.rb
│ │ │ ├── invalid_formatter.rb
│ │ │ ├── invalid_message_body.rb
│ │ │ ├── invalid_parameters.rb
│ │ │ ├── invalid_response.rb
│ │ │ ├── invalid_version_header.rb
│ │ │ ├── invalid_versioner_option.rb
│ │ │ ├── invalid_with_option_for_represent.rb
│ │ │ ├── method_not_allowed.rb
│ │ │ ├── missing_group_type.rb
│ │ │ ├── missing_mime_type.rb
│ │ │ ├── missing_vendor_option.rb
│ │ │ ├── too_deep_parameters.rb
│ │ │ ├── too_many_multipart_files.rb
│ │ │ ├── unknown_auth_strategy.rb
│ │ │ ├── unknown_parameter.rb
│ │ │ ├── unknown_params_builder.rb
│ │ │ ├── unknown_validator.rb
│ │ │ ├── unsupported_group_type.rb
│ │ │ ├── validation.rb
│ │ │ ├── validation_array_errors.rb
│ │ │ └── validation_errors.rb
│ │ ├── formatter/
│ │ │ ├── base.rb
│ │ │ ├── json.rb
│ │ │ ├── serializable_hash.rb
│ │ │ ├── txt.rb
│ │ │ └── xml.rb
│ │ ├── formatter.rb
│ │ ├── json.rb
│ │ ├── locale/
│ │ │ └── en.yml
│ │ ├── middleware/
│ │ │ ├── auth/
│ │ │ │ ├── base.rb
│ │ │ │ ├── dsl.rb
│ │ │ │ ├── strategies.rb
│ │ │ │ └── strategy_info.rb
│ │ │ ├── base.rb
│ │ │ ├── error.rb
│ │ │ ├── filter.rb
│ │ │ ├── formatter.rb
│ │ │ ├── globals.rb
│ │ │ ├── stack.rb
│ │ │ ├── versioner/
│ │ │ │ ├── accept_version_header.rb
│ │ │ │ ├── base.rb
│ │ │ │ ├── header.rb
│ │ │ │ ├── param.rb
│ │ │ │ └── path.rb
│ │ │ └── versioner.rb
│ │ ├── namespace.rb
│ │ ├── params_builder/
│ │ │ ├── base.rb
│ │ │ ├── hash.rb
│ │ │ ├── hash_with_indifferent_access.rb
│ │ │ └── hashie_mash.rb
│ │ ├── params_builder.rb
│ │ ├── parser/
│ │ │ ├── base.rb
│ │ │ ├── json.rb
│ │ │ └── xml.rb
│ │ ├── parser.rb
│ │ ├── path.rb
│ │ ├── presenters/
│ │ │ └── presenter.rb
│ │ ├── railtie.rb
│ │ ├── request.rb
│ │ ├── router/
│ │ │ ├── base_route.rb
│ │ │ ├── greedy_route.rb
│ │ │ ├── pattern.rb
│ │ │ └── route.rb
│ │ ├── router.rb
│ │ ├── serve_stream/
│ │ │ ├── file_body.rb
│ │ │ ├── sendfile_response.rb
│ │ │ └── stream_response.rb
│ │ ├── util/
│ │ │ ├── api_description.rb
│ │ │ ├── base_inheritable.rb
│ │ │ ├── cache.rb
│ │ │ ├── endpoint_configuration.rb
│ │ │ ├── header.rb
│ │ │ ├── inheritable_setting.rb
│ │ │ ├── inheritable_values.rb
│ │ │ ├── lazy/
│ │ │ │ ├── block.rb
│ │ │ │ ├── value.rb
│ │ │ │ ├── value_array.rb
│ │ │ │ ├── value_enumerable.rb
│ │ │ │ └── value_hash.rb
│ │ │ ├── media_type.rb
│ │ │ ├── registry.rb
│ │ │ ├── reverse_stackable_values.rb
│ │ │ ├── stackable_values.rb
│ │ │ └── translation.rb
│ │ ├── validations/
│ │ │ ├── attributes_iterator.rb
│ │ │ ├── contract_scope.rb
│ │ │ ├── multiple_attributes_iterator.rb
│ │ │ ├── param_scope_tracker.rb
│ │ │ ├── params_documentation.rb
│ │ │ ├── params_scope.rb
│ │ │ ├── single_attribute_iterator.rb
│ │ │ ├── types/
│ │ │ │ ├── array_coercer.rb
│ │ │ │ ├── custom_type_coercer.rb
│ │ │ │ ├── custom_type_collection_coercer.rb
│ │ │ │ ├── dry_type_coercer.rb
│ │ │ │ ├── file.rb
│ │ │ │ ├── invalid_value.rb
│ │ │ │ ├── json.rb
│ │ │ │ ├── multiple_type_coercer.rb
│ │ │ │ ├── primitive_coercer.rb
│ │ │ │ ├── set_coercer.rb
│ │ │ │ └── variant_collection_coercer.rb
│ │ │ ├── types.rb
│ │ │ ├── validator_factory.rb
│ │ │ └── validators/
│ │ │ ├── all_or_none_of_validator.rb
│ │ │ ├── allow_blank_validator.rb
│ │ │ ├── as_validator.rb
│ │ │ ├── at_least_one_of_validator.rb
│ │ │ ├── base.rb
│ │ │ ├── coerce_validator.rb
│ │ │ ├── contract_scope_validator.rb
│ │ │ ├── default_validator.rb
│ │ │ ├── exactly_one_of_validator.rb
│ │ │ ├── except_values_validator.rb
│ │ │ ├── length_validator.rb
│ │ │ ├── multiple_params_base.rb
│ │ │ ├── mutually_exclusive_validator.rb
│ │ │ ├── presence_validator.rb
│ │ │ ├── regexp_validator.rb
│ │ │ ├── same_as_validator.rb
│ │ │ └── values_validator.rb
│ │ ├── validations.rb
│ │ ├── version.rb
│ │ └── xml.rb
│ └── grape.rb
└── spec/
├── grape/
│ ├── api/
│ │ ├── custom_validations_spec.rb
│ │ ├── deeply_included_options_spec.rb
│ │ ├── defines_boolean_in_params_spec.rb
│ │ ├── documentation_spec.rb
│ │ ├── inherited_helpers_spec.rb
│ │ ├── instance_spec.rb
│ │ ├── invalid_format_spec.rb
│ │ ├── mount_and_helpers_order_spec.rb
│ │ ├── mount_and_rescue_from_spec.rb
│ │ ├── mounted_helpers_inheritance_spec.rb
│ │ ├── namespace_parameters_in_route_spec.rb
│ │ ├── nested_helpers_spec.rb
│ │ ├── optional_parameters_in_route_spec.rb
│ │ ├── parameters_modification_spec.rb
│ │ ├── patch_method_helpers_spec.rb
│ │ ├── recognize_path_spec.rb
│ │ ├── required_parameters_in_route_spec.rb
│ │ ├── required_parameters_with_invalid_method_spec.rb
│ │ ├── routes_with_requirements_spec.rb
│ │ ├── shared_helpers_exactly_one_of_spec.rb
│ │ └── shared_helpers_spec.rb
│ ├── api_remount_spec.rb
│ ├── api_spec.rb
│ ├── content_types_spec.rb
│ ├── dsl/
│ │ ├── callbacks_spec.rb
│ │ ├── desc_spec.rb
│ │ ├── headers_spec.rb
│ │ ├── helpers_spec.rb
│ │ ├── inside_route_spec.rb
│ │ ├── logger_spec.rb
│ │ ├── middleware_spec.rb
│ │ ├── parameters_spec.rb
│ │ ├── request_response_spec.rb
│ │ ├── routing_spec.rb
│ │ ├── settings_spec.rb
│ │ └── validations_spec.rb
│ ├── endpoint/
│ │ └── declared_spec.rb
│ ├── endpoint_spec.rb
│ ├── exceptions/
│ │ ├── base_spec.rb
│ │ ├── body_parse_errors_spec.rb
│ │ ├── invalid_accept_header_spec.rb
│ │ ├── invalid_formatter_spec.rb
│ │ ├── invalid_response_spec.rb
│ │ ├── invalid_versioner_option_spec.rb
│ │ ├── missing_group_type_spec.rb
│ │ ├── missing_mime_type_spec.rb
│ │ ├── unknown_validator_spec.rb
│ │ ├── unsupported_group_type_spec.rb
│ │ ├── validation_errors_spec.rb
│ │ └── validation_spec.rb
│ ├── integration/
│ │ ├── global_namespace_function_spec.rb
│ │ ├── rack_sendfile_spec.rb
│ │ └── rack_spec.rb
│ ├── loading_spec.rb
│ ├── middleware/
│ │ ├── auth/
│ │ │ ├── base_spec.rb
│ │ │ ├── dsl_spec.rb
│ │ │ └── strategies_spec.rb
│ │ ├── base_spec.rb
│ │ ├── error_spec.rb
│ │ ├── exception_spec.rb
│ │ ├── formatter_spec.rb
│ │ ├── globals_spec.rb
│ │ ├── stack_spec.rb
│ │ ├── versioner/
│ │ │ ├── accept_version_header_spec.rb
│ │ │ ├── header_spec.rb
│ │ │ ├── param_spec.rb
│ │ │ └── path_spec.rb
│ │ └── versioner_spec.rb
│ ├── named_api_spec.rb
│ ├── params_builder/
│ │ ├── hash_spec.rb
│ │ └── hash_with_indifferent_access_spec.rb
│ ├── parser_spec.rb
│ ├── path_spec.rb
│ ├── presenters/
│ │ └── presenter_spec.rb
│ ├── request_spec.rb
│ ├── router/
│ │ └── greedy_route_spec.rb
│ ├── router_spec.rb
│ ├── util/
│ │ ├── inheritable_setting_spec.rb
│ │ ├── inheritable_values_spec.rb
│ │ ├── media_type_spec.rb
│ │ ├── registry_spec.rb
│ │ ├── reverse_stackable_values_spec.rb
│ │ ├── stackable_values_spec.rb
│ │ └── translation_spec.rb
│ ├── validations/
│ │ ├── multiple_attributes_iterator_spec.rb
│ │ ├── param_scope_tracker_spec.rb
│ │ ├── params_documentation_spec.rb
│ │ ├── params_scope_spec.rb
│ │ ├── single_attribute_iterator_spec.rb
│ │ ├── types/
│ │ │ ├── array_coercer_spec.rb
│ │ │ ├── primitive_coercer_spec.rb
│ │ │ └── set_coercer_spec.rb
│ │ ├── types_spec.rb
│ │ └── validators/
│ │ ├── all_or_none_validator_spec.rb
│ │ ├── allow_blank_validator_spec.rb
│ │ ├── at_least_one_of_validator_spec.rb
│ │ ├── base_i18n_spec.rb
│ │ ├── coerce_validator_spec.rb
│ │ ├── contract_scope_validator_spec.rb
│ │ ├── default_validator_spec.rb
│ │ ├── exactly_one_of_validator_spec.rb
│ │ ├── except_values_validator_spec.rb
│ │ ├── length_validator_spec.rb
│ │ ├── mutually_exclusive_spec.rb
│ │ ├── presence_validator_spec.rb
│ │ ├── regexp_validator_spec.rb
│ │ ├── same_as_validator_spec.rb
│ │ └── values_validator_spec.rb
│ └── validations_spec.rb
├── integration/
│ ├── dry_validation/
│ │ └── dry_validation_spec.rb
│ ├── grape_entity/
│ │ └── entity_spec.rb
│ ├── hashie/
│ │ └── hashie_spec.rb
│ ├── multi_json/
│ │ └── json_spec.rb
│ ├── multi_xml/
│ │ └── xml_spec.rb
│ └── rails/
│ ├── mounting_spec.rb
│ └── railtie_spec.rb
├── shared/
│ └── versioning_examples.rb
├── spec_helper.rb
└── support/
├── basic_auth_encode_helpers.rb
├── chunked_response.rb
├── content_type_helpers.rb
├── cookie_jar.rb
├── deprecated_warning_handlers.rb
├── deregister.rb
├── endpoint_faker.rb
├── file_streamer.rb
├── integer_helpers.rb
└── versioned_helpers.rb
SYMBOL INDEX (1371 symbols across 221 files)
FILE: benchmark/compile_many_routes.rb
class API (line 7) | class API < Grape::API
FILE: benchmark/issue_mounting.rb
class GrapeAPIBugTest (line 17) | class GrapeAPIBugTest < Minitest::Test
method test_v1_users_via_api (line 29) | def test_v1_users_via_api
FILE: benchmark/large_model.rb
class API (line 9) | class API < Grape::API
method vrp_request_timewindow (line 22) | def self.vrp_request_timewindow(this)
method vrp_request_indice_range (line 30) | def self.vrp_request_indice_range(this)
method vrp_request_point (line 35) | def self.vrp_request_point(this)
method vrp_request_unit (line 43) | def self.vrp_request_unit(this)
method vrp_request_activity (line 49) | def self.vrp_request_activity(this)
method vrp_request_quantity (line 61) | def self.vrp_request_quantity(this)
method vrp_request_capacity (line 67) | def self.vrp_request_capacity(this)
method vrp_request_vehicle (line 75) | def self.vrp_request_vehicle(this)
method vrp_request_service (line 100) | def self.vrp_request_service(this)
method vrp_request_configuration (line 125) | def self.vrp_request_configuration(this)
method vrp_request_partition (line 140) | def self.vrp_request_partition(this)
method vrp_request_preprocessing (line 147) | def self.vrp_request_preprocessing(this)
method vrp_request_resolution (line 162) | def self.vrp_request_resolution(this)
method vrp_request_restitution (line 186) | def self.vrp_request_restitution(this)
method vrp_request_schedule (line 194) | def self.vrp_request_schedule(this)
FILE: benchmark/nested_params.rb
class API (line 7) | class API < Grape::API
FILE: benchmark/remounting.rb
class VotingApi (line 7) | class VotingApi < Grape::API
method logger (line 11) | def logger
class PostApi (line 23) | class PostApi < Grape::API
class CommentAPI (line 27) | class CommentAPI < Grape::API
FILE: benchmark/simple.rb
class API (line 7) | class API < Grape::API
FILE: lib/grape.rb
type Grape (line 50) | module Grape
function deprecator (line 66) | def self.deprecator
FILE: lib/grape/api.rb
type Grape (line 3) | module Grape
class API (line 6) | class API
class Boolean (line 12) | class Boolean
method build (line 13) | def self.build(val)
method initial_setup (line 36) | def initial_setup(base_instance_parent)
method override_all_methods! (line 44) | def override_all_methods!
method configure (line 57) | def configure
method mount_instance (line 71) | def mount_instance(configuration: nil)
method inherited (line 83) | def inherited(api)
method replay_setup_on (line 92) | def replay_setup_on(instance)
method add_setup (line 99) | def add_setup(**step)
method refresh_mount_step (line 111) | def refresh_mount_step
method replay_step_on (line 123) | def replay_step_on(instance, method:, args:, kwargs:, block:)
method skip_immediate_run? (line 137) | def skip_immediate_run?(instance, args, kwargs)
method any_lazy? (line 142) | def any_lazy?(args)
method evaluate_arguments (line 146) | def evaluate_arguments(configuration, *args)
method argument_lazy? (line 160) | def argument_lazy?(argument)
FILE: lib/grape/api/instance.rb
type Grape (line 3) | module Grape
class API (line 4) | class API
class Instance (line 7) | class Instance
method base= (line 28) | def base=(grape_api)
method base_instance? (line 33) | def base_instance?
method reset! (line 42) | def reset!
method call (line 52) | def call(env)
method compile! (line 57) | def compile!
method recognize_path (line 64) | def recognize_path(path)
method change! (line 70) | def change!
method inherit_settings (line 76) | def inherit_settings(other_settings)
method inherited (line 91) | def inherited(subclass)
method initialize (line 102) | def initialize
method call (line 114) | def call(env)
method cascade? (line 132) | def cascade?
method add_head_not_allowed_methods_and_options_methods (line 148) | def add_head_not_allowed_methods_and_options_methods
method collect_route_config_per_pattern (line 158) | def collect_route_config_per_pattern(all_routes)
method without_root_prefix_and_versioning (line 183) | def without_root_prefix_and_versioning
FILE: lib/grape/content_types.rb
type Grape (line 3) | module Grape
type ContentTypes (line 4) | module ContentTypes
function content_types_for (line 18) | def content_types_for(from_settings)
function mime_types_for (line 22) | def mime_types_for(from_settings)
FILE: lib/grape/cookies.rb
type Grape (line 3) | module Grape
class Cookies (line 4) | class Cookies
method initialize (line 15) | def initialize(rack_cookies)
method response_cookies (line 20) | def response_cookies
method []= (line 28) | def []=(name, value)
method delete (line 34) | def delete(name, **opts)
method cookies (line 40) | def cookies
method send_cookies (line 46) | def send_cookies
FILE: lib/grape/declared_params_handler.rb
type Grape (line 3) | module Grape
class DeclaredParamsHandler (line 4) | class DeclaredParamsHandler
method initialize (line 5) | def initialize(include_missing: true, evaluate_given: false, stringi...
method call (line 12) | def call(passed_params, declared_params, route_params, renamed_params)
method recursive_declared (line 23) | def recursive_declared(passed_params, declared_params:, route_params...
method declared_hash (line 37) | def declared_hash(passed_params, declared_params:, params_nested_pat...
method declared_hash_attr (line 52) | def declared_hash_attr(passed_params, declared_param:, params_nested...
method build_memo_key (line 90) | def build_memo_key(params_nested_path, declared_param, renamed_params)
method handle_passed_param (line 98) | def handle_passed_param(params_nested_path, route_params:, has_passe...
FILE: lib/grape/dry_types.rb
type Grape (line 3) | module Grape
type DryTypes (line 4) | module DryTypes
class StrictCache (line 9) | class StrictCache < Grape::Util::Cache
method initialize (line 18) | def initialize
class ParamsCache (line 28) | class ParamsCache < Grape::Util::Cache
method initialize (line 38) | def initialize
function wrapped_dry_types_const_get (line 48) | def self.wrapped_dry_types_const_get(dry_type, type)
FILE: lib/grape/dsl/callbacks.rb
type Grape (line 3) | module Grape
type DSL (line 4) | module DSL
type Callbacks (line 5) | module Callbacks
FILE: lib/grape/dsl/declared.rb
type Grape (line 3) | module Grape
type DSL (line 4) | module DSL
type Declared (line 5) | module Declared
class MethodNotYetAvailable (line 8) | class MethodNotYetAvailable < StandardError
method initialize (line 9) | def initialize(msg = '#declared is not available prior to parame...
function declared (line 22) | def declared(passed_params, include_parent_namespaces: true, inclu...
FILE: lib/grape/dsl/desc.rb
type Grape (line 3) | module Grape
type DSL (line 4) | module DSL
type Desc (line 5) | module Desc
function desc (line 52) | def desc(description, options = {}, &config_block)
FILE: lib/grape/dsl/headers.rb
type Grape (line 3) | module Grape
type DSL (line 4) | module DSL
type Headers (line 5) | module Headers
function header (line 11) | def header(key = nil, val = nil)
FILE: lib/grape/dsl/helpers.rb
type Grape (line 3) | module Grape
type DSL (line 4) | module DSL
type Helpers (line 5) | module Helpers
function helpers (line 31) | def helpers(*new_modules, &block)
function include_new_modules (line 39) | def include_new_modules(modules)
function include_block (line 45) | def include_block(block)
function make_inclusion (line 53) | def make_inclusion(mod, &)
function include_all_in_scope (line 59) | def include_all_in_scope
function define_boolean_in_mod (line 66) | def define_boolean_in_mod(mod)
function inject_api_helpers_to_mod (line 72) | def inject_api_helpers_to_mod(mod, &block)
type BaseHelper (line 80) | module BaseHelper
function params (line 83) | def params(name, &block)
function api_changed (line 88) | def api_changed(new_api)
function process_named_params (line 95) | def process_named_params
FILE: lib/grape/dsl/inside_route.rb
type Grape (line 3) | module Grape
type DSL (line 4) | module DSL
type InsideRoute (line 5) | module InsideRoute
function version (line 12) | def version
function configuration (line 16) | def configuration
function error! (line 28) | def error!(message, status = nil, additional_headers = nil, backtr...
function redirect (line 44) | def redirect(url, permanent: false, body: nil)
function status (line 64) | def status(status = nil)
function content_type (line 92) | def content_type(val = nil)
function body (line 110) | def body(value = nil)
function return_no_content (line 130) | def return_no_content
function sendfile (line 143) | def sendfile(value = nil)
function stream (line 169) | def stream(value = nil)
function present (line 202) | def present(*args, **options)
function route (line 239) | def route
function entity_class_for_obj (line 251) | def entity_class_for_obj(object, options)
function entity_representation_for (line 274) | def entity_representation_for(entity_class, object, options)
function http_version (line 280) | def http_version
function api_format (line 284) | def api_format(format)
function context (line 288) | def context
FILE: lib/grape/dsl/logger.rb
type Grape (line 3) | module Grape
type DSL (line 4) | module DSL
type Logger (line 5) | module Logger
function logger (line 9) | def logger(logger = nil)
FILE: lib/grape/dsl/middleware.rb
type Grape (line 3) | module Grape
type DSL (line 4) | module DSL
type Middleware (line 5) | module Middleware
function use (line 12) | def use(middleware_class, *args, &block)
function middleware (line 31) | def middleware
FILE: lib/grape/dsl/parameters.rb
type Grape (line 3) | module Grape
type DSL (line 4) | module DSL
type Parameters (line 8) | module Parameters
function build_with (line 31) | def build_with(build_with)
function use (line 56) | def use(*names, **options)
function requires (line 125) | def requires(*attrs, **opts, &block)
function optional (line 141) | def optional(*attrs, **opts, &block)
function with (line 163) | def with(**opts, &)
function given (line 181) | def given(*attrs, &)
function declared_param? (line 192) | def declared_param?(param)
class EmptyOptionalValue (line 207) | class EmptyOptionalValue; end
function map_params (line 209) | def map_params(params, element, is_array = false)
function params (line 226) | def params(params)
function first_hash_key_or_param (line 234) | def first_hash_key_or_param(parameter)
FILE: lib/grape/dsl/request_response.rb
type Grape (line 3) | module Grape
type DSL (line 4) | module DSL
type RequestResponse (line 5) | module RequestResponse
function default_format (line 8) | def default_format(new_format = nil)
function format (line 16) | def format(new_format = nil)
function formatter (line 30) | def formatter(content_type, new_formatter)
function parser (line 35) | def parser(content_type, new_parser)
function default_error_formatter (line 40) | def default_error_formatter(new_formatter_name = nil)
function error_formatter (line 47) | def error_formatter(format, options)
function content_type (line 59) | def content_type(key, val)
function content_types (line 64) | def content_types
function default_error_status (line 70) | def default_error_status(new_status = nil)
function rescue_from (line 96) | def rescue_from(*args, **options, &block)
function represent (line 149) | def represent(model_class, options)
function extract_with (line 157) | def extract_with(options)
FILE: lib/grape/dsl/routing.rb
type Grape (line 3) | module Grape
type DSL (line 4) | module DSL
type Routing (line 5) | module Routing
function given (line 8) | def given(conditional_option, &)
function mounted (line 14) | def mounted(&block)
function cascade (line 18) | def cascade(value = nil)
function version (line 41) | def version(*args, **options, &block)
function prefix (line 67) | def prefix(prefix = nil)
function scope (line 77) | def scope(_name = nil, &block)
function build_with (line 83) | def build_with(build_with)
function do_not_route_head! (line 88) | def do_not_route_head!
function do_not_route_options! (line 93) | def do_not_route_options!
function lint! (line 97) | def lint!
function do_not_document! (line 101) | def do_not_document!
function mount (line 105) | def mount(mounts, *opts)
function route (line 160) | def route(methods, paths = ['/'], route_options = {}, &)
function namespace (line 201) | def namespace(space = nil, requirements: nil, **options, &block)
function routes (line 217) | def routes
function route_param (line 226) | def route_param(param, requirements: nil, type: nil, **, &)
function versions (line 237) | def versions
function reset_routes! (line 244) | def reset_routes!
function reset_endpoints! (line 249) | def reset_endpoints!
function refresh_mounted_api (line 253) | def refresh_mounted_api(mounts, *opts)
function nest (line 261) | def nest(*blocks, &block)
function evaluate_as_instance_with_configuration (line 272) | def evaluate_as_instance_with_configuration(block, lazy: false)
FILE: lib/grape/dsl/settings.rb
type Grape (line 3) | module Grape
type DSL (line 4) | module DSL
type Settings (line 9) | module Settings
function top_level_setting (line 13) | def top_level_setting
function inheritable_setting (line 25) | def inheritable_setting
function global_setting (line 29) | def global_setting(key, value = nil)
function route_setting (line 33) | def route_setting(key, value = nil)
function namespace_setting (line 37) | def namespace_setting(key, value = nil)
function within_namespace (line 45) | def within_namespace
function get_or_set (line 60) | def get_or_set(setting, key, value)
FILE: lib/grape/dsl/validations.rb
type Grape (line 3) | module Grape
type DSL (line 4) | module DSL
type Validations (line 5) | module Validations
function params (line 9) | def params(&)
function contract (line 19) | def contract(contract = nil, &block)
function reset_validations! (line 46) | def reset_validations!
FILE: lib/grape/endpoint.rb
type Grape (line 3) | module Grape
class Endpoint (line 8) | class Endpoint
method before_each (line 20) | def before_each(new_setup = false, &block)
method run_before_each (line 33) | def run_before_each(endpoint)
method block_to_unbound_method (line 38) | def block_to_unbound_method(block)
method initialize (line 60) | def initialize(new_settings, **options, &block)
method inherit_settings (line 87) | def inherit_settings(namespace_stackable)
method routes (line 96) | def routes
method reset_routes! (line 100) | def reset_routes!
method mount_in (line 106) | def mount_in(router)
method namespace (line 125) | def namespace
method call (line 129) | def call(env)
method call! (line 133) | def call!(env)
method endpoints (line 143) | def endpoints
method equals? (line 147) | def equals?(endpoint)
method inspect (line 154) | def inspect
method run (line 162) | def run
method execute (line 200) | def execute
method run_validators (line 208) | def run_validators(validators, request)
method run_filters (line 228) | def run_filters(filters, type = :other)
method validations (line 242) | def validations
method options? (line 252) | def options?
method compile! (line 261) | def compile!
method to_routes (line 266) | def to_routes
method prepare_default_route_attributes (line 289) | def prepare_default_route_attributes(route_options)
method prepare_default_path_settings (line 301) | def prepare_default_path_settings
method prepare_routes_requirements (line 307) | def prepare_routes_requirements(route_options_requirements)
method prepare_version (line 313) | def prepare_version(namespace_inheritable_version)
method build_stack (line 319) | def build_stack
method build_helpers (line 363) | def build_helpers
method build_response_cookies (line 370) | def build_response_cookies
method lint? (line 377) | def lint?
method rescue_handlers (line 381) | def rescue_handlers
FILE: lib/grape/env.rb
type Grape (line 3) | module Grape
type Env (line 4) | module Env
FILE: lib/grape/error_formatter.rb
type Grape (line 3) | module Grape
type ErrorFormatter (line 4) | module ErrorFormatter
function formatter_for (line 9) | def formatter_for(format, error_formatters = nil, default_error_form...
FILE: lib/grape/error_formatter/base.rb
type Grape (line 3) | module Grape
type ErrorFormatter (line 4) | module ErrorFormatter
class Base (line 5) | class Base
method call (line 7) | def call(message, backtrace, options = {}, env = nil, original_exc...
method present (line 20) | def present(message, env)
method wrap_message (line 51) | def wrap_message(message)
method format_structured_message (line 57) | def format_structured_message(_structured_message)
method inherited (line 63) | def inherited(klass)
FILE: lib/grape/error_formatter/json.rb
type Grape (line 3) | module Grape
type ErrorFormatter (line 4) | module ErrorFormatter
class Json (line 5) | class Json < Base
method format_structured_message (line 7) | def format_structured_message(structured_message)
method wrap_message (line 13) | def wrap_message(message)
method ensure_utf8 (line 20) | def ensure_utf8(message)
FILE: lib/grape/error_formatter/serializable_hash.rb
type Grape (line 3) | module Grape
type ErrorFormatter (line 4) | module ErrorFormatter
class SerializableHash (line 5) | class SerializableHash < Json; end
FILE: lib/grape/error_formatter/txt.rb
type Grape (line 3) | module Grape
type ErrorFormatter (line 4) | module ErrorFormatter
class Txt (line 5) | class Txt < Base
method format_structured_message (line 6) | def self.format_structured_message(structured_message)
FILE: lib/grape/error_formatter/xml.rb
type Grape (line 3) | module Grape
type ErrorFormatter (line 4) | module ErrorFormatter
class Xml (line 5) | class Xml < Base
method format_structured_message (line 6) | def self.format_structured_message(structured_message)
FILE: lib/grape/exceptions/base.rb
type Grape (line 3) | module Grape
type Exceptions (line 4) | module Exceptions
class Base (line 5) | class Base < StandardError
method initialize (line 12) | def initialize(status: nil, message: nil, headers: nil)
method [] (line 19) | def [](index)
method compose_message (line 25) | def compose_message(key, **)
method translate_message (line 35) | def translate_message(translation_key, **)
FILE: lib/grape/exceptions/conflicting_types.rb
type Grape (line 3) | module Grape
type Exceptions (line 4) | module Exceptions
class ConflictingTypes (line 5) | class ConflictingTypes < Base
method initialize (line 6) | def initialize
FILE: lib/grape/exceptions/empty_message_body.rb
type Grape (line 3) | module Grape
type Exceptions (line 4) | module Exceptions
class EmptyMessageBody (line 5) | class EmptyMessageBody < Base
method initialize (line 6) | def initialize(body_format)
FILE: lib/grape/exceptions/incompatible_option_values.rb
type Grape (line 3) | module Grape
type Exceptions (line 4) | module Exceptions
class IncompatibleOptionValues (line 5) | class IncompatibleOptionValues < Base
method initialize (line 6) | def initialize(option1, value1, option2, value2)
FILE: lib/grape/exceptions/invalid_accept_header.rb
type Grape (line 3) | module Grape
type Exceptions (line 4) | module Exceptions
class InvalidAcceptHeader (line 5) | class InvalidAcceptHeader < Base
method initialize (line 6) | def initialize(message, headers)
FILE: lib/grape/exceptions/invalid_formatter.rb
type Grape (line 3) | module Grape
type Exceptions (line 4) | module Exceptions
class InvalidFormatter (line 5) | class InvalidFormatter < Base
method initialize (line 6) | def initialize(klass, to_format)
FILE: lib/grape/exceptions/invalid_message_body.rb
type Grape (line 3) | module Grape
type Exceptions (line 4) | module Exceptions
class InvalidMessageBody (line 5) | class InvalidMessageBody < Base
method initialize (line 6) | def initialize(body_format)
FILE: lib/grape/exceptions/invalid_parameters.rb
type Grape (line 3) | module Grape
type Exceptions (line 4) | module Exceptions
class InvalidParameters (line 5) | class InvalidParameters < Base
method initialize (line 6) | def initialize
FILE: lib/grape/exceptions/invalid_response.rb
type Grape (line 3) | module Grape
type Exceptions (line 4) | module Exceptions
class InvalidResponse (line 5) | class InvalidResponse < Base
method initialize (line 6) | def initialize
FILE: lib/grape/exceptions/invalid_version_header.rb
type Grape (line 3) | module Grape
type Exceptions (line 4) | module Exceptions
class InvalidVersionHeader (line 5) | class InvalidVersionHeader < Base
method initialize (line 6) | def initialize(message, headers)
FILE: lib/grape/exceptions/invalid_versioner_option.rb
type Grape (line 3) | module Grape
type Exceptions (line 4) | module Exceptions
class InvalidVersionerOption (line 5) | class InvalidVersionerOption < Base
method initialize (line 6) | def initialize(strategy)
FILE: lib/grape/exceptions/invalid_with_option_for_represent.rb
type Grape (line 3) | module Grape
type Exceptions (line 4) | module Exceptions
class InvalidWithOptionForRepresent (line 5) | class InvalidWithOptionForRepresent < Base
method initialize (line 6) | def initialize
FILE: lib/grape/exceptions/method_not_allowed.rb
type Grape (line 3) | module Grape
type Exceptions (line 4) | module Exceptions
class MethodNotAllowed (line 5) | class MethodNotAllowed < Base
method initialize (line 6) | def initialize(headers)
FILE: lib/grape/exceptions/missing_group_type.rb
type Grape (line 3) | module Grape
type Exceptions (line 4) | module Exceptions
class MissingGroupType (line 5) | class MissingGroupType < Base
method initialize (line 6) | def initialize
FILE: lib/grape/exceptions/missing_mime_type.rb
type Grape (line 3) | module Grape
type Exceptions (line 4) | module Exceptions
class MissingMimeType (line 5) | class MissingMimeType < Base
method initialize (line 6) | def initialize(new_format)
FILE: lib/grape/exceptions/missing_vendor_option.rb
type Grape (line 3) | module Grape
type Exceptions (line 4) | module Exceptions
class MissingVendorOption (line 5) | class MissingVendorOption < Base
method initialize (line 6) | def initialize
FILE: lib/grape/exceptions/too_deep_parameters.rb
type Grape (line 3) | module Grape
type Exceptions (line 4) | module Exceptions
class TooDeepParameters (line 5) | class TooDeepParameters < Base
method initialize (line 6) | def initialize(limit)
FILE: lib/grape/exceptions/too_many_multipart_files.rb
type Grape (line 3) | module Grape
type Exceptions (line 4) | module Exceptions
class TooManyMultipartFiles (line 5) | class TooManyMultipartFiles < Base
method initialize (line 6) | def initialize(limit)
FILE: lib/grape/exceptions/unknown_auth_strategy.rb
type Grape (line 3) | module Grape
type Exceptions (line 4) | module Exceptions
class UnknownAuthStrategy (line 5) | class UnknownAuthStrategy < Base
method initialize (line 6) | def initialize(strategy:)
FILE: lib/grape/exceptions/unknown_parameter.rb
type Grape (line 3) | module Grape
type Exceptions (line 4) | module Exceptions
class UnknownParameter (line 5) | class UnknownParameter < Base
method initialize (line 6) | def initialize(param)
FILE: lib/grape/exceptions/unknown_params_builder.rb
type Grape (line 3) | module Grape
type Exceptions (line 4) | module Exceptions
class UnknownParamsBuilder (line 5) | class UnknownParamsBuilder < Base
method initialize (line 6) | def initialize(params_builder_type)
FILE: lib/grape/exceptions/unknown_validator.rb
type Grape (line 3) | module Grape
type Exceptions (line 4) | module Exceptions
class UnknownValidator (line 5) | class UnknownValidator < Base
method initialize (line 6) | def initialize(validator_type)
FILE: lib/grape/exceptions/unsupported_group_type.rb
type Grape (line 3) | module Grape
type Exceptions (line 4) | module Exceptions
class UnsupportedGroupType (line 5) | class UnsupportedGroupType < Base
method initialize (line 6) | def initialize
FILE: lib/grape/exceptions/validation.rb
type Grape (line 3) | module Grape
type Exceptions (line 4) | module Exceptions
class Validation (line 5) | class Validation < Base
method initialize (line 8) | def initialize(params:, message: nil, status: nil, headers: nil)
method as_json (line 23) | def as_json(*_args)
FILE: lib/grape/exceptions/validation_array_errors.rb
type Grape (line 3) | module Grape
type Exceptions (line 4) | module Exceptions
class ValidationArrayErrors (line 5) | class ValidationArrayErrors < Base
method initialize (line 8) | def initialize(errors)
FILE: lib/grape/exceptions/validation_errors.rb
type Grape (line 3) | module Grape
type Exceptions (line 4) | module Exceptions
class ValidationErrors (line 5) | class ValidationErrors < Base
method initialize (line 10) | def initialize(errors: [], headers: {})
method each (line 15) | def each
method as_json (line 23) | def as_json(**_opts)
method to_json (line 32) | def to_json(*_opts)
method full_messages (line 36) | def full_messages
method translate_attributes (line 52) | def translate_attributes(keys)
FILE: lib/grape/formatter.rb
type Grape (line 3) | module Grape
type Formatter (line 4) | module Formatter
function formatter_for (line 11) | def formatter_for(api_format, formatters)
FILE: lib/grape/formatter/base.rb
type Grape (line 3) | module Grape
type Formatter (line 4) | module Formatter
class Base (line 5) | class Base
method call (line 6) | def self.call(_object, _env)
method inherited (line 10) | def self.inherited(klass)
FILE: lib/grape/formatter/json.rb
type Grape (line 3) | module Grape
type Formatter (line 4) | module Formatter
class Json (line 5) | class Json < Base
method call (line 6) | def self.call(object, _env)
FILE: lib/grape/formatter/serializable_hash.rb
type Grape (line 3) | module Grape
type Formatter (line 4) | module Formatter
class SerializableHash (line 5) | class SerializableHash < Base
method call (line 7) | def call(object, _env)
method serializable? (line 17) | def serializable?(object)
method serialize (line 21) | def serialize(object)
method array_serializable? (line 33) | def array_serializable?(object)
FILE: lib/grape/formatter/txt.rb
type Grape (line 3) | module Grape
type Formatter (line 4) | module Formatter
class Txt (line 5) | class Txt < Base
method call (line 6) | def self.call(object, _env)
FILE: lib/grape/formatter/xml.rb
type Grape (line 3) | module Grape
type Formatter (line 4) | module Formatter
class Xml (line 5) | class Xml < Base
method call (line 6) | def self.call(object, _env)
FILE: lib/grape/json.rb
type Grape (line 3) | module Grape
FILE: lib/grape/middleware/auth/base.rb
type Grape (line 3) | module Grape
type Middleware (line 4) | module Middleware
type Auth (line 5) | module Auth
class Base (line 6) | class Base < Grape::Middleware::Base
method initialize (line 7) | def initialize(app, **options)
method call! (line 14) | def call!(env)
FILE: lib/grape/middleware/auth/dsl.rb
type Grape (line 3) | module Grape
type Middleware (line 4) | module Middleware
type Auth (line 5) | module Auth
type DSL (line 6) | module DSL
function auth (line 7) | def auth(type = nil, options = {}, &block)
function http_basic (line 19) | def http_basic(options = {}, &)
function http_digest (line 24) | def http_digest(options = {}, &)
FILE: lib/grape/middleware/auth/strategies.rb
type Grape (line 3) | module Grape
type Middleware (line 4) | module Middleware
type Auth (line 5) | module Auth
type Strategies (line 6) | module Strategies
function add (line 9) | def add(label, strategy, option_fetcher = ->(_) { [] })
function auth_strategies (line 13) | def auth_strategies
function [] (line 19) | def [](label)
FILE: lib/grape/middleware/auth/strategy_info.rb
type Grape (line 3) | module Grape
type Middleware (line 4) | module Middleware
type Auth (line 5) | module Auth
function create (line 7) | def create(app, options, &block)
FILE: lib/grape/middleware/base.rb
type Grape (line 3) | module Grape
type Middleware (line 4) | module Middleware
class Base (line 5) | class Base
method initialize (line 12) | def initialize(app, **options)
method call (line 18) | def call(env)
method call! (line 22) | def call!(env)
method before (line 43) | def before; end
method after (line 48) | def after; end
method rack_request (line 50) | def rack_request
method context (line 54) | def context
method response (line 58) | def response
method content_types (line 64) | def content_types
method mime_types (line 68) | def mime_types
method content_type_for (line 72) | def content_type_for(format)
method content_type (line 76) | def content_type
method query_params (line 80) | def query_params
method merge_headers (line 90) | def merge_headers(response)
method content_types_indifferent_access (line 99) | def content_types_indifferent_access
method merge_default_options (line 103) | def merge_default_options(options)
method try_scrub (line 113) | def try_scrub(obj)
FILE: lib/grape/middleware/error.rb
type Grape (line 3) | module Grape
type Middleware (line 4) | module Middleware
class Error (line 5) | class Error < Base
method call! (line 19) | def call!(env)
method rack_response (line 28) | def rack_response(status, headers, message)
method format_message (line 33) | def format_message(message, backtrace, original_exception = nil)
method find_handler (line 45) | def find_handler(klass)
method error_response (line 53) | def error_response(error = {})
method default_rescue_handler (line 65) | def default_rescue_handler(exception)
method rescue_handler_for_base_only_class (line 69) | def rescue_handler_for_base_only_class(klass)
method rescue_handler_for_class_or_its_ancestor (line 77) | def rescue_handler_for_class_or_its_ancestor(klass)
method rescue_handler_for_grape_exception (line 85) | def rescue_handler_for_grape_exception(klass)
method rescue_handler_for_any_class (line 93) | def rescue_handler_for_any_class(klass)
method run_rescue_handler (line 100) | def run_rescue_handler(handler, error, endpoint)
method error! (line 115) | def error!(message, status = options[:default_status], headers = {...
method error? (line 123) | def error?(response)
FILE: lib/grape/middleware/filter.rb
type Grape (line 3) | module Grape
type Middleware (line 4) | module Middleware
class Filter (line 9) | class Filter < Base
method before (line 10) | def before
method after (line 14) | def after
FILE: lib/grape/middleware/formatter.rb
type Grape (line 3) | module Grape
type Middleware (line 4) | module Middleware
class Formatter (line 5) | class Formatter < Base
method before (line 12) | def before
method after (line 17) | def after
method build_formatted_response (line 31) | def build_formatted_response(status, headers, bodies)
method fetch_formatter (line 50) | def fetch_formatter(headers, options)
method ensure_content_type (line 59) | def ensure_content_type(headers)
method read_body_input (line 67) | def read_body_input
method read_rack_input (line 83) | def read_rack_input(body)
method read_body_input? (line 118) | def read_body_input?
method negotiate_content_type (line 125) | def negotiate_content_type
method format_from_extension (line 134) | def format_from_extension
method format_from_header (line 143) | def format_from_header
FILE: lib/grape/middleware/globals.rb
type Grape (line 3) | module Grape
type Middleware (line 4) | module Middleware
class Globals (line 5) | class Globals < Base
method before (line 6) | def before
FILE: lib/grape/middleware/stack.rb
type Grape (line 3) | module Grape
type Middleware (line 4) | module Middleware
class Stack (line 7) | class Stack
class Middleware (line 10) | class Middleware
method initialize (line 13) | def initialize(klass, args, block)
method name (line 19) | def name
method == (line 23) | def ==(other)
method inspect (line 32) | def inspect
method build (line 36) | def build(builder)
method initialize (line 51) | def initialize
method insert (line 56) | def insert(index, klass, *args, &block)
method insert_after (line 63) | def insert_after(index, ...)
method use (line 68) | def use(klass, *args, &block)
method merge_with (line 73) | def merge_with(middleware_specs)
method build (line 85) | def build
method concat (line 96) | def concat(other_specs)
method assert_index (line 104) | def assert_index(index, where)
FILE: lib/grape/middleware/versioner.rb
type Grape (line 11) | module Grape
type Middleware (line 12) | module Middleware
type Versioner (line 13) | module Versioner
function using (line 20) | def using(strategy)
FILE: lib/grape/middleware/versioner/accept_version_header.rb
type Grape (line 3) | module Grape
type Middleware (line 4) | module Middleware
type Versioner (line 5) | module Versioner
class AcceptVersionHeader (line 19) | class AcceptVersionHeader < Base
method before (line 20) | def before
method not_acceptable! (line 32) | def not_acceptable!(message)
FILE: lib/grape/middleware/versioner/base.rb
type Grape (line 3) | module Grape
type Middleware (line 4) | module Middleware
type Versioner (line 5) | module Versioner
class Base (line 6) | class Base < Grape::Middleware::Base
method inherited (line 33) | def self.inherited(klass)
method initialize (line 40) | def initialize(app, **options)
method potential_version_match? (line 46) | def potential_version_match?(potential_version)
method version_not_found! (line 50) | def version_not_found!
method available_media_types (line 56) | def available_media_types
FILE: lib/grape/middleware/versioner/header.rb
type Grape (line 3) | module Grape
type Middleware (line 4) | module Middleware
type Versioner (line 5) | module Versioner
class Header (line 24) | class Header < Base
method before (line 25) | def before
method match_best_quality_media_type! (line 39) | def match_best_quality_media_type!
method accept_header (line 51) | def accept_header
method strict_header_checks! (line 55) | def strict_header_checks!
method accept_header_check! (line 62) | def accept_header_check!
method version_and_vendor_check! (line 68) | def version_and_vendor_check!
method q_values_mime_types (line 74) | def q_values_mime_types
method version_and_vendor? (line 78) | def version_and_vendor?
method invalid_accept_header! (line 82) | def invalid_accept_header!(message)
method invalid_version_header! (line 86) | def invalid_version_header!(message)
method fail! (line 90) | def fail!
method vendor_not_found! (line 97) | def vendor_not_found!(media_types)
method version_not_found! (line 103) | def version_not_found!(media_types)
FILE: lib/grape/middleware/versioner/param.rb
type Grape (line 3) | module Grape
type Middleware (line 4) | module Middleware
type Versioner (line 5) | module Versioner
class Param (line 21) | class Param < Base
method before (line 22) | def before
FILE: lib/grape/middleware/versioner/path.rb
type Grape (line 3) | module Grape
type Middleware (line 4) | module Middleware
type Versioner (line 5) | module Versioner
class Path (line 19) | class Path < Base
method before (line 20) | def before
FILE: lib/grape/namespace.rb
type Grape (line 3) | module Grape
class Namespace (line 7) | class Namespace
method initialize (line 15) | def initialize(space, requirements: nil, **options)
method joined_space (line 22) | def self.joined_space(settings)
method eql? (line 26) | def eql?(other)
method hash (line 34) | def hash
method joined_space_path (line 40) | def self.joined_space_path(settings)
class JoinedSpaceCache (line 44) | class JoinedSpaceCache < Grape::Util::Cache
method initialize (line 45) | def initialize
FILE: lib/grape/params_builder.rb
type Grape (line 3) | module Grape
type ParamsBuilder (line 4) | module ParamsBuilder
function params_builder_for (line 9) | def params_builder_for(short_name)
FILE: lib/grape/params_builder/base.rb
type Grape (line 3) | module Grape
type ParamsBuilder (line 4) | module ParamsBuilder
class Base (line 5) | class Base
method call (line 7) | def call(_params)
method inherited (line 13) | def inherited(klass)
FILE: lib/grape/params_builder/hash.rb
type Grape (line 3) | module Grape
type ParamsBuilder (line 4) | module ParamsBuilder
class Hash (line 5) | class Hash < Base
method call (line 6) | def self.call(params)
FILE: lib/grape/params_builder/hash_with_indifferent_access.rb
type Grape (line 3) | module Grape
type ParamsBuilder (line 4) | module ParamsBuilder
class HashWithIndifferentAccess (line 5) | class HashWithIndifferentAccess < Base
method call (line 6) | def self.call(params)
FILE: lib/grape/params_builder/hashie_mash.rb
type Grape (line 3) | module Grape
type ParamsBuilder (line 4) | module ParamsBuilder
class HashieMash (line 5) | class HashieMash < Base
method call (line 6) | def self.call(params)
FILE: lib/grape/parser.rb
type Grape (line 3) | module Grape
type Parser (line 4) | module Parser
function parser_for (line 9) | def parser_for(format, parsers = nil)
FILE: lib/grape/parser/base.rb
type Grape (line 3) | module Grape
type Parser (line 4) | module Parser
class Base (line 5) | class Base
method call (line 6) | def self.call(_object, _env)
method inherited (line 10) | def self.inherited(klass)
FILE: lib/grape/parser/json.rb
type Grape (line 3) | module Grape
type Parser (line 4) | module Parser
class Json (line 5) | class Json < Base
method call (line 6) | def self.call(object, _env)
FILE: lib/grape/parser/xml.rb
type Grape (line 3) | module Grape
type Parser (line 4) | module Parser
class Xml (line 5) | class Xml < Base
method call (line 6) | def self.call(object, _env)
FILE: lib/grape/path.rb
type Grape (line 3) | module Grape
class Path (line 5) | class Path
method initialize (line 12) | def initialize(raw_path, raw_namespace, settings)
method to_s (line 17) | def to_s
method build_suffix (line 23) | def build_suffix(raw_path, raw_namespace, settings)
method build_parts (line 33) | def build_parts(raw_path, raw_namespace, settings)
method add_part (line 43) | def add_part(parts, value)
method not_slash? (line 47) | def not_slash?(value)
method uses_specific_format? (line 51) | def uses_specific_format?(settings)
method uses_path_versioning? (line 57) | def uses_path_versioning?(settings)
method valid_part? (line 63) | def valid_part?(part)
class PartsCache (line 67) | class PartsCache < Grape::Util::Cache
method initialize (line 68) | def initialize
FILE: lib/grape/presenters/presenter.rb
type Grape (line 3) | module Grape
type Presenters (line 4) | module Presenters
class Presenter (line 5) | class Presenter
method represent (line 6) | def self.represent(object, **_options)
FILE: lib/grape/railtie.rb
type Grape (line 3) | module Grape
class Railtie (line 4) | class Railtie < ::Rails::Railtie
FILE: lib/grape/request.rb
type Grape (line 3) | module Grape
class Request (line 4) | class Request < Rack::Request
method initialize (line 142) | def initialize(env, build_params_with: nil)
method params (line 147) | def params
method headers (line 151) | def headers
method cookies (line 155) | def cookies
method grape_routing_args (line 160) | def grape_routing_args
method make_params (line 167) | def make_params
method build_headers (line 181) | def build_headers
FILE: lib/grape/router.rb
type Grape (line 3) | module Grape
class Router (line 4) | class Router
method normalize_path (line 12) | def self.normalize_path(path)
method initialize (line 32) | def initialize
method compile! (line 39) | def compile!
method append (line 54) | def append(route)
method associate_routes (line 58) | def associate_routes(greedy_route)
method call (line 63) | def call(env)
method recognize_path (line 72) | def recognize_path(input)
method identity (line 81) | def identity(input, method, env)
method rotation (line 90) | def rotation(input, method, env, exact_route)
method transaction (line 102) | def transaction(input, method, env)
method process_route (line 134) | def process_route(route, input, env, include_allow_header: false)
method with_optimization (line 143) | def with_optimization
method default_response (line 148) | def default_response
method match? (line 153) | def match?(input, method)
method greedy_match? (line 157) | def greedy_match?(input)
method cascade? (line 161) | def cascade?(response)
FILE: lib/grape/router/base_route.rb
type Grape (line 3) | module Grape
class Router (line 4) | class Router
class BaseRoute (line 5) | class BaseRoute
method initialize (line 15) | def initialize(pattern, options = {})
method namespace (line 21) | def namespace
method regexp_capture_index (line 25) | def regexp_capture_index
method pattern_regexp (line 29) | def pattern_regexp
method to_regexp (line 33) | def to_regexp(index)
class CaptureIndexCache (line 38) | class CaptureIndexCache < Grape::Util::Cache
method initialize (line 39) | def initialize
FILE: lib/grape/router/greedy_route.rb
type Grape (line 6) | module Grape
class Router (line 7) | class Router
class GreedyRoute (line 8) | class GreedyRoute < BaseRoute
method initialize (line 15) | def initialize(pattern, endpoint:, allow_header:)
method params (line 21) | def params(_input = nil)
FILE: lib/grape/router/pattern.rb
type Grape (line 3) | module Grape
class Router (line 4) | class Router
class Pattern (line 5) | class Pattern
method initialize (line 16) | def initialize(origin:, suffix:, anchor:, params:, format:, versio...
method captures_default (line 23) | def captures_default
method extract_capture (line 31) | def extract_capture(format, version, requirements)
method build_path_from_pattern (line 41) | def build_path_from_pattern(pattern, anchor)
method map_str (line 53) | def map_str(value)
class PatternCache (line 57) | class PatternCache < Grape::Util::Cache
method initialize (line 58) | def initialize
FILE: lib/grape/router/route.rb
type Grape (line 3) | module Grape
class Router (line 4) | class Router
class Route (line 5) | class Route < BaseRoute
method initialize (line 15) | def initialize(endpoint, method, pattern, options)
method convert_to_head_request! (line 22) | def convert_to_head_request!
method apply (line 26) | def apply(app)
method match? (line 31) | def match?(input)
method params (line 37) | def params(input = nil)
method params_without_input (line 48) | def params_without_input
method upcase_method (line 52) | def upcase_method(method)
FILE: lib/grape/serve_stream/file_body.rb
type Grape (line 3) | module Grape
type ServeStream (line 4) | module ServeStream
class FileBody (line 8) | class FileBody
method initialize (line 12) | def initialize(path)
method to_path (line 19) | def to_path
method each (line 23) | def each
method == (line 31) | def ==(other)
FILE: lib/grape/serve_stream/sendfile_response.rb
type Grape (line 3) | module Grape
type ServeStream (line 4) | module ServeStream
class SendfileResponse (line 7) | class SendfileResponse < Rack::Response
method respond_to? (line 8) | def respond_to?(method_name, include_all = false)
method to_path (line 16) | def to_path
FILE: lib/grape/serve_stream/stream_response.rb
type Grape (line 3) | module Grape
type ServeStream (line 4) | module ServeStream
class StreamResponse (line 7) | class StreamResponse
method initialize (line 11) | def initialize(stream)
method == (line 18) | def ==(other)
FILE: lib/grape/util/api_description.rb
type Grape (line 3) | module Grape
type Util (line 4) | module Util
class ApiDescription (line 5) | class ApiDescription
method initialize (line 26) | def initialize(description, endpoint_configuration, &)
method configuration (line 41) | def configuration
method settings (line 45) | def settings
method eval_endpoint_config (line 51) | def eval_endpoint_config(configuration)
FILE: lib/grape/util/base_inheritable.rb
type Grape (line 3) | module Grape
type Util (line 4) | module Util
class BaseInheritable (line 7) | class BaseInheritable
method initialize (line 12) | def initialize(inherited_values = nil)
method delete (line 17) | def delete(*keys)
method initialize_copy (line 24) | def initialize_copy(other)
method keys (line 30) | def keys
method key? (line 41) | def key?(name)
FILE: lib/grape/util/cache.rb
type Grape (line 3) | module Grape
type Util (line 4) | module Util
class Cache (line 5) | class Cache
FILE: lib/grape/util/endpoint_configuration.rb
type Grape (line 3) | module Grape
type Util (line 4) | module Util
class EndpointConfiguration (line 5) | class EndpointConfiguration < Lazy::ValueHash
FILE: lib/grape/util/header.rb
type Grape (line 3) | module Grape
type Util (line 4) | module Util
FILE: lib/grape/util/inheritable_setting.rb
type Grape (line 3) | module Grape
type Util (line 4) | module Util
class InheritableSetting (line 7) | class InheritableSetting
method global (line 11) | def self.global
method reset_global! (line 18) | def self.reset_global!
method initialize (line 25) | def initialize
method global (line 40) | def global
method inherit_from (line 48) | def inherit_from(parent)
method point_in_time_copy (line 65) | def point_in_time_copy
method route_end (line 83) | def route_end
method to_hash (line 88) | def to_hash
method namespace_stackable_with_hash (line 99) | def namespace_stackable_with_hash(key)
FILE: lib/grape/util/inheritable_values.rb
type Grape (line 3) | module Grape
type Util (line 4) | module Util
class InheritableValues (line 5) | class InheritableValues < BaseInheritable
method [] (line 6) | def [](name)
method []= (line 10) | def []=(name, value)
method merge (line 14) | def merge(new_hash)
method to_hash (line 18) | def to_hash
method values (line 24) | def values
FILE: lib/grape/util/lazy/block.rb
type Grape (line 3) | module Grape
type Util (line 4) | module Util
type Lazy (line 5) | module Lazy
class Block (line 6) | class Block
method initialize (line 7) | def initialize(&new_block)
method evaluate_from (line 11) | def evaluate_from(configuration)
method evaluate (line 15) | def evaluate
method lazy? (line 19) | def lazy?
method to_s (line 23) | def to_s
FILE: lib/grape/util/lazy/value.rb
type Grape (line 3) | module Grape
type Util (line 4) | module Util
type Lazy (line 5) | module Lazy
class Value (line 6) | class Value
method initialize (line 9) | def initialize(value, access_keys = [])
method evaluate_from (line 14) | def evaluate_from(configuration)
method evaluate (line 19) | def evaluate
method lazy? (line 23) | def lazy?
method reached_by (line 27) | def reached_by(parent_access_keys, access_key)
method to_s (line 32) | def to_s
FILE: lib/grape/util/lazy/value_array.rb
type Grape (line 3) | module Grape
type Util (line 4) | module Util
type Lazy (line 5) | module Lazy
class ValueArray (line 6) | class ValueArray < ValueEnumerable
method initialize (line 7) | def initialize(array)
method evaluate (line 15) | def evaluate
FILE: lib/grape/util/lazy/value_enumerable.rb
type Grape (line 3) | module Grape
type Util (line 4) | module Util
type Lazy (line 5) | module Lazy
class ValueEnumerable (line 6) | class ValueEnumerable < Value
method [] (line 7) | def [](key)
method fetch (line 15) | def fetch(access_keys)
method []= (line 21) | def []=(key, value)
FILE: lib/grape/util/lazy/value_hash.rb
type Grape (line 3) | module Grape
type Util (line 4) | module Util
type Lazy (line 5) | module Lazy
class ValueHash (line 6) | class ValueHash < ValueEnumerable
method initialize (line 7) | def initialize(hash)
method evaluate (line 15) | def evaluate
FILE: lib/grape/util/media_type.rb
type Grape (line 3) | module Grape
type Util (line 4) | module Util
class MediaType (line 5) | class MediaType
method initialize (line 12) | def initialize(type:, subtype:)
method == (line 22) | def ==(other)
method eql? (line 26) | def eql?(other)
method hash (line 35) | def hash
method best_quality (line 40) | def best_quality(header, available_media_types)
method parse (line 44) | def parse(media_type)
method match? (line 53) | def match?(media_type)
method best_quality_media_type (line 62) | def best_quality_media_type(header, available_media_types)
FILE: lib/grape/util/registry.rb
type Grape (line 3) | module Grape
type Util (line 4) | module Util
type Registry (line 5) | module Registry
function register (line 6) | def register(klass)
function build_short_name (line 16) | def build_short_name(klass)
function registry (line 22) | def registry
FILE: lib/grape/util/reverse_stackable_values.rb
type Grape (line 3) | module Grape
type Util (line 4) | module Util
class ReverseStackableValues (line 5) | class ReverseStackableValues < StackableValues
method concat_values (line 8) | def concat_values(inherited_value, new_value)
FILE: lib/grape/util/stackable_values.rb
type Grape (line 3) | module Grape
type Util (line 4) | module Util
class StackableValues (line 5) | class StackableValues < BaseInheritable
method [] (line 7) | def [](name)
method []= (line 16) | def []=(name, value)
method to_hash (line 21) | def to_hash
method concat_values (line 29) | def concat_values(inherited_value, new_value)
FILE: lib/grape/util/translation.rb
type Grape (line 3) | module Grape
type Util (line 4) | module Util
type Translation (line 5) | module Translation
function inspect (line 12) | def inspect = 'Grape::Util::Translation::MISSING'
function translate (line 21) | def translate(key, default: MISSING, scope: 'grape.errors.messages...
function fallback_locale? (line 33) | def fallback_locale?(locale)
function fallback_locale_unavailable? (line 37) | def fallback_locale_unavailable?
FILE: lib/grape/validations.rb
type Grape (line 3) | module Grape
type Validations (line 4) | module Validations
function require_validator (line 9) | def require_validator(short_name)
function build_short_name (line 15) | def build_short_name(klass)
FILE: lib/grape/validations/attributes_iterator.rb
type Grape (line 3) | module Grape
type Validations (line 4) | module Validations
class AttributesIterator (line 5) | class AttributesIterator
method initialize (line 10) | def initialize(attrs, scope, params)
method each (line 17) | def each(&)
method do_each (line 23) | def do_each(params_to_process, parent_indices = [], &block)
method store_indices (line 48) | def store_indices(target_scope, index, parent_indices)
method yield_attributes (line 64) | def yield_attributes(_resource_params)
method skip? (line 72) | def skip?(val)
FILE: lib/grape/validations/contract_scope.rb
type Grape (line 3) | module Grape
type Validations (line 4) | module Validations
class ContractScope (line 5) | class ContractScope
method initialize (line 10) | def initialize(api, contract = nil, &block)
FILE: lib/grape/validations/multiple_attributes_iterator.rb
type Grape (line 3) | module Grape
type Validations (line 4) | module Validations
class MultipleAttributesIterator (line 5) | class MultipleAttributesIterator < AttributesIterator
method yield_attributes (line 8) | def yield_attributes(resource_params)
FILE: lib/grape/validations/param_scope_tracker.rb
type Grape (line 3) | module Grape
type Validations (line 4) | module Validations
class ParamScopeTracker (line 11) | class ParamScopeTracker
method track (line 20) | def self.track
method current (line 28) | def self.current
method initialize (line 32) | def initialize
method store_index (line 37) | def store_index(scope, index)
method index_for (line 41) | def index_for(scope)
method qualifying_params (line 48) | def qualifying_params(scope)
method store_qualifying_params (line 52) | def store_qualifying_params(scope, params)
FILE: lib/grape/validations/params_documentation.rb
type Grape (line 3) | module Grape
type Validations (line 4) | module Validations
type ParamsDocumentation (line 8) | module ParamsDocumentation
function document_params (line 9) | def document_params(attrs, validations, type = nil, values = nil, ...
function extract_details (line 20) | def extract_details(validations, type, values, except_values)
class TypeCache (line 40) | class TypeCache < Grape::Util::Cache
method initialize (line 41) | def initialize
FILE: lib/grape/validations/params_scope.rb
type Grape (line 3) | module Grape
type Validations (line 4) | module Validations
class ParamsScope (line 5) | class ParamsScope
method qualifying_params (line 9) | def qualifying_params
class Attr (line 23) | class Attr
method initialize (line 29) | def initialize(key, scope)
method attrs_keys (line 35) | def self.attrs_keys(declared_params)
method attr_key (line 41) | def self.attr_key(declared_param_attr)
method initialize (line 67) | def initialize(api:, element: nil, element_renamed: nil, parent: n...
method configuration (line 87) | def configuration
method should_validate? (line 93) | def should_validate?(parameters)
method meets_dependency? (line 103) | def meets_dependency?(params, request_params)
method attr_meets_dependency? (line 116) | def attr_meets_dependency?(params)
method meets_hash_dependency? (line 123) | def meets_hash_dependency?(params)
method full_name (line 141) | def full_name(name, index: nil)
method brackets (line 157) | def brackets(val)
method root? (line 162) | def root?
method nested? (line 168) | def nested?
method lateral? (line 175) | def lateral?
method required? (line 181) | def required?
method push_declared_params (line 189) | def push_declared_params(attrs, **opts)
method full_path (line 200) | def full_path
method push_renamed_param (line 219) | def push_renamed_param(path, new_name)
method require_required_and_optional_fields (line 226) | def require_required_and_optional_fields(context, using:, except: ...
method require_optional_fields (line 249) | def require_optional_fields(context, using:, except: nil)
method validate_attributes (line 261) | def validate_attributes(attrs, **opts, &block)
method new_scope (line 274) | def new_scope(element, type:, as:, optional: false, &)
method new_lateral_scope (line 298) | def new_lateral_scope(dependent_on:, &)
method new_group_scope (line 313) | def new_group_scope(group, &)
method configure_declared_params (line 318) | def configure_declared_params
method find_nearest_array_ancestor (line 331) | def find_nearest_array_ancestor
method validates (line 337) | def validates(attrs, validations)
method infer_coercion (line 388) | def infer_coercion(validations)
method check_coerce_with (line 417) | def check_coerce_with(validations)
method coerce_type (line 435) | def coerce_type(validations, attrs, required, opts)
method guess_coerce_type (line 451) | def guess_coerce_type(coerce_type, *values_list)
method check_incompatible_option_values (line 461) | def check_incompatible_option_values(default, values, except_values)
method validate (line 471) | def validate(type, options, attrs, required, opts)
method validate_value_coercion (line 483) | def validate_value_coercion(coerce_type, *values_list)
method extract_message_option (line 496) | def extract_message_option(attrs)
method options_key? (line 503) | def options_key?(type, key, validations)
method all_element_blank? (line 507) | def all_element_blank?(scoped_params)
method derive_validator_options (line 513) | def derive_validator_options(validations)
method validates_presence (line 522) | def validates_presence(validations, attrs, opts)
FILE: lib/grape/validations/single_attribute_iterator.rb
type Grape (line 3) | module Grape
type Validations (line 4) | module Validations
class SingleAttributeIterator (line 5) | class SingleAttributeIterator < AttributesIterator
method yield_attributes (line 8) | def yield_attributes(val)
method empty? (line 21) | def empty?(val)
FILE: lib/grape/validations/types.rb
type Grape (line 3) | module Grape
type Validations (line 4) | module Validations
type Types (line 15) | module Types
function primitive? (line 55) | def primitive?(type)
function structure? (line 65) | def structure?(type)
function multiple? (line 77) | def multiple?(type)
function special? (line 88) | def special?(type)
function group? (line 97) | def group?(type)
function custom? (line 106) | def custom?(type)
function collection_of_custom? (line 119) | def collection_of_custom?(type)
function map_special (line 125) | def map_special(type)
function build_coercer (line 157) | def build_coercer(type, method: nil, strict: false)
function create_coercer_instance (line 164) | def create_coercer_instance(type, method, strict)
class CoercerCache (line 188) | class CoercerCache < Grape::Util::Cache
method initialize (line 189) | def initialize
FILE: lib/grape/validations/types/array_coercer.rb
type Grape (line 3) | module Grape
type Validations (line 4) | module Validations
type Types (line 5) | module Types
class ArrayCoercer (line 14) | class ArrayCoercer < DryTypeCoercer
method initialize (line 15) | def initialize(type, strict = false)
method call (line 21) | def call(_val)
method coerce_elements (line 32) | def coerce_elements(collection)
method reject? (line 50) | def reject?(val)
method elem_coercer (line 54) | def elem_coercer
FILE: lib/grape/validations/types/custom_type_coercer.rb
type Grape (line 3) | module Grape
type Validations (line 4) | module Validations
type Types (line 5) | module Types
class CustomTypeCoercer (line 35) | class CustomTypeCoercer
method initialize (line 43) | def initialize(type, method = nil)
method call (line 54) | def call(val)
method coerced? (line 63) | def coerced?(val)
method infer_coercion_method (line 75) | def infer_coercion_method(type, method)
method infer_type_check (line 95) | def infer_type_check(type)
method recursive_type_check (line 118) | def recursive_type_check(type, value)
method enforce_symbolized_keys (line 138) | def enforce_symbolized_keys(type, method)
FILE: lib/grape/validations/types/custom_type_collection_coercer.rb
type Grape (line 3) | module Grape
type Validations (line 4) | module Validations
type Types (line 5) | module Types
class CustomTypeCollectionCoercer (line 18) | class CustomTypeCollectionCoercer < CustomTypeCoercer
method initialize (line 32) | def initialize(type, set = false)
method call (line 42) | def call(value)
FILE: lib/grape/validations/types/dry_type_coercer.rb
type Grape (line 3) | module Grape
type Validations (line 4) | module Validations
type Types (line 5) | module Types
class DryTypeCoercer (line 10) | class DryTypeCoercer
method collection_coercer_for (line 17) | def collection_coercer_for(type)
method coercer_instance_for (line 29) | def coercer_instance_for(type, strict = false)
method initialize (line 35) | def initialize(type, strict = false)
method call (line 45) | def call(val)
FILE: lib/grape/validations/types/file.rb
type Grape (line 3) | module Grape
type Validations (line 4) | module Validations
type Types (line 5) | module Types
class File (line 9) | class File
method parse (line 11) | def parse(input)
method parsed? (line 21) | def parsed?(value)
FILE: lib/grape/validations/types/invalid_value.rb
type Grape (line 3) | module Grape
type Validations (line 4) | module Validations
type Types (line 5) | module Types
class InvalidValue (line 8) | class InvalidValue
method initialize (line 11) | def initialize(message = nil)
FILE: lib/grape/validations/types/json.rb
type Grape (line 3) | module Grape
type Validations (line 4) | module Validations
type Types (line 5) | module Types
class Json (line 12) | class Json
method parse (line 18) | def parse(input)
method parsed? (line 32) | def parsed?(value)
method coerced_collection? (line 42) | def coerced_collection?(value)
class JsonArray (line 52) | class JsonArray < Json
method parse (line 58) | def parse(input)
method parsed? (line 64) | def parsed?(value)
FILE: lib/grape/validations/types/multiple_type_coercer.rb
type Grape (line 3) | module Grape
type Validations (line 4) | module Validations
type Types (line 5) | module Types
class MultipleTypeCoercer (line 15) | class MultipleTypeCoercer
method initialize (line 22) | def initialize(types, method = nil)
method call (line 40) | def call(val)
FILE: lib/grape/validations/types/primitive_coercer.rb
type Grape (line 3) | module Grape
type Validations (line 4) | module Validations
type Types (line 5) | module Types
class PrimitiveCoercer (line 9) | class PrimitiveCoercer < DryTypeCoercer
method initialize (line 10) | def initialize(type, strict = false)
method call (line 16) | def call(val)
method reject? (line 31) | def reject?(val)
method treat_as_nil? (line 40) | def treat_as_nil?(val)
FILE: lib/grape/validations/types/set_coercer.rb
type Grape (line 3) | module Grape
type Validations (line 4) | module Validations
type Types (line 5) | module Types
class SetCoercer (line 8) | class SetCoercer < ArrayCoercer
method initialize (line 9) | def initialize(type, strict = false)
method call (line 15) | def call(value)
method coerce_elements (line 23) | def coerce_elements(collection)
FILE: lib/grape/validations/types/variant_collection_coercer.rb
type Grape (line 3) | module Grape
type Validations (line 4) | module Validations
type Types (line 5) | module Types
class VariantCollectionCoercer (line 8) | class VariantCollectionCoercer
method initialize (line 20) | def initialize(types, method = nil)
method call (line 35) | def call(value)
FILE: lib/grape/validations/validator_factory.rb
type Grape (line 3) | module Grape
type Validations (line 4) | module Validations
class ValidatorFactory (line 5) | class ValidatorFactory
method create_validator (line 6) | def self.create_validator(options)
FILE: lib/grape/validations/validators/all_or_none_of_validator.rb
type Grape (line 3) | module Grape
type Validations (line 4) | module Validations
type Validators (line 5) | module Validators
class AllOrNoneOfValidator (line 6) | class AllOrNoneOfValidator < MultipleParamsBase
method validate_params! (line 7) | def validate_params!(params)
FILE: lib/grape/validations/validators/allow_blank_validator.rb
type Grape (line 3) | module Grape
type Validations (line 4) | module Validations
type Validators (line 5) | module Validators
class AllowBlankValidator (line 6) | class AllowBlankValidator < Base
method validate_param! (line 7) | def validate_param!(attr_name, params)
FILE: lib/grape/validations/validators/as_validator.rb
type Grape (line 3) | module Grape
type Validations (line 4) | module Validations
type Validators (line 5) | module Validators
class AsValidator (line 6) | class AsValidator < Base
method validate_param! (line 10) | def validate_param!(*); end
FILE: lib/grape/validations/validators/at_least_one_of_validator.rb
type Grape (line 3) | module Grape
type Validations (line 4) | module Validations
type Validators (line 5) | module Validators
class AtLeastOneOfValidator (line 6) | class AtLeastOneOfValidator < MultipleParamsBase
method validate_params! (line 7) | def validate_params!(params)
FILE: lib/grape/validations/validators/base.rb
type Grape (line 3) | module Grape
type Validations (line 4) | module Validations
type Validators (line 5) | module Validators
class Base (line 6) | class Base
method initialize (line 19) | def initialize(attrs, options, required, scope, opts)
method validate (line 33) | def validate(request)
method validate! (line 44) | def validate!(params)
method inherited (line 62) | def self.inherited(klass)
method message (line 67) | def message(default_key = nil)
method options_key? (line 72) | def options_key?(key, options = nil)
method fail_fast? (line 77) | def fail_fast?
FILE: lib/grape/validations/validators/coerce_validator.rb
type Grape (line 3) | module Grape
type Validations (line 4) | module Validations
type Validators (line 5) | module Validators
class CoerceValidator (line 6) | class CoerceValidator < Base
method initialize (line 7) | def initialize(attrs, options, required, scope, opts)
method validate_param! (line 17) | def validate_param!(attr_name, params)
method valid_type? (line 48) | def valid_type?(val)
method coerce_value (line 52) | def coerce_value(val)
method type (line 62) | def type
method validation_exception (line 66) | def validation_exception(attr_name, custom_msg = nil)
FILE: lib/grape/validations/validators/contract_scope_validator.rb
type Grape (line 3) | module Grape
type Validations (line 4) | module Validations
type Validators (line 5) | module Validators
class ContractScopeValidator (line 6) | class ContractScopeValidator < Base
method initialize (line 9) | def initialize(_attrs, _options, _required, _scope, opts)
method validate (line 18) | def validate(request)
method build_errors_from_messages (line 31) | def build_errors_from_messages(messages)
FILE: lib/grape/validations/validators/default_validator.rb
type Grape (line 3) | module Grape
type Validations (line 4) | module Validations
type Validators (line 5) | module Validators
class DefaultValidator (line 6) | class DefaultValidator < Base
method initialize (line 7) | def initialize(attrs, options, required, scope, opts = {})
method validate_param! (line 12) | def validate_param!(attr_name, params)
method validate! (line 26) | def validate!(params)
FILE: lib/grape/validations/validators/exactly_one_of_validator.rb
type Grape (line 3) | module Grape
type Validations (line 4) | module Validations
type Validators (line 5) | module Validators
class ExactlyOneOfValidator (line 6) | class ExactlyOneOfValidator < MultipleParamsBase
method validate_params! (line 7) | def validate_params!(params)
FILE: lib/grape/validations/validators/except_values_validator.rb
type Grape (line 3) | module Grape
type Validations (line 4) | module Validations
type Validators (line 5) | module Validators
class ExceptValuesValidator (line 6) | class ExceptValuesValidator < Base
method initialize (line 7) | def initialize(attrs, options, required, scope, opts)
method validate_param! (line 12) | def validate_param!(attr_name, params)
FILE: lib/grape/validations/validators/length_validator.rb
type Grape (line 3) | module Grape
type Validations (line 4) | module Validations
type Validators (line 5) | module Validators
class LengthValidator (line 6) | class LengthValidator < Base
method initialize (line 7) | def initialize(attrs, options, required, scope, opts)
method validate_param! (line 23) | def validate_param!(attr_name, params)
method build_message (line 33) | def build_message
FILE: lib/grape/validations/validators/multiple_params_base.rb
type Grape (line 3) | module Grape
type Validations (line 4) | module Validations
type Validators (line 5) | module Validators
class MultipleParamsBase (line 6) | class MultipleParamsBase < Base
method validate! (line 7) | def validate!(params)
method keys_in_common (line 22) | def keys_in_common(resource_params)
method all_keys (line 28) | def all_keys
FILE: lib/grape/validations/validators/mutually_exclusive_validator.rb
type Grape (line 3) | module Grape
type Validations (line 4) | module Validations
type Validators (line 5) | module Validators
class MutuallyExclusiveValidator (line 6) | class MutuallyExclusiveValidator < MultipleParamsBase
method validate_params! (line 7) | def validate_params!(params)
FILE: lib/grape/validations/validators/presence_validator.rb
type Grape (line 3) | module Grape
type Validations (line 4) | module Validations
type Validators (line 5) | module Validators
class PresenceValidator (line 6) | class PresenceValidator < Base
method validate_param! (line 7) | def validate_param!(attr_name, params)
FILE: lib/grape/validations/validators/regexp_validator.rb
type Grape (line 3) | module Grape
type Validations (line 4) | module Validations
type Validators (line 5) | module Validators
class RegexpValidator (line 6) | class RegexpValidator < Base
method validate_param! (line 7) | def validate_param!(attr_name, params)
method scrub (line 18) | def scrub(param)
FILE: lib/grape/validations/validators/same_as_validator.rb
type Grape (line 3) | module Grape
type Validations (line 4) | module Validations
type Validators (line 5) | module Validators
class SameAsValidator (line 6) | class SameAsValidator < Base
method validate_param! (line 7) | def validate_param!(attr_name, params)
method build_message (line 19) | def build_message
FILE: lib/grape/validations/validators/values_validator.rb
type Grape (line 3) | module Grape
type Validations (line 4) | module Validations
type Validators (line 5) | module Validators
class ValuesValidator (line 6) | class ValuesValidator < Base
method initialize (line 7) | def initialize(attrs, options, required, scope, opts)
method validate_param! (line 12) | def validate_param!(attr_name, params)
method check_values? (line 34) | def check_values?(val, attr_name)
method required_for_root_scope? (line 49) | def required_for_root_scope?
FILE: lib/grape/version.rb
type Grape (line 3) | module Grape
FILE: lib/grape/xml.rb
type Grape (line 3) | module Grape
FILE: spec/grape/api/custom_validations_spec.rb
function validate_param! (line 18) | def validate_param!(attr_name, params)
function validate (line 70) | def validate(request)
function validate_param! (line 113) | def validate_param!(attr_name, _params)
function validate (line 152) | def validate(request)
function access_header (line 164) | def access_header
function validate_param! (line 218) | def validate_param!(_attr_name, _params)
FILE: spec/grape/api/inherited_helpers_spec.rb
function current_user (line 11) | def current_user
function current_user (line 22) | def current_user
function app (line 54) | def app
function app (line 74) | def app
function app (line 94) | def app
FILE: spec/grape/api/instance_spec.rb
function app (line 23) | def app
FILE: spec/grape/api/invalid_format_spec.rb
function app (line 6) | def app
FILE: spec/grape/api/mount_and_helpers_order_spec.rb
function app (line 30) | def app
function app (line 66) | def app
function app (line 100) | def app
function app (line 132) | def app
function app (line 166) | def app
function app (line 198) | def app
FILE: spec/grape/api/mount_and_rescue_from_spec.rb
function app (line 36) | def app
function app (line 70) | def app
FILE: spec/grape/api/mounted_helpers_inheritance_spec.rb
function parent_helper (line 17) | def parent_helper
function app (line 26) | def app
FILE: spec/grape/api/namespace_parameters_in_route_spec.rb
function app (line 6) | def app
FILE: spec/grape/api/nested_helpers_spec.rb
function current_user (line 8) | def current_user
function app (line 40) | def app
FILE: spec/grape/api/optional_parameters_in_route_spec.rb
function app (line 6) | def app
FILE: spec/grape/api/parameters_modification_spec.rb
function app (line 6) | def app
FILE: spec/grape/api/patch_method_helpers_spec.rb
function authenticate! (line 16) | def authenticate!; end
function app (line 46) | def app
FILE: spec/grape/api/required_parameters_in_route_spec.rb
function app (line 6) | def app
FILE: spec/grape/api/required_parameters_with_invalid_method_spec.rb
function app (line 6) | def app
FILE: spec/grape/api/routes_with_requirements_spec.rb
function app (line 6) | def app
FILE: spec/grape/api/shared_helpers_spec.rb
function app (line 27) | def app
FILE: spec/grape/api_remount_spec.rb
function printed_response (line 472) | def printed_response
FILE: spec/grape/api_spec.rb
function enable_root_route! (line 286) | def subject.enable_root_route!
function to_json (line 421) | def to_json(*_rest)
function to_txt (line 425) | def to_txt
function initialize (line 1401) | def initialize(app, *args)
function call (line 1407) | def call(env)
function before (line 1496) | def before
function initialize (line 1511) | def initialize(app, keyword:)
function call (line 1516) | def call(env)
function call (line 1540) | def call(env)
function call (line 1561) | def call(env)
function call (line 1582) | def call(env)
function authorize? (line 1658) | def authorize?(user, password)
function io (line 1696) | def self.io
function hello (line 1714) | def hello
function generic (line 1729) | def generic
function secret (line 1736) | def secret
function one (line 1758) | def one
function two (line 1764) | def two
function hello (line 1778) | def hello
function one (line 1794) | def one
function two (line 1799) | def two
function three (line 1804) | def three
function some_helper (line 1989) | def some_helper
function custom_error! (line 2046) | def custom_error!(name)
function foo (line 2063) | def foo
function foo (line 2078) | def foo
function rescue_arg_error (line 2325) | def rescue_arg_error
function rescue_no_method_error (line 2329) | def rescue_no_method_error
function rescue_arg_error (line 2356) | def rescue_arg_error
function rescue_all_errors (line 2360) | def rescue_all_errors
function call (line 2514) | def self.call(message, _backtrace, _options, _env, _original_exception)
function call (line 2876) | def self.call(object, _env)
function call (line 2936) | def self.call(object, _env)
function included (line 3890) | def self.included(base)
function my_method (line 3900) | def my_method
function before (line 4103) | def before
function serializable_hash (line 4121) | def serializable_hash
function before (line 4209) | def before
function inherited (line 4435) | def self.inherited(child_api)
function inherited (line 4461) | def inherited(api)
function uniqe_id_route (line 4514) | def uniqe_id_route
FILE: spec/grape/dsl/helpers_spec.rb
function mods (line 11) | def self.mods
function first_mod (line 15) | def self.first_mod
function test (line 23) | def test
FILE: spec/grape/dsl/inside_route_spec.rb
function initialize (line 13) | def initialize
function header (line 19) | def header(key = nil, val = nil)
function initialize (line 413) | def initialize
FILE: spec/grape/dsl/parameters_spec.rb
function initialize (line 12) | def initialize
function validate_attributes (line 16) | def validate_attributes(*args)
function validate_attributes_reader (line 20) | def validate_attributes_reader
function push_declared_params (line 24) | def push_declared_params(args, _opts)
function push_declared_params_reader (line 28) | def push_declared_params_reader
function validates (line 32) | def validates(*args)
function validates_reader (line 36) | def validates_reader
function new_scope (line 40) | def new_scope(element, **_opts, &block)
function new_group_scope (line 46) | def new_group_scope(group)
function extract_message_option (line 53) | def extract_message_option(attrs)
FILE: spec/grape/dsl/settings_spec.rb
function with_namespace (line 10) | def with_namespace(&block)
function reset_validations! (line 14) | def reset_validations!; end
FILE: spec/grape/dsl/validations_spec.rb
function schema (line 67) | def schema; end
FILE: spec/grape/endpoint_spec.rb
function app (line 6) | def app
function handle_argument_error (line 145) | def handle_argument_error
function memoized (line 750) | def memoized
FILE: spec/grape/exceptions/body_parse_errors_spec.rb
function app (line 19) | def app
function app (line 73) | def app
function app (line 111) | def app
function app (line 146) | def app
FILE: spec/grape/exceptions/invalid_accept_header_spec.rb
function app (line 54) | def app
function app (line 86) | def app
function app (line 129) | def app
function app (line 166) | def app
function app (line 204) | def app
function app (line 245) | def app
function app (line 288) | def app
function app (line 334) | def app
FILE: spec/grape/exceptions/validation_errors_spec.rb
function app (line 62) | def app
FILE: spec/grape/integration/global_namespace_function_spec.rb
function namespace (line 5) | def namespace
function app (line 19) | def app
FILE: spec/grape/loading_spec.rb
function app (line 38) | def app
FILE: spec/grape/middleware/base_spec.rb
function before (line 161) | def before
function after (line 165) | def after
function before (line 191) | def before
function after (line 195) | def after
function before (line 228) | def before
FILE: spec/grape/middleware/error_spec.rb
function static (line 9) | def static
function call (line 19) | def call(_env)
FILE: spec/grape/middleware/exception_spec.rb
function call (line 7) | def call(_env)
function call (line 17) | def call(_env)
function error! (line 37) | def error!(message, status)
function call (line 41) | def call(_env)
function error! (line 51) | def error!(message, status)
function call (line 55) | def call(_env)
FILE: spec/grape/middleware/formatter_spec.rb
function to_json (line 34) | def to_json(*_args)
function to_xml (line 51) | def to_xml
function call (line 451) | def self.call(_, _)
FILE: spec/grape/middleware/stack_spec.rb
function initialize (line 12) | def initialize(&block)
FILE: spec/grape/middleware/versioner/header_spec.rb
function app (line 309) | def app
function app (line 337) | def app
FILE: spec/grape/middleware/versioner/param_spec.rb
function app (line 101) | def app
function app (line 153) | def app
FILE: spec/grape/presenters/presenter_spec.rb
function initialize (line 12) | def initialize
FILE: spec/grape/util/registry_spec.rb
function registry_empty? (line 12) | def registry_empty?
function registry_get (line 16) | def registry_get(key)
function name (line 25) | def self.name
function name (line 33) | def self.name
function name (line 41) | def self.name
function name (line 51) | def self.name
function name (line 59) | def self.name
function name (line 155) | def self.name
function name (line 166) | def self.name
function name (line 177) | def self.name
FILE: spec/grape/util/translation_spec.rb
function translate_message (line 8) | def translate_message(key, **opts)
FILE: spec/grape/validations/params_documentation_spec.rb
function initialize (line 18) | def initialize(api)
function full_name (line 22) | def full_name(name)
FILE: spec/grape/validations/params_scope_spec.rb
function app (line 8) | def app
function parse (line 17) | def self.parse(value)
function initialize (line 23) | def initialize(value)
FILE: spec/grape/validations/types_spec.rb
function parse (line 6) | def self.parse(_); end
function parse (line 11) | def self.parse; end
FILE: spec/grape/validations/validators/base_i18n_spec.rb
function validate_param! (line 11) | def validate_param!(attr_name, params)
FILE: spec/grape/validations/validators/coerce_validator_spec.rb
function parse (line 11) | def self.parse(value)
function parsed? (line 15) | def self.parsed?(value)
function parse (line 256) | def self.parse(_val)
FILE: spec/grape/validations/validators/default_validator_spec.rb
function app (line 277) | def app
function app (line 393) | def app
function app (line 514) | def app
FILE: spec/grape/validations/validators/presence_validator_spec.rb
function app (line 10) | def app
function parse (line 289) | def self.parse(value)
FILE: spec/grape/validations/validators/values_validator_spec.rb
function values (line 7) | def values
function add_value (line 12) | def add_value(value)
function excepts (line 17) | def excepts
function add_except (line 22) | def add_except(except)
function include? (line 27) | def include?(value)
function even? (line 31) | def even?(value)
function default_values (line 37) | def default_values
function default_excepts (line 41) | def default_excepts
function app (line 590) | def app
FILE: spec/grape/validations_spec.rb
function define_optional_using (line 51) | def define_optional_using
function define_requires_all (line 192) | def define_requires_all
function define_requires_none (line 234) | def define_requires_none
function define_requires_all (line 276) | def define_requires_all
function define_requires_none (line 299) | def define_requires_none
function validate_param! (line 541) | def validate_param!(attr_name, params)
function validate_param! (line 1251) | def validate_param!(attr_name, params)
function validate_param! (line 1409) | def validate_param!(attr_name, params)
FILE: spec/integration/grape_entity/entity_spec.rb
function first (line 14) | def first
function initialize (line 170) | def initialize(id)
function initialize (line 192) | def initialize(id)
function initialize (line 217) | def initialize(args)
function initialize (line 247) | def initialize(args)
function initialize (line 276) | def initialize(args)
function initialize (line 295) | def initialize(args)
function static (line 328) | def static
function call (line 340) | def call(_env)
function static (line 379) | def static
FILE: spec/support/basic_auth_encode_helpers.rb
type Spec (line 3) | module Spec
type Support (line 4) | module Support
type Helpers (line 5) | module Helpers
function encode_basic_auth (line 6) | def encode_basic_auth(username, password)
FILE: spec/support/chunked_response.rb
class ChunkedResponse (line 5) | class ChunkedResponse
class Body (line 6) | class Body
method initialize (line 11) | def initialize(body)
method each (line 17) | def each(&)
method close (line 31) | def close
method yield_trailers (line 38) | def yield_trailers; end
class TrailerBody (line 41) | class TrailerBody < Body
method yield_trailers (line 45) | def yield_trailers
method initialize (line 52) | def initialize(app)
method call (line 56) | def call(env)
FILE: spec/support/content_type_helpers.rb
type Spec (line 3) | module Spec
type Support (line 4) | module Support
type Helpers (line 5) | module Helpers
FILE: spec/support/cookie_jar.rb
type Spec (line 4) | module Spec
type Support (line 5) | module Support
class CookieJar (line 7) | class CookieJar
method initialize (line 10) | def initialize(raw)
method to_h (line 21) | def to_h
method to_s (line 25) | def to_s
method unescape (line 31) | def unescape(value)
method parse_value (line 35) | def parse_value(attribute, value)
type Rack (line 51) | module Rack
class MockResponse (line 52) | class MockResponse
method cookie_jar (line 53) | def cookie_jar
FILE: spec/support/deprecated_warning_handlers.rb
type DeprecatedWarningHandler (line 5) | module DeprecatedWarningHandler
class DeprecationWarning (line 6) | class DeprecationWarning < StandardError; end
function warn (line 10) | def warn(message)
FILE: spec/support/deregister.rb
type Deregister (line 3) | module Deregister
function deregister (line 4) | def deregister(key)
FILE: spec/support/endpoint_faker.rb
type Spec (line 3) | module Spec
type Support (line 4) | module Support
class EndpointFaker (line 5) | class EndpointFaker
class FakerAPI (line 6) | class FakerAPI < Grape::API
method initialize (line 10) | def initialize(app, endpoint = FakerAPI.endpoints.first)
method call (line 15) | def call(env)
FILE: spec/support/file_streamer.rb
class FileStreamer (line 3) | class FileStreamer
method initialize (line 4) | def initialize(file_path)
method each (line 8) | def each(&blk)
FILE: spec/support/integer_helpers.rb
type Spec (line 3) | module Spec
type Support (line 4) | module Support
type Helpers (line 5) | module Helpers
function integer_class_name (line 8) | def integer_class_name
FILE: spec/support/versioned_helpers.rb
type Spec (line 4) | module Spec
type Support (line 5) | module Support
type Helpers (line 6) | module Helpers
function versioned_path (line 9) | def versioned_path(options)
function versioned_headers (line 20) | def versioned_headers(options)
function versioned_get (line 40) | def versioned_get(path, version_name, version_options)
Condensed preview — 334 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (2,039K chars).
[
{
"path": ".coveralls.yml",
"chars": 21,
"preview": "service_name: github\n"
},
{
"path": ".dockerignore",
"chars": 426,
"preview": "## MAC OS\n.DS_Store\n.com.apple.timemachine.supported\n\n## TEXTMATE\n*.tmproj\ntmtags\n\n## EMACS\n*~\n\\#*\n.\\#*\n\n## REDCAR\n.redc"
},
{
"path": ".github/FUNDING.yml",
"chars": 56,
"preview": "tidelift: \"rubygems/grape\"\ngithub: [dblock, ericproulx]\n"
},
{
"path": ".github/workflows/danger-comment.yml",
"chars": 208,
"preview": "name: Danger Comment\n\non:\n workflow_run:\n workflows: [Danger]\n types: [completed]\n\njobs:\n comment:\n uses: num"
},
{
"path": ".github/workflows/danger.yml",
"chars": 261,
"preview": "name: Danger\n\non:\n pull_request:\n types: [opened, reopened, edited, synchronize]\n\njobs:\n danger:\n uses: numbata/"
},
{
"path": ".github/workflows/edge.yml",
"chars": 1097,
"preview": "---\nname: edge\non: workflow_dispatch\njobs:\n test:\n strategy:\n fail-fast: false\n matrix:\n ruby: ['3."
},
{
"path": ".github/workflows/test.yml",
"chars": 2362,
"preview": "name: test\n\non: [push, pull_request]\n\njobs:\n lint:\n name: RuboCop\n runs-on: ubuntu-latest\n steps:\n - uses: "
},
{
"path": ".gitignore",
"chars": 427,
"preview": "## MAC OS\n.DS_Store\n.com.apple.timemachine.supported\n\n## TEXTMATE\n*.tmproj\ntmtags\n\n## EMACS\n*~\n\\#*\n.\\#*\n\n## REDCAR\n.redc"
},
{
"path": ".rspec",
"chars": 77,
"preview": "--require spec_helper\n--color\n--format=documentation\n--order=rand\n--warnings\n"
},
{
"path": ".rubocop.yml",
"chars": 1312,
"preview": "AllCops:\n NewCops: enable\n TargetRubyVersion: 3.2\n SuggestExtensions: false\n Exclude:\n - vendor/**/*\n - bin/**"
},
{
"path": ".rubocop_todo.yml",
"chars": 5182,
"preview": "# This configuration was generated by\n# `rubocop --auto-gen-config`\n# on 2026-01-31 18:13:50 UTC using RuboCop version 1"
},
{
"path": ".simplecov",
"chars": 383,
"preview": "# frozen_string_literal: true\n\nif ENV['GITHUB_USER'] # only when running CI\n require 'simplecov-lcov'\n SimpleCov::Form"
},
{
"path": ".yardopts",
"chars": 36,
"preview": "--asset grape.png\n--markup markdown\n"
},
{
"path": "CHANGELOG.md",
"chars": 124501,
"preview": "### 3.2.0 (Next)\n\n#### Features\n\n* [#2662](https://github.com/ruby-grape/grape/pull/2662): Extract `Grape::Util::Transla"
},
{
"path": "CONTRIBUTING.md",
"chars": 4746,
"preview": "Contributing to Grape\n=====================\n\nGrape is work of [hundreds of contributors](https://github.com/ruby-grape/g"
},
{
"path": "Dangerfile",
"chars": 100,
"preview": "# frozen_string_literal: true\n\ndanger.import_dangerfile(gem: 'danger-pr-comment')\n\nchangelog.check!\n"
},
{
"path": "Gemfile",
"chars": 807,
"preview": "# frozen_string_literal: true\n\nsource('https://rubygems.org')\n\ngemspec\n\ngroup :development, :test do\n gem 'builder', re"
},
{
"path": "Guardfile",
"chars": 341,
"preview": "# frozen_string_literal: true\n\nguard :rspec, all_on_start: true, cmd: 'bundle exec rspec' do\n watch(%r{^spec/.+_spec\\.r"
},
{
"path": "LICENSE",
"chars": 1096,
"preview": "Copyright (c) 2010-2020 Michael Bleigh, Intridea Inc. and Contributors.\n\nPermission is hereby granted, free of charge, t"
},
{
"path": "README.md",
"chars": 116191,
"preview": "\n\n[](http://badge.fury.io/rb/grape)\n[\nrequire('bundler')\nBundler.setup(:default, :test, :development)\n\nBund"
},
{
"path": "SECURITY.md",
"chars": 351,
"preview": "# Security Policy\n\n## Supported Versions\n\nVersion 2.2 or newer is currently supported.\n\n## Reporting a Vulnerability\n\nTi"
},
{
"path": "UPGRADING.md",
"chars": 59728,
"preview": "Upgrading Grape\n===============\n\n### Upgrading to >= 3.2\n\n#### `with` now uses keyword arguments\n\nThe `with` DSL method "
},
{
"path": "benchmark/compile_many_routes.rb",
"chars": 382,
"preview": "# frozen_string_literal: true\n\n$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))\nrequire 'grape'\nrequir"
},
{
"path": "benchmark/issue_mounting.rb",
"chars": 658,
"preview": "# frozen_string_literal: true\n\nrequire 'bundler/inline'\n\ngemfile(true) do\n source 'https://rubygems.org'\n gem 'grape'\n"
},
{
"path": "benchmark/large_model.rb",
"chars": 8906,
"preview": "# frozen_string_literal: true\n\n# gem 'grape', '=1.0.1'\n\nrequire 'grape'\nrequire 'ruby-prof'\nrequire 'hashie'\n\nclass API "
},
{
"path": "benchmark/nested_params.rb",
"chars": 779,
"preview": "# frozen_string_literal: true\n\n$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))\nrequire 'grape'\nrequir"
},
{
"path": "benchmark/remounting.rb",
"chars": 958,
"preview": "# frozen_string_literal: true\n\n$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))\nrequire 'grape'\nrequir"
},
{
"path": "benchmark/resource/vrp_example.json",
"chars": 499023,
"preview": "{\"vrp\":{\"points\":[{\"id\":\"1002100\",\"location\":{\"lat\":48.865,\"lon\":2.3054}},{\"id\":\"1103548\",\"location\":{\"lat\":48.8711,\"lon"
},
{
"path": "benchmark/simple.rb",
"chars": 459,
"preview": "# frozen_string_literal: true\n\n$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))\nrequire 'grape'\nrequir"
},
{
"path": "docker/Dockerfile",
"chars": 620,
"preview": "ARG RUBY_VERSION=4\nFROM ruby:${RUBY_VERSION}-slim\n\nENV BUNDLE_PATH /usr/local/bundle/gems\nENV LIB_PATH /var/grape\n\nRUN a"
},
{
"path": "docker/entrypoint.sh",
"chars": 393,
"preview": "#!/bin/sh\n\nset -e\n\n# Useful information\necho -e \"$(ruby --version)\\nrubygems $(gem --version)\\n$(bundle version)\"\nif [ -"
},
{
"path": "docker-compose.yml",
"chars": 257,
"preview": "volumes:\n gems:\n\nservices:\n grape:\n build:\n context: .\n dockerfile: docker/Dockerfile\n args:\n "
},
{
"path": "gemfiles/dry_validation.gemfile",
"chars": 79,
"preview": "# frozen_string_literal: true\n\neval_gemfile '../Gemfile'\n\ngem 'dry-validation'\n"
},
{
"path": "gemfiles/grape_entity.gemfile",
"chars": 77,
"preview": "# frozen_string_literal: true\n\neval_gemfile '../Gemfile'\n\ngem 'grape-entity'\n"
},
{
"path": "gemfiles/hashie.gemfile",
"chars": 71,
"preview": "# frozen_string_literal: true\n\neval_gemfile '../Gemfile'\n\ngem 'hashie'\n"
},
{
"path": "gemfiles/multi_json.gemfile",
"chars": 75,
"preview": "# frozen_string_literal: true\n\ngem 'multi_json'\n\neval_gemfile '../Gemfile'\n"
},
{
"path": "gemfiles/multi_xml.gemfile",
"chars": 74,
"preview": "# frozen_string_literal: true\n\ngem 'multi_xml'\n\neval_gemfile '../Gemfile'\n"
},
{
"path": "gemfiles/rack_2_2.gemfile",
"chars": 81,
"preview": "# frozen_string_literal: true\n\neval_gemfile '../Gemfile'\n\ngem 'rack', '~> 2.2.0'\n"
},
{
"path": "gemfiles/rack_3_0.gemfile",
"chars": 81,
"preview": "# frozen_string_literal: true\n\neval_gemfile '../Gemfile'\n\ngem 'rack', '~> 3.0.0'\n"
},
{
"path": "gemfiles/rack_3_1.gemfile",
"chars": 81,
"preview": "# frozen_string_literal: true\n\neval_gemfile '../Gemfile'\n\ngem 'rack', '~> 3.1.0'\n"
},
{
"path": "gemfiles/rack_3_2.gemfile",
"chars": 81,
"preview": "# frozen_string_literal: true\n\neval_gemfile '../Gemfile'\n\ngem 'rack', '~> 3.2.0'\n"
},
{
"path": "gemfiles/rack_edge.gemfile",
"chars": 90,
"preview": "# frozen_string_literal: true\n\neval_gemfile '../Gemfile'\n\ngem 'rack', github: 'rack/rack'\n"
},
{
"path": "gemfiles/rails_7_2.gemfile",
"chars": 116,
"preview": "# frozen_string_literal: true\n\neval_gemfile '../Gemfile'\n\ngem 'rails', '~> 7.2.0'\ngem 'tzinfo-data', require: false\n"
},
{
"path": "gemfiles/rails_8_0.gemfile",
"chars": 116,
"preview": "# frozen_string_literal: true\n\neval_gemfile '../Gemfile'\n\ngem 'rails', '~> 8.0.0'\ngem 'tzinfo-data', require: false\n"
},
{
"path": "gemfiles/rails_8_1.gemfile",
"chars": 116,
"preview": "# frozen_string_literal: true\n\neval_gemfile '../Gemfile'\n\ngem 'rails', '~> 8.1.0'\ngem 'tzinfo-data', require: false\n"
},
{
"path": "gemfiles/rails_edge.gemfile",
"chars": 127,
"preview": "# frozen_string_literal: true\n\neval_gemfile '../Gemfile'\n\ngem 'rails', github: 'rails/rails'\ngem 'tzinfo-data', require:"
},
{
"path": "grape.gemspec",
"chars": 1347,
"preview": "# frozen_string_literal: true\n\nrequire_relative 'lib/grape/version'\n\nGem::Specification.new do |s|\n s.name = 'gr"
},
{
"path": "lib/grape/api/instance.rb",
"chars": 6863,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n class API\n # The API Instance class, is the engine behind Grape::API. E"
},
{
"path": "lib/grape/api.rb",
"chars": 6242,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n # The API class is the primary entry point for creating Grape APIs. Users\n"
},
{
"path": "lib/grape/content_types.rb",
"chars": 752,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module ContentTypes\n module_function\n\n # Content types are listed in"
},
{
"path": "lib/grape/cookies.rb",
"chars": 952,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n class Cookies\n extend Forwardable\n\n DELETED_COOKIES_ATTRS = {\n "
},
{
"path": "lib/grape/declared_params_handler.rb",
"chars": 4415,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n class DeclaredParamsHandler\n def initialize(include_missing: true, eval"
},
{
"path": "lib/grape/dry_types.rb",
"chars": 1864,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module DryTypes\n # https://dry-rb.org/gems/dry-types/main/getting-start"
},
{
"path": "lib/grape/dsl/callbacks.rb",
"chars": 840,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module DSL\n module Callbacks\n # before: execute the given block be"
},
{
"path": "lib/grape/dsl/declared.rb",
"chars": 1822,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module DSL\n module Declared\n # Denotes a situation where a DSL met"
},
{
"path": "lib/grape/dsl/desc.rb",
"chars": 2900,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module DSL\n module Desc\n extend Grape::DSL::Settings\n\n # Add "
},
{
"path": "lib/grape/dsl/headers.rb",
"chars": 554,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module DSL\n module Headers\n # This method has four responsibilitie"
},
{
"path": "lib/grape/dsl/helpers.rb",
"chars": 2674,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module DSL\n module Helpers\n # Add helper methods that will be acce"
},
{
"path": "lib/grape/dsl/inside_route.rb",
"chars": 9866,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module DSL\n module InsideRoute\n include Declared\n\n # Backward"
},
{
"path": "lib/grape/dsl/logger.rb",
"chars": 546,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module DSL\n module Logger\n # Set or retrive the configured logger."
},
{
"path": "lib/grape/dsl/middleware.rb",
"chars": 1045,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module DSL\n module Middleware\n # Apply a custom middleware to the "
},
{
"path": "lib/grape/dsl/parameters.rb",
"chars": 9524,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module DSL\n # Defines DSL methods, meant to be applied to a ParamsScope"
},
{
"path": "lib/grape/dsl/request_response.rb",
"chars": 6941,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module DSL\n module RequestResponse\n # Specify the default format f"
},
{
"path": "lib/grape/dsl/routing.rb",
"chars": 9492,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module DSL\n module Routing\n attr_reader :endpoints\n\n def give"
},
{
"path": "lib/grape/dsl/settings.rb",
"chars": 2438,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module DSL\n # Keeps track of settings (implemented as key-value pairs, "
},
{
"path": "lib/grape/dsl/validations.rb",
"chars": 1876,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module DSL\n module Validations\n # Opens a root-level ParamsScope, "
},
{
"path": "lib/grape/endpoint.rb",
"chars": 14846,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n # An Endpoint is the proxy scope in which all routing\n # blocks are execu"
},
{
"path": "lib/grape/env.rb",
"chars": 574,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Env\n API_VERSION = 'api.version'\n API_ENDPOINT = 'api.endpoin"
},
{
"path": "lib/grape/error_formatter/base.rb",
"chars": 2456,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module ErrorFormatter\n class Base\n class << self\n def call("
},
{
"path": "lib/grape/error_formatter/json.rb",
"chars": 669,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module ErrorFormatter\n class Json < Base\n class << self\n de"
},
{
"path": "lib/grape/error_formatter/serializable_hash.rb",
"chars": 117,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module ErrorFormatter\n class SerializableHash < Json; end\n end\nend\n"
},
{
"path": "lib/grape/error_formatter/txt.rb",
"chars": 704,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module ErrorFormatter\n class Txt < Base\n def self.format_structure"
},
{
"path": "lib/grape/error_formatter/xml.rb",
"chars": 294,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module ErrorFormatter\n class Xml < Base\n def self.format_structure"
},
{
"path": "lib/grape/error_formatter.rb",
"chars": 379,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module ErrorFormatter\n extend Grape::Util::Registry\n\n module_functio"
},
{
"path": "lib/grape/exceptions/base.rb",
"chars": 1190,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Exceptions\n class Base < StandardError\n include Grape::Util"
},
{
"path": "lib/grape/exceptions/conflicting_types.rb",
"chars": 220,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Exceptions\n class ConflictingTypes < Base\n def initialize\n "
},
{
"path": "lib/grape/exceptions/empty_message_body.rb",
"chars": 260,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Exceptions\n class EmptyMessageBody < Base\n def initialize(b"
},
{
"path": "lib/grape/exceptions/incompatible_option_values.rb",
"chars": 326,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Exceptions\n class IncompatibleOptionValues < Base\n def init"
},
{
"path": "lib/grape/exceptions/invalid_accept_header.rb",
"chars": 281,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Exceptions\n class InvalidAcceptHeader < Base\n def initializ"
},
{
"path": "lib/grape/exceptions/invalid_formatter.rb",
"chars": 261,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Exceptions\n class InvalidFormatter < Base\n def initialize(k"
},
{
"path": "lib/grape/exceptions/invalid_message_body.rb",
"chars": 264,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Exceptions\n class InvalidMessageBody < Base\n def initialize"
},
{
"path": "lib/grape/exceptions/invalid_parameters.rb",
"chars": 222,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Exceptions\n class InvalidParameters < Base\n def initialize\n"
},
{
"path": "lib/grape/exceptions/invalid_response.rb",
"chars": 205,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Exceptions\n class InvalidResponse < Base\n def initialize\n "
},
{
"path": "lib/grape/exceptions/invalid_version_header.rb",
"chars": 283,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Exceptions\n class InvalidVersionHeader < Base\n def initiali"
},
{
"path": "lib/grape/exceptions/invalid_versioner_option.rb",
"chars": 250,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Exceptions\n class InvalidVersionerOption < Base\n def initia"
},
{
"path": "lib/grape/exceptions/invalid_with_option_for_represent.rb",
"chars": 236,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Exceptions\n class InvalidWithOptionForRepresent < Base\n def"
},
{
"path": "lib/grape/exceptions/method_not_allowed.rb",
"chars": 229,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Exceptions\n class MethodNotAllowed < Base\n def initialize(h"
},
{
"path": "lib/grape/exceptions/missing_group_type.rb",
"chars": 208,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Exceptions\n class MissingGroupType < Base\n def initialize\n "
},
{
"path": "lib/grape/exceptions/missing_mime_type.rb",
"chars": 242,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Exceptions\n class MissingMimeType < Base\n def initialize(ne"
},
{
"path": "lib/grape/exceptions/missing_vendor_option.rb",
"chars": 214,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Exceptions\n class MissingVendorOption < Base\n def initializ"
},
{
"path": "lib/grape/exceptions/too_deep_parameters.rb",
"chars": 244,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Exceptions\n class TooDeepParameters < Base\n def initialize("
},
{
"path": "lib/grape/exceptions/too_many_multipart_files.rb",
"chars": 253,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Exceptions\n class TooManyMultipartFiles < Base\n def initial"
},
{
"path": "lib/grape/exceptions/unknown_auth_strategy.rb",
"chars": 245,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Exceptions\n class UnknownAuthStrategy < Base\n def initializ"
},
{
"path": "lib/grape/exceptions/unknown_parameter.rb",
"chars": 228,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Exceptions\n class UnknownParameter < Base\n def initialize(p"
},
{
"path": "lib/grape/exceptions/unknown_params_builder.rb",
"chars": 279,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Exceptions\n class UnknownParamsBuilder < Base\n def initiali"
},
{
"path": "lib/grape/exceptions/unknown_validator.rb",
"chars": 255,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Exceptions\n class UnknownValidator < Base\n def initialize(v"
},
{
"path": "lib/grape/exceptions/unsupported_group_type.rb",
"chars": 216,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Exceptions\n class UnsupportedGroupType < Base\n def initiali"
},
{
"path": "lib/grape/exceptions/validation.rb",
"chars": 785,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Exceptions\n class Validation < Base\n attr_reader :params, :"
},
{
"path": "lib/grape/exceptions/validation_array_errors.rb",
"chars": 228,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Exceptions\n class ValidationArrayErrors < Base\n attr_reader"
},
{
"path": "lib/grape/exceptions/validation_errors.rb",
"chars": 1296,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Exceptions\n class ValidationErrors < Base\n include Enumerab"
},
{
"path": "lib/grape/formatter/base.rb",
"chars": 266,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Formatter\n class Base\n def self.call(_object, _env)\n "
},
{
"path": "lib/grape/formatter/json.rb",
"chars": 245,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Formatter\n class Json < Base\n def self.call(object, _env)\n "
},
{
"path": "lib/grape/formatter/serializable_hash.rb",
"chars": 1082,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Formatter\n class SerializableHash < Base\n class << self\n "
},
{
"path": "lib/grape/formatter/txt.rb",
"chars": 212,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Formatter\n class Txt < Base\n def self.call(object, _env)\n "
},
{
"path": "lib/grape/formatter/xml.rb",
"chars": 282,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Formatter\n class Xml < Base\n def self.call(object, _env)\n "
},
{
"path": "lib/grape/formatter.rb",
"chars": 360,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Formatter\n extend Grape::Util::Registry\n\n module_function\n\n "
},
{
"path": "lib/grape/json.rb",
"chars": 170,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n if defined?(::MultiJson)\n Json = ::MultiJson\n else\n Json = ::JSON\n "
},
{
"path": "lib/grape/locale/en.yml",
"chars": 3447,
"preview": "---\nen:\n grape:\n errors:\n format: '%{attributes} %{message}'\n messages:\n all_or_none: 'provide all "
},
{
"path": "lib/grape/middleware/auth/base.rb",
"chars": 638,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Middleware\n module Auth\n class Base < Grape::Middleware::Ba"
},
{
"path": "lib/grape/middleware/auth/dsl.rb",
"chars": 1152,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Middleware\n module Auth\n module DSL\n def auth(type ="
},
{
"path": "lib/grape/middleware/auth/strategies.rb",
"chars": 562,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Middleware\n module Auth\n module Strategies\n module_f"
},
{
"path": "lib/grape/middleware/auth/strategy_info.rb",
"chars": 340,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Middleware\n module Auth\n StrategyInfo = Struct.new(:auth_cl"
},
{
"path": "lib/grape/middleware/base.rb",
"chars": 3218,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Middleware\n class Base\n include Grape::DSL::Headers\n\n "
},
{
"path": "lib/grape/middleware/error.rb",
"chars": 4930,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Middleware\n class Error < Base\n DEFAULT_OPTIONS = {\n "
},
{
"path": "lib/grape/middleware/filter.rb",
"chars": 502,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Middleware\n # This is a simple middleware for adding before and "
},
{
"path": "lib/grape/middleware/formatter.rb",
"chars": 5343,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Middleware\n class Formatter < Base\n DEFAULT_OPTIONS = {\n "
},
{
"path": "lib/grape/middleware/globals.rb",
"chars": 432,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Middleware\n class Globals < Base\n def before\n reques"
},
{
"path": "lib/grape/middleware/stack.rb",
"chars": 3193,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Middleware\n # Class to handle the stack of middlewares based on "
},
{
"path": "lib/grape/middleware/versioner/accept_version_header.rb",
"chars": 1202,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Middleware\n module Versioner\n # This middleware sets variou"
},
{
"path": "lib/grape/middleware/versioner/base.rb",
"chars": 2131,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Middleware\n module Versioner\n class Base < Grape::Middlewar"
},
{
"path": "lib/grape/middleware/versioner/header.rb",
"chars": 3551,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Middleware\n module Versioner\n # This middleware sets variou"
},
{
"path": "lib/grape/middleware/versioner/param.rb",
"chars": 1101,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Middleware\n module Versioner\n # This middleware sets variou"
},
{
"path": "lib/grape/middleware/versioner/path.rb",
"chars": 1359,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Middleware\n module Versioner\n # This middleware sets variou"
},
{
"path": "lib/grape/middleware/versioner.rb",
"chars": 881,
"preview": "# frozen_string_literal: true\n\n# Versioners set env['api.version'] when a version is defined on an API and\n# on the requ"
},
{
"path": "lib/grape/namespace.rb",
"chars": 1640,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n # A container for endpoints or other namespaces, which allows for both\n #"
},
{
"path": "lib/grape/params_builder/base.rb",
"chars": 319,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module ParamsBuilder\n class Base\n class << self\n def call(_"
},
{
"path": "lib/grape/params_builder/hash.rb",
"chars": 180,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module ParamsBuilder\n class Hash < Base\n def self.call(params)\n "
},
{
"path": "lib/grape/params_builder/hash_with_indifferent_access.rb",
"chars": 205,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module ParamsBuilder\n class HashWithIndifferentAccess < Base\n def "
},
{
"path": "lib/grape/params_builder/hashie_mash.rb",
"chars": 186,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module ParamsBuilder\n class HashieMash < Base\n def self.call(param"
},
{
"path": "lib/grape/params_builder.rb",
"chars": 304,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module ParamsBuilder\n extend Grape::Util::Registry\n\n module_function"
},
{
"path": "lib/grape/parser/base.rb",
"chars": 260,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Parser\n class Base\n def self.call(_object, _env)\n ra"
},
{
"path": "lib/grape/parser/json.rb",
"chars": 380,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Parser\n class Json < Base\n def self.call(object, _env)\n "
},
{
"path": "lib/grape/parser/xml.rb",
"chars": 376,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Parser\n class Xml < Base\n def self.call(object, _env)\n "
},
{
"path": "lib/grape/parser.rb",
"chars": 253,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Parser\n extend Grape::Util::Registry\n\n module_function\n\n d"
},
{
"path": "lib/grape/path.rb",
"chars": 2082,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n # Represents a path to an endpoint.\n class Path\n DEFAULT_FORMAT_SEGMEN"
},
{
"path": "lib/grape/presenters/presenter.rb",
"chars": 172,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Presenters\n class Presenter\n def self.represent(object, **_"
},
{
"path": "lib/grape/railtie.rb",
"chars": 190,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n class Railtie < ::Rails::Railtie\n initializer 'grape.deprecator' do |ap"
},
{
"path": "lib/grape/request.rb",
"chars": 4727,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n class Request < Rack::Request\n # Based on rack 3 KNOWN_HEADERS\n # ht"
},
{
"path": "lib/grape/router/base_route.rb",
"chars": 1244,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n class Router\n class BaseRoute\n extend Forwardable\n\n delegate_"
},
{
"path": "lib/grape/router/greedy_route.rb",
"chars": 505,
"preview": "# frozen_string_literal: true\n\n# Act like a Grape::Router::Route but for greedy_match\n# see @neutral_map\n\nmodule Grape\n "
},
{
"path": "lib/grape/router/pattern.rb",
"chars": 1824,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n class Router\n class Pattern\n extend Forwardable\n\n DEFAULT_CAP"
},
{
"path": "lib/grape/router/route.rb",
"chars": 1429,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n class Router\n class Route < BaseRoute\n extend Forwardable\n\n F"
},
{
"path": "lib/grape/router.rb",
"chars": 5188,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n class Router\n # Taken from Rails\n # normalize_path(\"/foo\") # =>"
},
{
"path": "lib/grape/serve_stream/file_body.rb",
"chars": 619,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module ServeStream\n CHUNK_SIZE = 16_384\n\n # Class helps send file th"
},
{
"path": "lib/grape/serve_stream/sendfile_response.rb",
"chars": 461,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module ServeStream\n # Response should respond to to_path method\n # f"
},
{
"path": "lib/grape/serve_stream/stream_response.rb",
"chars": 521,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module ServeStream\n # A simple class used to identify responses which r"
},
{
"path": "lib/grape/util/api_description.rb",
"chars": 1145,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Util\n class ApiDescription\n DSL_METHODS = %i[\n body_"
},
{
"path": "lib/grape/util/base_inheritable.rb",
"chars": 1214,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Util\n # Base for classes which need to operate with own values k"
},
{
"path": "lib/grape/util/cache.rb",
"chars": 277,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Util\n class Cache\n include Singleton\n\n attr_reader :ca"
},
{
"path": "lib/grape/util/endpoint_configuration.rb",
"chars": 126,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Util\n class EndpointConfiguration < Lazy::ValueHash\n end\n en"
},
{
"path": "lib/grape/util/header.rb",
"chars": 272,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Util\n if Gem::Version.new(Rack.release) >= Gem::Version.new('3')"
},
{
"path": "lib/grape/util/inheritable_setting.rb",
"chars": 3729,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Util\n # A branchable, inheritable settings object which can stor"
},
{
"path": "lib/grape/util/inheritable_values.rb",
"chars": 446,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Util\n class InheritableValues < BaseInheritable\n def [](nam"
},
{
"path": "lib/grape/util/lazy/block.rb",
"chars": 447,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Util\n module Lazy\n class Block\n def initialize(&new_"
},
{
"path": "lib/grape/util/lazy/value.rb",
"chars": 728,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Util\n module Lazy\n class Value\n attr_reader :access_"
},
{
"path": "lib/grape/util/lazy/value_array.rb",
"chars": 396,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Util\n module Lazy\n class ValueArray < ValueEnumerable\n "
},
{
"path": "lib/grape/util/lazy/value_enumerable.rb",
"chars": 920,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Util\n module Lazy\n class ValueEnumerable < Value\n de"
},
{
"path": "lib/grape/util/lazy/value_hash.rb",
"chars": 433,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Util\n module Lazy\n class ValueHash < ValueEnumerable\n "
},
{
"path": "lib/grape/util/media_type.rb",
"chars": 1932,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Util\n class MediaType\n attr_reader :type, :subtype, :vendor"
},
{
"path": "lib/grape/util/registry.rb",
"chars": 647,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Util\n module Registry\n def register(klass)\n short_na"
},
{
"path": "lib/grape/util/reverse_stackable_values.rb",
"chars": 291,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Util\n class ReverseStackableValues < StackableValues\n prote"
},
{
"path": "lib/grape/util/stackable_values.rb",
"chars": 806,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Util\n class StackableValues < BaseInheritable\n # Even if th"
},
{
"path": "lib/grape/util/translation.rb",
"chars": 1707,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Util\n module Translation\n FALLBACK_LOCALE = :en\n priva"
},
{
"path": "lib/grape/validations/attributes_iterator.rb",
"chars": 2725,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Validations\n class AttributesIterator\n include Enumerable\n\n"
},
{
"path": "lib/grape/validations/contract_scope.rb",
"chars": 1209,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Validations\n class ContractScope\n # Declare the contract to"
},
{
"path": "lib/grape/validations/multiple_attributes_iterator.rb",
"chars": 270,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Validations\n class MultipleAttributesIterator < AttributesIterat"
},
{
"path": "lib/grape/validations/param_scope_tracker.rb",
"chars": 1882,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Validations\n # Holds per-request mutable state that must not liv"
},
{
"path": "lib/grape/validations/params_documentation.rb",
"chars": 1917,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Validations\n # Documents parameters of an endpoint. If documenta"
},
{
"path": "lib/grape/validations/params_scope.rb",
"chars": 20935,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Validations\n class ParamsScope\n attr_accessor :element, :pa"
},
{
"path": "lib/grape/validations/single_attribute_iterator.rb",
"chars": 590,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Validations\n class SingleAttributeIterator < AttributesIterator\n"
},
{
"path": "lib/grape/validations/types/array_coercer.rb",
"chars": 1737,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Validations\n module Types\n # Coerces elements in an array. "
},
{
"path": "lib/grape/validations/types/custom_type_coercer.rb",
"chars": 5970,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Validations\n module Types\n # This class will detect type cl"
},
{
"path": "lib/grape/validations/types/custom_type_collection_coercer.rb",
"chars": 2131,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Validations\n module Types\n # See {CustomTypeCoercer} for de"
},
{
"path": "lib/grape/validations/types/dry_type_coercer.rb",
"chars": 1753,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Validations\n module Types\n # A base class for classes which"
},
{
"path": "lib/grape/validations/types/file.rb",
"chars": 961,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Validations\n module Types\n # Implementation for parameters "
},
{
"path": "lib/grape/validations/types/invalid_value.rb",
"chars": 415,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Validations\n module Types\n # Instances of this class may be"
},
{
"path": "lib/grape/validations/types/json.rb",
"chars": 2277,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Validations\n module Types\n # Handles coercion and type chec"
},
{
"path": "lib/grape/validations/types/multiple_type_coercer.rb",
"chars": 2187,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Validations\n module Types\n # This class is intended for use"
},
{
"path": "lib/grape/validations/types/primitive_coercer.rb",
"chars": 1454,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Validations\n module Types\n # Coerces the given value to a t"
},
{
"path": "lib/grape/validations/types/set_coercer.rb",
"chars": 789,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Validations\n module Types\n # Takes the given array and conv"
},
{
"path": "lib/grape/validations/types/variant_collection_coercer.rb",
"chars": 1888,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Validations\n module Types\n # This class wraps {MultipleType"
},
{
"path": "lib/grape/validations/types.rb",
"chars": 7010,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Validations\n # Module for code related to grape's system for\n "
},
{
"path": "lib/grape/validations/validator_factory.rb",
"chars": 452,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Validations\n class ValidatorFactory\n def self.create_valida"
},
{
"path": "lib/grape/validations/validators/all_or_none_of_validator.rb",
"chars": 425,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Validations\n module Validators\n class AllOrNoneOfValidator "
},
{
"path": "lib/grape/validations/validators/allow_blank_validator.rb",
"chars": 609,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Validations\n module Validators\n class AllowBlankValidator <"
},
{
"path": "lib/grape/validations/validators/as_validator.rb",
"chars": 361,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Validations\n module Validators\n class AsValidator < Base\n "
},
{
"path": "lib/grape/validations/validators/at_least_one_of_validator.rb",
"chars": 375,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Validations\n module Validators\n class AtLeastOneOfValidator"
},
{
"path": "lib/grape/validations/validators/base.rb",
"chars": 2949,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Validations\n module Validators\n class Base\n include "
},
{
"path": "lib/grape/validations/validators/coerce_validator.rb",
"chars": 2352,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Validations\n module Validators\n class CoerceValidator < Bas"
},
{
"path": "lib/grape/validations/validators/contract_scope_validator.rb",
"chars": 1201,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Validations\n module Validators\n class ContractScopeValidato"
},
{
"path": "lib/grape/validations/validators/default_validator.rb",
"chars": 1237,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Validations\n module Validators\n class DefaultValidator < Ba"
},
{
"path": "lib/grape/validations/validators/exactly_one_of_validator.rb",
"chars": 513,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Validations\n module Validators\n class ExactlyOneOfValidator"
},
{
"path": "lib/grape/validations/validators/except_values_validator.rb",
"chars": 816,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Validations\n module Validators\n class ExceptValuesValidator"
},
{
"path": "lib/grape/validations/validators/length_validator.rb",
"chars": 1780,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Validations\n module Validators\n class LengthValidator < Bas"
},
{
"path": "lib/grape/validations/validators/multiple_params_base.rb",
"chars": 888,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Validations\n module Validators\n class MultipleParamsBase < "
},
{
"path": "lib/grape/validations/validators/mutually_exclusive_validator.rb",
"chars": 403,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Validations\n module Validators\n class MutuallyExclusiveVali"
},
{
"path": "lib/grape/validations/validators/presence_validator.rb",
"chars": 402,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Validations\n module Validators\n class PresenceValidator < B"
},
{
"path": "lib/grape/validations/validators/regexp_validator.rb",
"chars": 708,
"preview": "# frozen_string_literal: true\n\nmodule Grape\n module Validations\n module Validators\n class RegexpValidator < Bas"
}
]
// ... and 134 more files (download for full content)
About this extraction
This page contains the full source code of the ruby-grape/grape GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 334 files (1.8 MB), approximately 538.4k tokens, and a symbol index with 1371 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.