Skip to content
Snippets Groups Projects
Commit 106dbbfb authored by Stan Hu's avatar Stan Hu
Browse files

Revert "Merge branch 'sh-update-grape-gem' into 'master'"

This reverts merge request !27276
parent 40a0bf58
No related branches found
No related tags found
No related merge requests found
Showing
with 47 additions and 84 deletions
Loading
Loading
@@ -284,18 +284,6 @@ Gitlab/Union:
- 'spec/**/*'
- 'ee/spec/**/*'
 
API/GrapeAPIInstance:
Enabled: true
Include:
- 'lib/**/api/**/*.rb'
- 'ee/**/api/**/*.rb'
API/GrapeArrayMissingCoerce:
Enabled: true
Include:
- 'lib/**/api/**/*.rb'
- 'ee/**/api/**/*.rb'
Cop/SidekiqOptionsQueue:
Enabled: true
Exclude:
Loading
Loading
Loading
Loading
@@ -19,7 +19,7 @@ gem 'default_value_for', '~> 3.3.0'
gem 'pg', '~> 1.1'
 
gem 'rugged', '~> 0.28'
gem 'grape-path-helpers', '~> 1.3'
gem 'grape-path-helpers', '~> 1.2'
 
gem 'faraday', '~> 0.12'
gem 'marginalia', '~> 1.8.0'
Loading
Loading
@@ -82,7 +82,7 @@ gem 'gitlab_omniauth-ldap', '~> 2.1.1', require: 'omniauth-ldap'
gem 'net-ldap'
 
# API
gem 'grape', '~> 1.3.2'
gem 'grape', '~> 1.1.0'
gem 'grape-entity', '~> 0.7.1'
gem 'rack-cors', '~> 1.0.6', require: 'rack/cors'
 
