Move EE specific code out of API::API

This moves all EE specific code out of API::API and into
EE::API::Endpoints.

This involves a hack to mount API::MergeRequestApprovals, which seems to
be order dependant. Mounting this API using EE::API::Endpoints will
result in spec failures, so instead we mount it when we prepend
EE::API::MergeRequests into API::MergeRequests.
parent c920677d
Pipeline #50936951 passed with stages
in 70 minutes and 11 seconds
......@@ -26,6 +26,16 @@ module EE
mount ::API::NpmPackages
mount ::API::Packages
mount ::API::PackageFiles
mount ::API::ManagedLicenses
mount ::API::ProjectApprovals
version 'v3', using: :path do
# Although the following endpoints are kept behind V3 namespace,
# they're not deprecated neither should be removed when V3 get
# removed. They're needed as a layer to integrate with Jira
# Development Panel.
mount ::API::V3::Github
end
end
end
end
......
......@@ -6,6 +6,12 @@ module EE
extend ActiveSupport::Concern
prepended do
# For reasons unknown, this API must be mounted before we mount
# API::MergeRequests. Mounting this API later on (using
# EE::API::Endpoints) for example will result in various merge request
# approval related tests failing.
::API::API.mount(::API::MergeRequestApprovals)
helpers do
params :optional_params_ee do
optional :approvals_before_merge, type: Integer, desc: 'Number of approvals required before this can be merged'
......
......@@ -29,13 +29,6 @@ module API
prefix :api
version 'v3', using: :path do
## EE-specific API V3 endpoints START
# Although the following endpoints are kept behind V3 namespace, they're not
# deprecated neither should be removed when V3 get removed.
# They're needed as a layer to integrate with Jira Development Panel.
mount ::API::V3::Github
## EE-specific API V3 endpoints END
route :any, '*path' do
error!('API V3 is no longer supported. Use API V4 instead.', 410)
end
......@@ -128,10 +121,8 @@ module API
mount ::API::Keys
mount ::API::Labels
mount ::API::Lint
mount ::API::ManagedLicenses
mount ::API::Markdown
mount ::API::Members
mount ::API::MergeRequestApprovals
mount ::API::MergeRequestDiffs
mount ::API::MergeRequests
mount ::API::Namespaces
......@@ -142,7 +133,6 @@ module API
mount ::API::PagesDomains
mount ::API::Pipelines
mount ::API::PipelineSchedules
mount ::API::ProjectApprovals
mount ::API::ProjectClusters
mount ::API::ProjectExport
mount ::API::ProjectImport
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment