Skip to content

Commit 990af4f

Browse files
committed
Replace grape-route-helpers with our own grape-path-helpers
This gem (https://gitlab.com/gitlab-org/grape-path-helpers) makes a number of changes: 1. Brings in @mdelaossa's changes in reprah/grape-route-helpers#21 2. Fixes some broken specs and code for Grape 1.0+ 3. Optimizes the generation of paths by bringing in @dblessing's HashWithIndifferentAccess changes in https://gitlab.com/gitlab-org/gitlab-ce/issues/45718#note_70123793 Closes #45718
1 parent 5b1416a commit 990af4f

File tree

7 files changed

+25
-73
lines changed

7 files changed

+25
-73
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ gem 'mysql2', '~> 0.4.10', group: :mysql
2828
gem 'pg', '~> 0.18.2', group: :postgres
2929

3030
gem 'rugged', '~> 0.27'
31-
gem 'grape-route-helpers', '~> 2.1.0'
31+
gem 'grape-path-helpers', '~> 1.0'
3232

3333
gem 'faraday', '~> 0.12'
3434

Gemfile.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ GEM
348348
signet (~> 0.7)
349349
gpgme (2.0.13)
350350
mini_portile2 (~> 2.1)
351-
grape (1.0.2)
351+
grape (1.0.3)
352352
activesupport
353353
builder
354354
mustermann-grape (~> 1.0.0)
@@ -358,10 +358,10 @@ GEM
358358
grape-entity (0.7.1)
359359
activesupport (>= 4.0)
360360
multi_json (>= 1.3.2)
361-
grape-route-helpers (2.1.0)
362-
activesupport
363-
grape (>= 0.16.0)
364-
rake
361+
grape-path-helpers (1.0.1)
362+
activesupport (~> 4)
363+
grape (~> 1.0)
364+
rake (~> 12)
365365
grape_logging (1.7.0)
366366
grape
367367
grpc (1.11.0)
@@ -1049,7 +1049,7 @@ DEPENDENCIES
10491049
gpgme
10501050
grape (~> 1.0)
10511051
grape-entity (~> 0.7.1)
1052-
grape-route-helpers (~> 2.1.0)
1052+
grape-path-helpers (~> 1.0)
10531053
grape_logging (~> 1.7)
10541054
grpc (~> 1.11.0)
10551055
haml_lint (~> 0.26.0)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: Replace grape-route-helpers with our own grape-path-helpers
3+
merge_request:
4+
author:
5+
type: performance

config/initializers/grape_route_helpers_fix.rb

Lines changed: 0 additions & 51 deletions
This file was deleted.

lib/api/helpers/related_resources_helpers.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module API
22
module Helpers
33
module RelatedResourcesHelpers
4-
include GrapeRouteHelpers::NamedRouteMatcher
4+
include GrapePathHelpers::NamedRouteMatcher
55

66
def issues_available?(project, options)
77
available?(:issues, project, options[:current_user])

spec/initializers/grape_route_helpers_fix_spec.rb

Lines changed: 0 additions & 14 deletions
This file was deleted.

spec/requests/api/merge_requests_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@
2929
project.add_reporter(user)
3030
end
3131

32+
describe 'route shadowing' do
33+
include GrapePathHelpers::NamedRouteMatcher
34+
35+
it 'does not occur' do
36+
path = api_v4_projects_merge_requests_path(id: 1)
37+
expect(path).to eq('/api/v4/projects/1/merge_requests')
38+
39+
path = api_v4_projects_merge_requests_path(id: 1, merge_request_iid: 3)
40+
expect(path).to eq('/api/v4/projects/1/merge_requests/3')
41+
end
42+
end
43+
3244
describe 'GET /merge_requests' do
3345
context 'when unauthenticated' do
3446
it 'returns an array of all merge requests' do

0 commit comments

Comments
 (0)