Loading
Loading
Loading
Loading
@@ -103,6 +103,10 @@ GEM
aws-sdk-core (= 2.11.374)
aws-sigv4 (1.1.0)
aws-eventstream (~> 1.0, >= 1.0.2)
axiom-types (0.1.1)
descendants_tracker (~> 0.0.4)
ice_nine (~> 0.11.0)
thread_safe (~> 0.3, >= 0.3.1)
babosa (1.0.2)
base32 (0.3.2)
batch-loader (1.4.0)
Loading
Loading
@@ -161,6 +165,8 @@ GEM
nap
open4 (~> 1.3)
coderay (1.1.2)
coercible (1.0.0)
descendants_tracker (~> 0.0.1)
colored2 (3.1.2)
commonmarker (0.20.1)
ruby-enum (~> 0.5)
Loading
Loading
@@ -216,6 +222,8 @@ GEM
ruby-statistics (>= 2.1)
thor (>= 0.19, < 2)
unicode_plot (>= 0.0.4, < 1.0.0)
descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1)
device_detector (1.0.0)
devise (4.7.1)
bcrypt (~> 3.0)
Loading
Loading
@@ -242,28 +250,6 @@ GEM
doorkeeper-openid_connect (1.6.3)
doorkeeper (>= 5.0, < 5.2)
json-jwt (~> 1.6)
dry-configurable (0.11.5)
concurrent-ruby (~> 1.0)
dry-core (~> 0.4, >= 0.4.7)
dry-equalizer (~> 0.2)
dry-container (0.7.2)
concurrent-ruby (~> 1.0)
dry-configurable (~> 0.1, >= 0.1.3)
dry-core (0.4.9)
concurrent-ruby (~> 1.0)
dry-equalizer (0.3.0)
dry-inflector (0.2.0)
dry-logic (1.0.6)
concurrent-ruby (~> 1.0)
dry-core (~> 0.2)
dry-equalizer (~> 0.2)
dry-types (1.4.0)
concurrent-ruby (~> 1.0)
dry-container (~> 0.3)
dry-core (~> 0.4, >= 0.4.4)
dry-equalizer (~> 0.3)
dry-inflector (~> 0.1, >= 0.1.2)
dry-logic (~> 1.0, >= 1.0.2)
ed25519 (1.2.4)
elasticsearch (6.8.0)
elasticsearch-api (= 6.8.0)
Loading
Loading
@@ -453,19 +439,19 @@ GEM
signet (~> 0.7)
gpgme (2.0.20)
mini_portile2 (~> 2.3)
grape (1.3.2)
grape (1.1.0)
activesupport
builder
dry-types (>= 1.1)
mustermann-grape (~> 1.0.0)
rack (>= 1.3.0)
rack-accept
virtus (>= 1.0.0)
grape-entity (0.7.1)
activesupport (>= 4.0)
multi_json (>= 1.3.2)
grape-path-helpers (1.3.0)
grape-path-helpers (1.2.0)
activesupport
grape (~> 1.3)
grape (~> 1.0)
rake (~> 12)
grape_logging (1.8.3)
grape
Loading
Loading
@@ -659,10 +645,9 @@ GEM
multi_xml (0.6.0)
multipart-post (2.1.1)
murmurhash3 (0.1.6)
mustermann (1.1.1)
ruby2_keywords (~> 0.0.1)
mustermann-grape (1.0.1)
mustermann (>= 1.0.0)
mustermann (1.0.3)
mustermann-grape (1.0.0)
mustermann (~> 1.0.0)
nakayoshi_fork (0.0.4)
nap (1.1.0)
nenv (0.3.0)
Loading
Loading
@@ -976,7 +961,6 @@ GEM
ruby-saml (1.7.2)
nokogiri (>= 1.5.10)
ruby-statistics (2.1.2)
ruby2_keywords (0.0.2)
ruby_dep (1.5.0)
ruby_parser (3.13.1)
sexp_processor (~> 4.9)
Loading
Loading
@@ -1135,6 +1119,11 @@ GEM
activerecord (>= 3.0)
activesupport (>= 3.0)
version_sorter (2.2.4)
virtus (1.0.5)
axiom-types (~> 0.1)
coercible (~> 1.0)
descendants_tracker (~> 0.0, >= 0.0.3)
equalizer (~> 0.0, >= 0.0.9)
vmstat (2.3.0)
warden (1.2.8)
rack (>= 2.0.6)
Loading
Loading
@@ -1265,9 +1254,9 @@ DEPENDENCIES
google-api-client (~> 0.23)
google-protobuf (~> 3.8.0)
gpgme (~> 2.0.19)
grape (~> 1.3.2)
grape (~> 1.1.0)
grape-entity (~> 0.7.1)
grape-path-helpers (~> 1.3)
grape-path-helpers (~> 1.2)
grape_logging (~> 1.7)
graphiql-rails (~> 1.4.10)
graphql (~> 1.10.5)
Loading
Loading
---
title: Upgrade Grape v1.1.0 to v1.3.2
merge_request: 27276
author:
type: other
Loading
Loading
@@ -98,14 +98,6 @@ For instance:
Model.create(foo: params[:foo])
```
 
## Array types
With Grape v1.3+, Array types must be defined with a `coerce_with`
block, or parameters will fail to validate when passed a string from an
API request. See the [Grape upgrading
documentation](https://github.com/ruby-grape/grape/blob/master/UPGRADING.md#ensure-that-array-types-have-explicit-coercions)
for more details.
## Using HTTP status helpers
 
For non-200 HTTP responses, use the provided helpers in `lib/api/helpers.rb` to ensure correct behavior (`not_found!`, `no_content!` etc.). These will `throw` inside Grape and abort the execution of your endpoint.
Loading
Loading
Loading
Loading
@@ -513,12 +513,12 @@ do that, so we'll follow regular object-oriented practices that we define the
interface first here.
 
For example, suppose we have a few more optional parameters for EE. We can move the
parameters out of the `Grape::API::Instance` class to a helper module, so we can inject it
paramters out of the `Grape::API` class to a helper module, so we can inject it
before it would be used in the class.
 
```ruby
module API
class Projects < Grape::API::Instance
class Projects < Grape::API
helpers Helpers::ProjectsHelpers
end
end
Loading
Loading
@@ -579,7 +579,7 @@ class definition to make it easy and clear:
 
```ruby
module API
class JobArtifacts < Grape::API::Instance
class JobArtifacts < Grape::API
# EE::API::JobArtifacts would override the following helpers
helpers do
def authorize_download_artifacts!
Loading
Loading
@@ -623,7 +623,7 @@ route. Something like this:
 
```ruby
module API
class MergeRequests < Grape::API::Instance
class MergeRequests < Grape::API
helpers do
# EE::API::MergeRequests would override the following helpers
def update_merge_request_ee(merge_request)
Loading
Loading
@@ -692,7 +692,7 @@ least argument. We would approach this as follows:
```ruby
# api/merge_requests/parameters.rb
module API
class MergeRequests < Grape::API::Instance
class MergeRequests < Grape::API
module Parameters
def self.update_params_at_least_one_of
%i[
Loading
Loading
@@ -708,7 +708,7 @@ API::MergeRequests::Parameters.prepend_if_ee('EE::API::MergeRequests::Parameters
 
# api/merge_requests.rb
module API
class MergeRequests < Grape::API::Instance
class MergeRequests < Grape::API
params do
at_least_one_of(*Parameters.update_params_at_least_one_of)
end
Loading
Loading
Loading
Loading
@@ -2,7 +2,7 @@
 
module API
module Analytics
class CodeReviewAnalytics < Grape::API::Instance
class CodeReviewAnalytics < Grape::API
include PaginationParams
 
helpers ::Gitlab::IssuableMetadata
Loading
Loading
Loading
Loading
@@ -2,7 +2,7 @@
 
module API
module Analytics
class GroupActivityAnalytics < Grape::API::Instance
class GroupActivityAnalytics < Grape::API
DESCRIPTION_DETAIL =
'This feature is gated by the `:group_activity_analytics`'\
' feature flag, introduced in GitLab 12.9.'
Loading
Loading
# frozen_string_literal: true
 
module API
class AuditEvents < ::Grape::API::Instance
class AuditEvents < ::Grape::API
include ::API::PaginationParams
 
before do
Loading
Loading
Loading
Loading
@@ -2,7 +2,7 @@
 
# PHP composer support (https://getcomposer.org/)
module API
class ComposerPackages < Grape::API::Instance
class ComposerPackages < Grape::API
helpers ::API::Helpers::PackagesManagerClientsHelpers
helpers ::API::Helpers::RelatedResourcesHelpers
helpers ::API::Helpers::Packages::BasicAuthHelpers
Loading
Loading
Loading
Loading
@@ -9,7 +9,7 @@
#
# Technical debt: https://gitlab.com/gitlab-org/gitlab/issues/35798
module API
class ConanPackages < Grape::API::Instance
class ConanPackages < Grape::API
helpers ::API::Helpers::PackagesManagerClientsHelpers
 
PACKAGE_REQUIREMENTS = {
Loading
Loading
# frozen_string_literal: true
 
module API
class Dependencies < Grape::API::Instance
class Dependencies < Grape::API
helpers do
def dependencies_by(params)
pipeline = ::Security::ReportFetchService.new(user_project, ::Ci::JobArtifact.dependency_list_reports).pipeline
Loading
Loading
@@ -28,7 +28,6 @@ def dependencies_by(params)
params do
optional :package_manager,
type: Array[String],
coerce_with: Validations::Types::CommaSeparatedToArray.coerce,
desc: "Returns dependencies belonging to specified package managers: #{::Security::DependencyListService::FILTER_PACKAGE_MANAGERS_VALUES.join(', ')}.",
values: ::Security::DependencyListService::FILTER_PACKAGE_MANAGERS_VALUES
end
Loading
Loading
# frozen_string_literal: true
 
module API
class DependencyProxy < Grape::API::Instance
class DependencyProxy < Grape::API
helpers ::API::Helpers::PackagesHelpers
 
helpers do
Loading
Loading
# frozen_string_literal: true
 
module API
class ElasticsearchIndexedNamespaces < Grape::API::Instance
class ElasticsearchIndexedNamespaces < Grape::API
before { authenticated_as_admin! }
 
resource :elasticsearch_indexed_namespaces do
Loading
Loading
# frozen_string_literal: true
 
module API
class EpicIssues < Grape::API::Instance
class EpicIssues < Grape::API
before do
authenticate!
authorize_epics_feature!
Loading
Loading
# frozen_string_literal: true
 
module API
class EpicLinks < Grape::API::Instance
class EpicLinks < Grape::API
include ::Gitlab::Utils::StrongMemoize
 
before do
Loading
Loading
# frozen_string_literal: true
 
module API
class Epics < Grape::API::Instance
class Epics < Grape::API
include PaginationParams
 
before do
Loading
Loading
@@ -29,7 +29,7 @@ class Epics < Grape::API::Instance
optional :state, type: String, values: %w[opened closed all], default: 'all',
desc: 'Return opened, closed, or all epics'
optional :author_id, type: Integer, desc: 'Return epics which are authored by the user with the given ID'
optional :labels, type: Array[String], coerce_with: Validations::Types::CommaSeparatedToArray.coerce, desc: 'Comma-separated list of label names'
optional :labels, type: Array[String], coerce_with: Validations::Types::LabelsList.coerce, desc: 'Comma-separated list of label names'
optional :with_labels_details, type: Boolean, desc: 'Return titles of labels and other details', default: false
optional :created_after, type: DateTime, desc: 'Return epics created after the specified time'
optional :created_before, type: DateTime, desc: 'Return epics created before the specified time'
Loading
Loading
@@ -70,7 +70,7 @@ class Epics < Grape::API::Instance
optional :start_date_is_fixed, type: Boolean, desc: 'Indicates start date should be sourced from start_date_fixed field not the issue milestones'
optional :end_date, as: :due_date_fixed, type: String, desc: 'The due date of an epic'
optional :due_date_is_fixed, type: Boolean, desc: 'Indicates due date should be sourced from due_date_fixed field not the issue milestones'
optional :labels, type: Array[String], coerce_with: Validations::Types::CommaSeparatedToArray.coerce, desc: 'Comma-separated list of label names'
optional :labels, type: Array[String], coerce_with: Validations::Types::LabelsList.coerce, desc: 'Comma-separated list of label names'
optional :parent_id, type: Integer, desc: 'The id of a parent epic'
end
post ':id/(-/)epics' do
Loading
Loading
@@ -96,7 +96,7 @@ class Epics < Grape::API::Instance
optional :start_date_is_fixed, type: Boolean, desc: 'Indicates start date should be sourced from start_date_fixed field not the issue milestones'
optional :end_date, as: :due_date_fixed, type: String, desc: 'The due date of an epic'
optional :due_date_is_fixed, type: Boolean, desc: 'Indicates due date should be sourced from due_date_fixed field not the issue milestones'
optional :labels, type: Array[String], coerce_with: Validations::Types::CommaSeparatedToArray.coerce, desc: 'Comma-separated list of label names'
optional :labels, type: Array[String], coerce_with: Validations::Types::LabelsList.coerce, desc: 'Comma-separated list of label names'
optional :state_event, type: String, values: %w[reopen close], desc: 'State event for an epic'
at_least_one_of :title, :description, :start_date_fixed, :start_date_is_fixed, :due_date_fixed, :due_date_is_fixed, :labels, :state_event, :confidential
end
Loading
Loading
# frozen_string_literal: true
 
module API
class FeatureFlagScopes < Grape::API::Instance
class FeatureFlagScopes < Grape::API
include PaginationParams
 
ENVIRONMENT_SCOPE_ENDPOINT_REQUIREMENTS = FeatureFlags::FEATURE_FLAG_ENDPOINT_REQUIREMENTS
Loading
Loading
# frozen_string_literal: true
 
module API
class FeatureFlags < Grape::API::Instance
class FeatureFlags < Grape::API
include PaginationParams
 
FEATURE_FLAG_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS
Loading
Loading
# frozen_string_literal: true
 
module API
class FeatureFlagsUserLists < Grape::API::Instance
class FeatureFlagsUserLists < Grape::API
include PaginationParams
 
error_formatter :json, -> (message, _backtrace, _options, _env, _original_exception) {
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment