diff options
Diffstat (limited to 'lib/api/v3')
-rw-r--r-- | lib/api/v3/award_emoji.rb | 2 | ||||
-rw-r--r-- | lib/api/v3/boards.rb | 2 | ||||
-rw-r--r-- | lib/api/v3/branches.rb | 2 | ||||
-rw-r--r-- | lib/api/v3/commits.rb | 2 | ||||
-rw-r--r-- | lib/api/v3/deploy_keys.rb | 2 | ||||
-rw-r--r-- | lib/api/v3/deployments.rb | 2 | ||||
-rw-r--r-- | lib/api/v3/environments.rb | 2 | ||||
-rw-r--r-- | lib/api/v3/files.rb | 2 | ||||
-rw-r--r-- | lib/api/v3/groups.rb | 4 | ||||
-rw-r--r-- | lib/api/v3/issues.rb | 4 | ||||
-rw-r--r-- | lib/api/v3/labels.rb | 2 | ||||
-rw-r--r-- | lib/api/v3/members.rb | 2 | ||||
-rw-r--r-- | lib/api/v3/merge_request_diffs.rb | 7 | ||||
-rw-r--r-- | lib/api/v3/merge_requests.rb | 2 | ||||
-rw-r--r-- | lib/api/v3/milestones.rb | 2 | ||||
-rw-r--r-- | lib/api/v3/notes.rb | 2 | ||||
-rw-r--r-- | lib/api/v3/pipelines.rb | 2 | ||||
-rw-r--r-- | lib/api/v3/project_hooks.rb | 2 | ||||
-rw-r--r-- | lib/api/v3/project_snippets.rb | 2 | ||||
-rw-r--r-- | lib/api/v3/projects.rb | 2 | ||||
-rw-r--r-- | lib/api/v3/repositories.rb | 2 | ||||
-rw-r--r-- | lib/api/v3/runners.rb | 2 | ||||
-rw-r--r-- | lib/api/v3/services.rb | 7 | ||||
-rw-r--r-- | lib/api/v3/subscriptions.rb | 2 | ||||
-rw-r--r-- | lib/api/v3/tags.rb | 2 | ||||
-rw-r--r-- | lib/api/v3/triggers.rb | 2 | ||||
-rw-r--r-- | lib/api/v3/variables.rb | 2 |
27 files changed, 36 insertions, 32 deletions
diff --git a/lib/api/v3/award_emoji.rb b/lib/api/v3/award_emoji.rb index cf9e1551f60..b96b2d70b12 100644 --- a/lib/api/v3/award_emoji.rb +++ b/lib/api/v3/award_emoji.rb @@ -6,7 +6,7 @@ module API before { authenticate! } AWARDABLES = %w[issue merge_request snippet].freeze - resource :projects do + resource :projects, requirements: { id: %r{[^/]+} } do AWARDABLES.each do |awardable_type| awardable_string = awardable_type.pluralize awardable_id_string = "#{awardable_type}_id" diff --git a/lib/api/v3/boards.rb b/lib/api/v3/boards.rb index b1c2a3c59f2..94acc67171e 100644 --- a/lib/api/v3/boards.rb +++ b/lib/api/v3/boards.rb @@ -6,7 +6,7 @@ module API params do requires :id, type: String, desc: 'The ID of a project' end - resource :projects do + resource :projects, requirements: { id: %r{[^/]+} } do desc 'Get all project boards' do detail 'This feature was introduced in 8.13' success ::API::Entities::Board diff --git a/lib/api/v3/branches.rb b/lib/api/v3/branches.rb index 699e41b5537..7d9d6246e46 100644 --- a/lib/api/v3/branches.rb +++ b/lib/api/v3/branches.rb @@ -9,7 +9,7 @@ module API params do requires :id, type: String, desc: 'The ID of a project' end - resource :projects do + resource :projects, requirements: { id: %r{[^/]+} } do desc 'Get a project repository branches' do success ::API::Entities::RepoBranch end diff --git a/lib/api/v3/commits.rb b/lib/api/v3/commits.rb index d254d247042..3414a2883e5 100644 --- a/lib/api/v3/commits.rb +++ b/lib/api/v3/commits.rb @@ -11,7 +11,7 @@ module API params do requires :id, type: String, desc: 'The ID of a project' end - resource :projects do + resource :projects, requirements: { id: %r{[^/]+} } do desc 'Get a project repository commits' do success ::API::Entities::RepoCommit end diff --git a/lib/api/v3/deploy_keys.rb b/lib/api/v3/deploy_keys.rb index 5bbb167755c..bbb174b6003 100644 --- a/lib/api/v3/deploy_keys.rb +++ b/lib/api/v3/deploy_keys.rb @@ -13,7 +13,7 @@ module API params do requires :id, type: String, desc: 'The ID of the project' end - resource :projects do + resource :projects, requirements: { id: %r{[^/]+} } do before { authorize_admin_project } %w(keys deploy_keys).each do |path| diff --git a/lib/api/v3/deployments.rb b/lib/api/v3/deployments.rb index 95114ad1fe1..1d4972eda26 100644 --- a/lib/api/v3/deployments.rb +++ b/lib/api/v3/deployments.rb @@ -9,7 +9,7 @@ module API params do requires :id, type: String, desc: 'The project ID' end - resource :projects do + resource :projects, requirements: { id: %r{[^/]+} } do desc 'Get all deployments of the project' do detail 'This feature was introduced in GitLab 8.11.' success ::API::V3::Deployments diff --git a/lib/api/v3/environments.rb b/lib/api/v3/environments.rb index 3056b70e6ef..6bb4e016a01 100644 --- a/lib/api/v3/environments.rb +++ b/lib/api/v3/environments.rb @@ -9,7 +9,7 @@ module API params do requires :id, type: String, desc: 'The project ID' end - resource :projects do + resource :projects, requirements: { id: %r{[^/]+} } do desc 'Get all environments of the project' do detail 'This feature was introduced in GitLab 8.11.' success Entities::Environment diff --git a/lib/api/v3/files.rb b/lib/api/v3/files.rb index 4f8d58d37c8..13542b0c71c 100644 --- a/lib/api/v3/files.rb +++ b/lib/api/v3/files.rb @@ -40,7 +40,7 @@ module API params do requires :id, type: String, desc: 'The project ID' end - resource :projects do + resource :projects, requirements: { id: %r{[^/]+} } do desc 'Get a file from repository' params do requires :file_path, type: String, desc: 'The path to the file. Ex. lib/class.rb' diff --git a/lib/api/v3/groups.rb b/lib/api/v3/groups.rb index 0aad87a3f58..c5b37622d79 100644 --- a/lib/api/v3/groups.rb +++ b/lib/api/v3/groups.rb @@ -93,7 +93,7 @@ module API params do requires :id, type: String, desc: 'The ID of a group' end - resource :groups do + resource :groups, requirements: { id: %r{[^/]+} } do desc 'Update a group. Available only for users who can administrate groups.' do success Entities::Group end @@ -163,7 +163,7 @@ module API params do requires :project_id, type: String, desc: 'The ID or path of the project' end - post ":id/projects/:project_id" do + post ":id/projects/:project_id", requirements: { project_id: /.+/ } do authenticated_as_admin! group = find_group!(params[:id]) project = find_project!(params[:project_id]) diff --git a/lib/api/v3/issues.rb b/lib/api/v3/issues.rb index 258cbfed022..cead03b1e6b 100644 --- a/lib/api/v3/issues.rb +++ b/lib/api/v3/issues.rb @@ -68,7 +68,7 @@ module API params do requires :id, type: String, desc: 'The ID of a group' end - resource :groups do + resource :groups, requirements: { id: %r{[^/]+} } do desc 'Get a list of group issues' do success ::API::Entities::Issue end @@ -89,7 +89,7 @@ module API params do requires :id, type: String, desc: 'The ID of a project' end - resource :projects do + resource :projects, requirements: { id: %r{[^/]+} } do include TimeTrackingEndpoints desc 'Get a list of project issues' do diff --git a/lib/api/v3/labels.rb b/lib/api/v3/labels.rb index 41f45d244e3..bd5eb2175e8 100644 --- a/lib/api/v3/labels.rb +++ b/lib/api/v3/labels.rb @@ -6,7 +6,7 @@ module API params do requires :id, type: String, desc: 'The ID of a project' end - resource :projects do + resource :projects, requirements: { id: %r{[^/]+} } do desc 'Get all labels of the project' do success ::API::Entities::Label end diff --git a/lib/api/v3/members.rb b/lib/api/v3/members.rb index 3d4972afd9d..684860b553e 100644 --- a/lib/api/v3/members.rb +++ b/lib/api/v3/members.rb @@ -11,7 +11,7 @@ module API params do requires :id, type: String, desc: "The #{source_type} ID" end - resource source_type.pluralize do + resource source_type.pluralize, requirements: { id: %r{[^/]+} } do desc 'Gets a list of group or project members viewable by the authenticated user.' do success ::API::Entities::Member end diff --git a/lib/api/v3/merge_request_diffs.rb b/lib/api/v3/merge_request_diffs.rb index a462803e26c..35f462e907b 100644 --- a/lib/api/v3/merge_request_diffs.rb +++ b/lib/api/v3/merge_request_diffs.rb @@ -4,14 +4,16 @@ module API class MergeRequestDiffs < Grape::API before { authenticate! } - resource :projects do + params do + requires :id, type: String, desc: 'The ID of a project' + end + resource :projects, requirements: { id: %r{[^/]+} } do desc 'Get a list of merge request diff versions' do detail 'This feature was introduced in GitLab 8.12.' success ::API::Entities::MergeRequestDiff end params do - requires :id, type: String, desc: 'The ID of a project' requires :merge_request_id, type: Integer, desc: 'The ID of a merge request' end @@ -27,7 +29,6 @@ module API end params do - requires :id, type: String, desc: 'The ID of a project' requires :merge_request_id, type: Integer, desc: 'The ID of a merge request' requires :version_id, type: Integer, desc: 'The ID of a merge request diff version' end diff --git a/lib/api/v3/merge_requests.rb b/lib/api/v3/merge_requests.rb index 7dbd4691a94..3077240e650 100644 --- a/lib/api/v3/merge_requests.rb +++ b/lib/api/v3/merge_requests.rb @@ -10,7 +10,7 @@ module API params do requires :id, type: String, desc: 'The ID of a project' end - resource :projects do + resource :projects, requirements: { id: %r{[^/]+} } do include TimeTrackingEndpoints helpers do diff --git a/lib/api/v3/milestones.rb b/lib/api/v3/milestones.rb index 2a850a08a8a..be90cec4afc 100644 --- a/lib/api/v3/milestones.rb +++ b/lib/api/v3/milestones.rb @@ -18,7 +18,7 @@ module API params do requires :id, type: String, desc: 'The ID of a project' end - resource :projects do + resource :projects, requirements: { id: %r{[^/]+} } do desc 'Get a list of project milestones' do success ::API::Entities::Milestone end diff --git a/lib/api/v3/notes.rb b/lib/api/v3/notes.rb index 0796bb62e68..4f8e0eff4ff 100644 --- a/lib/api/v3/notes.rb +++ b/lib/api/v3/notes.rb @@ -10,7 +10,7 @@ module API params do requires :id, type: String, desc: 'The ID of a project' end - resource :projects do + resource :projects, requirements: { id: %r{[^/]+} } do NOTEABLE_TYPES.each do |noteable_type| noteables_str = noteable_type.to_s.underscore.pluralize diff --git a/lib/api/v3/pipelines.rb b/lib/api/v3/pipelines.rb index 2c26a5f7d35..82827249244 100644 --- a/lib/api/v3/pipelines.rb +++ b/lib/api/v3/pipelines.rb @@ -8,7 +8,7 @@ module API params do requires :id, type: String, desc: 'The project ID' end - resource :projects do + resource :projects, requirements: { id: %r{[^/]+} } do desc 'Get all Pipelines of the project' do detail 'This feature was introduced in GitLab 8.11.' success ::API::Entities::Pipeline diff --git a/lib/api/v3/project_hooks.rb b/lib/api/v3/project_hooks.rb index 861b991b8e1..94614bfc8b6 100644 --- a/lib/api/v3/project_hooks.rb +++ b/lib/api/v3/project_hooks.rb @@ -25,7 +25,7 @@ module API params do requires :id, type: String, desc: 'The ID of a project' end - resource :projects do + resource :projects, requirements: { id: %r{[^/]+} } do desc 'Get project hooks' do success ::API::V3::Entities::ProjectHook end diff --git a/lib/api/v3/project_snippets.rb b/lib/api/v3/project_snippets.rb index 809ca4f37ba..fc065a22d74 100644 --- a/lib/api/v3/project_snippets.rb +++ b/lib/api/v3/project_snippets.rb @@ -8,7 +8,7 @@ module API params do requires :id, type: String, desc: 'The ID of a project' end - resource :projects do + resource :projects, requirements: { id: %r{[^/]+} } do helpers do def handle_project_member_errors(errors) if errors[:project_access].any? diff --git a/lib/api/v3/projects.rb b/lib/api/v3/projects.rb index 47bfc12035a..b753dbab381 100644 --- a/lib/api/v3/projects.rb +++ b/lib/api/v3/projects.rb @@ -234,7 +234,7 @@ module API params do requires :id, type: String, desc: 'The ID of a project' end - resource :projects, requirements: { id: /[^\/]+/ } do + resource :projects, requirements: { id: %r{[^/]+} } do desc 'Get a single project' do success ::API::V3::Entities::ProjectWithAccess end diff --git a/lib/api/v3/repositories.rb b/lib/api/v3/repositories.rb index 44584e2eb70..e4d14bc8168 100644 --- a/lib/api/v3/repositories.rb +++ b/lib/api/v3/repositories.rb @@ -8,7 +8,7 @@ module API params do requires :id, type: String, desc: 'The ID of a project' end - resource :projects do + resource :projects, requirements: { id: %r{[^/]+} } do helpers do def handle_project_member_errors(errors) if errors[:project_access].any? diff --git a/lib/api/v3/runners.rb b/lib/api/v3/runners.rb index 8967141fe3d..1934d6e578c 100644 --- a/lib/api/v3/runners.rb +++ b/lib/api/v3/runners.rb @@ -26,7 +26,7 @@ module API params do requires :id, type: String, desc: 'The ID of a project' end - resource :projects do + resource :projects, requirements: { id: %r{[^/]+} } do before { authorize_admin_project } desc "Disable project's runner" do diff --git a/lib/api/v3/services.rb b/lib/api/v3/services.rb index d77185ffe5a..3bacaeee032 100644 --- a/lib/api/v3/services.rb +++ b/lib/api/v3/services.rb @@ -554,7 +554,10 @@ module API ] }.freeze - resource :projects do + params do + requires :id, type: String, desc: 'The ID of a project' + end + resource :projects, requirements: { id: %r{[^/]+} } do before { authenticate! } before { authorize_admin_project } @@ -609,7 +612,7 @@ module API params do requires :id, type: String, desc: 'The ID of a project' end - resource :projects do + resource :projects, requirements: { id: %r{[^/]+} } do desc "Trigger a slash command for #{service_slug}" do detail 'Added in GitLab 8.13' end diff --git a/lib/api/v3/subscriptions.rb b/lib/api/v3/subscriptions.rb index 02a4157c26e..068750ec077 100644 --- a/lib/api/v3/subscriptions.rb +++ b/lib/api/v3/subscriptions.rb @@ -14,7 +14,7 @@ module API requires :id, type: String, desc: 'The ID of a project' requires :subscribable_id, type: String, desc: 'The ID of a resource' end - resource :projects do + resource :projects, requirements: { id: %r{[^/]+} } do subscribable_types.each do |type, finder| type_singularized = type.singularize entity_class = ::API::Entities.const_get(type_singularized.camelcase) diff --git a/lib/api/v3/tags.rb b/lib/api/v3/tags.rb index 6913720d9c5..c2541de2f50 100644 --- a/lib/api/v3/tags.rb +++ b/lib/api/v3/tags.rb @@ -6,7 +6,7 @@ module API params do requires :id, type: String, desc: 'The ID of a project' end - resource :projects do + resource :projects, requirements: { id: %r{[^/]+} } do desc 'Get a project repository tags' do success ::API::Entities::RepoTag end diff --git a/lib/api/v3/triggers.rb b/lib/api/v3/triggers.rb index 1dfdb6a5956..b46639a2205 100644 --- a/lib/api/v3/triggers.rb +++ b/lib/api/v3/triggers.rb @@ -6,7 +6,7 @@ module API params do requires :id, type: String, desc: 'The ID of a project' end - resource :projects do + resource :projects, requirements: { id: %r{[^/]+} } do desc 'Trigger a GitLab project build' do success ::API::V3::Entities::TriggerRequest end diff --git a/lib/api/v3/variables.rb b/lib/api/v3/variables.rb index 0f55a14fb28..83972b1e7ce 100644 --- a/lib/api/v3/variables.rb +++ b/lib/api/v3/variables.rb @@ -10,7 +10,7 @@ module API requires :id, type: String, desc: 'The ID of a project' end - resource :projects do + resource :projects, requirements: { id: %r{[^/]+} } do desc 'Delete an existing variable from a project' do success ::API::Entities::Variable end |