Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
1849ac2b
Commit
1849ac2b
authored
May 27, 2019
by
Imre Farkas
Committed by
Lin Jen-Shin
May 27, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update development doc on EE specific API params
parent
25feb4b4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
20 deletions
+33
-20
doc/development/ee_features.md
doc/development/ee_features.md
+33
-20
No files found.
doc/development/ee_features.md
View file @
1849ac2b
...
@@ -557,40 +557,56 @@ due to `prepend`, but Grape is complex internally and we couldn't easily do
...
@@ -557,40 +557,56 @@ due to `prepend`, but Grape is complex internally and we couldn't easily do
that, so we'll follow regular object-oriented practices that we define the
that, so we'll follow regular object-oriented practices that we define the
interface first here.
interface first here.
For example, suppose we have a few more optional params for EE, given this CE
For example, suppose we have a few more optional params for EE. We can move the
API code:
params out of the
`Grape::API`
class to a helper module, so we can
`prepend`
it
before it would be used in the class.
```
ruby
```
ruby
module
API
module
API
class
MergeRequests
<
Grape
::
API
class
Projects
<
Grape
::
API
# EE::API::MergeRequests would override the following helpers
helpers
Helpers
::
ProjectsHelpers
helpers
do
end
params
:optional_params_ee
do
end
```
Given this CE API
`params`
:
```
ruby
module
API
module
Helpers
module
ProjectsHelpers
extend
ActiveSupport
::
Concern
extend
Grape
::
API
::
Helpers
params
:optional_project_params_ce
do
# CE specific params go here...
end
end
end
params
:optional_params
do
params
:optional_project_params_ee
do
# CE specific params go here...
end
use
:optional_params_ee
params
:optional_project_params
do
use
:optional_project_params_ce
use
:optional_project_params_ee
end
end
end
end
end
end
end
API
::
MergeRequests
.
prepend
(
EE
::
API
::
MergeRequest
s
)
API
::
Helpers
::
ProjectsHelpers
.
prepend
(
EE
::
API
::
Helpers
::
ProjectsHelper
s
)
```
```
And then w
e could override it in EE module:
W
e could override it in EE module:
```
ruby
```
ruby
module
EE
module
EE
module
API
module
API
module
MergeRequests
module
Helpers
extend
ActiveSupport
::
Concern
module
ProjectsHelpers
extend
ActiveSupport
::
Concern
prepended
do
prepended
do
helpers
do
params
:optional_project_params_ee
do
params
:optional_params_ee
do
# EE specific params go here...
# EE specific params go here...
end
end
end
end
...
@@ -600,9 +616,6 @@ module EE
...
@@ -600,9 +616,6 @@ module EE
end
end
```
```
This way, the only difference between CE and EE for that API file would be
`prepend EE::API::MergeRequests`
.
#### EE helpers
#### EE helpers
To make it easy for an EE module to override the CE helpers, we need to define
To make it easy for an EE module to override the CE helpers, we need to define
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment