summaryrefslogtreecommitdiff
path: root/app/serializers/ci
diff options
context:
space:
mode:
Diffstat (limited to 'app/serializers/ci')
-rw-r--r--app/serializers/ci/lint/job_entity.rb15
-rw-r--r--app/serializers/ci/lint/result_entity.rb12
-rw-r--r--app/serializers/ci/lint/result_serializer.rb5
3 files changed, 32 insertions, 0 deletions
diff --git a/app/serializers/ci/lint/job_entity.rb b/app/serializers/ci/lint/job_entity.rb
new file mode 100644
index 00000000000..2393f9ba44c
--- /dev/null
+++ b/app/serializers/ci/lint/job_entity.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class Ci::Lint::JobEntity < Grape::Entity
+ expose :name
+ expose :stage
+ expose :before_script
+ expose :script
+ expose :after_script
+ expose :tag_list
+ expose :environment
+ expose :when
+ expose :allow_failure
+ expose :only
+ expose :except
+end
diff --git a/app/serializers/ci/lint/result_entity.rb b/app/serializers/ci/lint/result_entity.rb
new file mode 100644
index 00000000000..f9306d1dc70
--- /dev/null
+++ b/app/serializers/ci/lint/result_entity.rb
@@ -0,0 +1,12 @@
+# frozen_string_literal: true
+
+class Ci::Lint::ResultEntity < Grape::Entity
+ expose :valid?, as: :valid
+ expose :errors
+ expose :warnings
+ expose :jobs, using: Ci::Lint::JobEntity do |result, options|
+ next [] unless result.valid?
+
+ result.jobs
+ end
+end
diff --git a/app/serializers/ci/lint/result_serializer.rb b/app/serializers/ci/lint/result_serializer.rb
new file mode 100644
index 00000000000..4b55b415129
--- /dev/null
+++ b/app/serializers/ci/lint/result_serializer.rb
@@ -0,0 +1,5 @@
+# frozen_string_literal: true
+
+class Ci::Lint::ResultSerializer < BaseSerializer
+ entity ::Ci::Lint::ResultEntity
+end