Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-11-11 15:08:16 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-11-11 15:08:16 +0300
commit2761b4465bb13e170f0b8b2941d83f356a47eee6 (patch)
tree9a34e185671e7a9afe8720c8eafc6a3319a63c97 /app/serializers
parent43e40e8daaceafb9b78fde9ac5ce97584a210a90 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/serializers')
-rw-r--r--app/serializers/detailed_status_entity.rb37
-rw-r--r--app/serializers/integrations/field_entity.rb2
-rw-r--r--app/serializers/test_case_entity.rb23
-rw-r--r--app/serializers/test_report_entity.rb14
-rw-r--r--app/serializers/test_report_summary_entity.rb2
-rw-r--r--app/serializers/test_suite_entity.rb19
-rw-r--r--app/serializers/test_suite_summary_entity.rb5
7 files changed, 63 insertions, 39 deletions
diff --git a/app/serializers/detailed_status_entity.rb b/app/serializers/detailed_status_entity.rb
index 4f23ef0ed82..ed8ac9f40f7 100644
--- a/app/serializers/detailed_status_entity.rb
+++ b/app/serializers/detailed_status_entity.rb
@@ -3,12 +3,25 @@
class DetailedStatusEntity < Grape::Entity
include RequestAwareEntity
- expose :icon, :text, :label, :group
- expose :status_tooltip, as: :tooltip
- expose :has_details?, as: :has_details
- expose :details_path
+ expose :icon, documentation: { type: 'string', example: 'status_success' }
+ expose :text, documentation: { type: 'string', example: 'passed' }
+ expose :label, documentation: { type: 'string', example: 'passed' }
+ expose :group, documentation: { type: 'string', example: 'success' }
+ expose :status_tooltip, as: :tooltip, documentation: { type: 'string', example: 'passed' }
+ expose :has_details?, as: :has_details, documentation: { type: 'boolean', example: true }
+ expose :details_path, documentation: { type: 'string', example: '/test-group/test-project/-/pipelines/287' }
- expose :illustration do |status|
+ expose :illustration, documentation: {
+ type: 'object',
+ example: <<~JSON
+ {
+ "image": "illustrations/job_not_triggered.svg",
+ "size": "svg-306",
+ "title": "This job has not been triggered yet",
+ "content": "This job depends on upstream jobs that need to succeed in order for this job to be triggered"
+ }
+ JSON
+ } do |status|
illustration = {
image: ActionController::Base.helpers.image_path(status.illustration[:image])
}
@@ -19,15 +32,17 @@ class DetailedStatusEntity < Grape::Entity
# ignored
end
- expose :favicon do |status|
+ expose :favicon,
+ documentation: { type: 'string',
+ example: '/assets/ci_favicons/favicon_status_success.png' } do |status|
Gitlab::Favicon.status_overlay(status.favicon)
end
expose :action, if: -> (status, _) { status.has_action? } do
- expose :action_icon, as: :icon
- expose :action_title, as: :title
- expose :action_path, as: :path
- expose :action_method, as: :method
- expose :action_button_title, as: :button_title
+ expose :action_icon, as: :icon, documentation: { type: 'string', example: 'cancel' }
+ expose :action_title, as: :title, documentation: { type: 'string', example: 'Cancel' }
+ expose :action_path, as: :path, documentation: { type: 'string', example: '/namespace1/project1/-/jobs/2/cancel' }
+ expose :action_method, as: :method, documentation: { type: 'string', example: 'post' }
+ expose :action_button_title, as: :button_title, documentation: { type: 'string', example: 'Cancel this job' }
end
end
diff --git a/app/serializers/integrations/field_entity.rb b/app/serializers/integrations/field_entity.rb
index 697b53a737e..1c548cfab78 100644
--- a/app/serializers/integrations/field_entity.rb
+++ b/app/serializers/integrations/field_entity.rb
@@ -22,6 +22,8 @@ module Integrations
'true'
elsif field[:type] == 'checkbox'
ActiveRecord::Type::Boolean.new.deserialize(value).to_s
+ elsif field[:name] == 'webhook' && integration.chat?
+ BaseChatNotification::SECRET_MASK if value.present?
else
value
end
diff --git a/app/serializers/test_case_entity.rb b/app/serializers/test_case_entity.rb
index 8a5fadf53a6..1a872274cbf 100644
--- a/app/serializers/test_case_entity.rb
+++ b/app/serializers/test_case_entity.rb
@@ -3,15 +3,20 @@
class TestCaseEntity < Grape::Entity
include API::Helpers::RelatedResourcesHelpers
- expose :status
- expose :name, default: "(No name)"
- expose :classname
- expose :file
- expose :execution_time
- expose :system_output
- expose :stack_trace
- expose :recent_failures
- expose :attachment_url, if: -> (*) { can_read_screenshots? } do |test_case|
+ expose :status, documentation: { type: 'string', example: 'success' }
+ expose :name, default: "(No name)",
+ documentation: { type: 'string', example: 'Security Reports can create an auto-remediation MR' }
+ expose :classname, documentation: { type: 'string', example: 'vulnerability_management_spec' }
+ expose :file, documentation: { type: 'string', example: './spec/test_spec.rb' }
+ expose :execution_time, documentation: { type: 'integer', example: 180 }
+ expose :system_output, documentation: { type: 'string', example: 'Failure/Error: is_expected.to eq(3)' }
+ expose :stack_trace, documentation: { type: 'string', example: 'Failure/Error: is_expected.to eq(3)' }
+ expose :recent_failures, documentation: { example: { count: 3, base_branch: 'develop' } }
+ expose(
+ :attachment_url,
+ if: -> (*) { can_read_screenshots? },
+ documentation: { type: 'string', example: 'http://localhost/namespace1/project1/-/jobs/1/artifacts/file/some/path.png' }
+ ) do |test_case|
expose_url(test_case.attachment_url)
end
diff --git a/app/serializers/test_report_entity.rb b/app/serializers/test_report_entity.rb
index 9eb487da60a..0ff1c671f53 100644
--- a/app/serializers/test_report_entity.rb
+++ b/app/serializers/test_report_entity.rb
@@ -1,15 +1,15 @@
# frozen_string_literal: true
class TestReportEntity < Grape::Entity
- expose :total_time
- expose :total_count
+ expose :total_time, documentation: { type: 'integer', example: 180 }
+ expose :total_count, documentation: { type: 'integer', example: 1 }
- expose :success_count
- expose :failed_count
- expose :skipped_count
- expose :error_count
+ expose :success_count, documentation: { type: 'integer', example: 1 }
+ expose :failed_count, documentation: { type: 'integer', example: 0 }
+ expose :skipped_count, documentation: { type: 'integer', example: 0 }
+ expose :error_count, documentation: { type: 'integer', example: 0 }
- expose :test_suites, using: TestSuiteEntity do |report|
+ expose :test_suites, using: TestSuiteEntity, documentation: { is_array: true } do |report|
report.test_suites.values
end
end
diff --git a/app/serializers/test_report_summary_entity.rb b/app/serializers/test_report_summary_entity.rb
index bc73c49092f..f712b9f5500 100644
--- a/app/serializers/test_report_summary_entity.rb
+++ b/app/serializers/test_report_summary_entity.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
class TestReportSummaryEntity < Grape::Entity
- expose :total
+ expose :total, documentation: { type: 'integer', example: 3363 }
expose :test_suites, using: TestSuiteSummaryEntity do |summary|
summary.test_suites.values
diff --git a/app/serializers/test_suite_entity.rb b/app/serializers/test_suite_entity.rb
index 15eb2891b22..a31b1f3ab9b 100644
--- a/app/serializers/test_suite_entity.rb
+++ b/app/serializers/test_suite_entity.rb
@@ -1,18 +1,19 @@
# frozen_string_literal: true
class TestSuiteEntity < Grape::Entity
- expose :name
- expose :total_time
- expose :total_count
+ expose :name, documentation: { type: 'string', example: 'test' }
+ expose :total_time, documentation: { type: 'integer', example: 1904 }
+ expose :total_count, documentation: { type: 'integer', example: 3363 }
- expose :success_count
- expose :failed_count
- expose :skipped_count
- expose :error_count
+ expose :success_count, documentation: { type: 'integer', example: 3351 }
+ expose :failed_count, documentation: { type: 'integer', example: 0 }
+ expose :skipped_count, documentation: { type: 'integer', example: 12 }
+ expose :error_count, documentation: { type: 'integer', example: 0 }
with_options if: -> (_, opts) { opts[:details] } do |test_suite|
- expose :suite_error
- expose :test_cases, using: TestCaseEntity do |test_suite|
+ expose :suite_error,
+ documentation: { type: 'string', example: 'JUnit XML parsing failed: 1:1: FATAL: Document is empty' }
+ expose :test_cases, using: TestCaseEntity, documentation: { is_array: true } do |test_suite|
test_suite.suite_error ? [] : test_suite.sorted.test_cases.values.flat_map(&:values)
end
end
diff --git a/app/serializers/test_suite_summary_entity.rb b/app/serializers/test_suite_summary_entity.rb
index 228c6e499fe..3a9ccb22713 100644
--- a/app/serializers/test_suite_summary_entity.rb
+++ b/app/serializers/test_suite_summary_entity.rb
@@ -1,9 +1,10 @@
# frozen_string_literal: true
class TestSuiteSummaryEntity < TestSuiteEntity
- expose :build_ids do |summary|
+ expose :build_ids, documentation: { type: 'integer', is_array: true, example: [66004] } do |summary|
summary.build_ids
end
- expose :suite_error
+ expose :suite_error,
+ documentation: { type: 'string', example: 'JUnit XML parsing failed: 1:1: FATAL: Document is empty' }
end