diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-20 16:18:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-20 16:18:24 +0300 |
commit | 0653e08efd039a5905f3fa4f6e9cef9f5d2f799c (patch) | |
tree | 4dcc884cf6d81db44adae4aa99f8ec1233a41f55 /app/validators | |
parent | 744144d28e3e7fddc117924fef88de5d9674fe4c (diff) |
Add latest changes from gitlab-org/gitlab@14-3-stable-eev14.3.0-rc42
Diffstat (limited to 'app/validators')
5 files changed, 60 insertions, 169 deletions
diff --git a/app/validators/gitlab/utils/zoom_url_validator.rb b/app/validators/gitlab/utils/zoom_url_validator.rb deleted file mode 100644 index 57e30dcefa6..00000000000 --- a/app/validators/gitlab/utils/zoom_url_validator.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -# Gitlab::Utils::ZoomUrlValidator -# -# Custom validator for zoom urls -# -module Gitlab - module Utils - class ZoomUrlValidator < ActiveModel::EachValidator - ALLOWED_SCHEMES = %w(https).freeze - - def validate_each(record, attribute, value) - links_count = Gitlab::ZoomLinkExtractor.new(value).links.size - valid = Gitlab::UrlSanitizer.valid?(value, allowed_schemes: ALLOWED_SCHEMES) - - return if links_count == 1 && valid - - record.errors.add(:url, 'must contain one valid Zoom URL') - end - end - end -end diff --git a/app/validators/gitlab/zoom_url_validator.rb b/app/validators/gitlab/zoom_url_validator.rb new file mode 100644 index 00000000000..c752cec07c2 --- /dev/null +++ b/app/validators/gitlab/zoom_url_validator.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module Gitlab + # Gitlab::Utils::ZoomUrlValidator + # + # Custom validator for zoom urls + # + # @example usage + # validates :url, 'gitlab/zoom_url': true + class ZoomUrlValidator < ActiveModel::EachValidator + ALLOWED_SCHEMES = %w(https).freeze + + def validate_each(record, attribute, value) + links_count = Gitlab::ZoomLinkExtractor.new(value).links.size + valid = Gitlab::UrlSanitizer.valid?(value, allowed_schemes: ALLOWED_SCHEMES) + + return if links_count == 1 && valid + + record.errors.add(:url, 'must contain one valid Zoom URL') + end + end +end diff --git a/app/validators/json_schemas/cluster_agent_authorization_configuration.json b/app/validators/json_schemas/cluster_agent_authorization_configuration.json new file mode 100644 index 00000000000..f3de0b7043b --- /dev/null +++ b/app/validators/json_schemas/cluster_agent_authorization_configuration.json @@ -0,0 +1,6 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "Cluster Agent configuration for an authorized project or group", + "type": "object", + "additionalProperties": true +} diff --git a/app/validators/json_schemas/dast_profile_schedule_cadence.json b/app/validators/json_schemas/dast_profile_schedule_cadence.json new file mode 100644 index 00000000000..5583acfa5af --- /dev/null +++ b/app/validators/json_schemas/dast_profile_schedule_cadence.json @@ -0,0 +1,31 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "Dast profile schedule cadence schema", + "type": "object", + "anyOf": [ + { + "properties": { + "unit": { "enum": ["day"] }, + "duration": { "enum": [1] } + } + }, + { + "properties": { + "unit": { "enum": ["week"] }, + "duration": { "enum": [1] } + } + }, + { + "properties": { + "unit": { "enum": ["month"] }, + "duration": { "enum": [1, 3 ,6] } + } + }, + { + "properties": { + "unit": { "enum": ["year"] }, + "duration": { "enum": [1] } + } + } + ] +} diff --git a/app/validators/json_schemas/error_tracking_event_payload.json b/app/validators/json_schemas/error_tracking_event_payload.json index 19abde7de08..52efcf6800c 100644 --- a/app/validators/json_schemas/error_tracking_event_payload.json +++ b/app/validators/json_schemas/error_tracking_event_payload.json @@ -2,161 +2,15 @@ "description": "Error tracking event payload", "type": "object", "required": [], - "modules": { - "type": "object" - }, "properties": { - "event_id": { - "type": "string" - }, - "level": { - "type": "string" - }, - "timestamp": { - "type": "string" - }, - "release": { - "type": "string" - }, "environment": { "type": "string" }, - "server_name": { - "type": "string" - }, - "message": { - "type": "string" - }, - "user": { - "type": "object", - "required": [], - "properties": {} - }, - "tags": { - "type": "object", - "required": [], - "properties": { - "request_id": { - "type": "string" - } - } - }, - "contexts": { - "type": "object", - "required": [], - "properties": { - "os": { - "type": "object", - "required": [], - "properties": { - "name": { - "type": "string" - }, - "version": { - "type": "string" - }, - "build": { - "type": "string" - }, - "kernel_version": { - "type": "string" - } - } - }, - "runtime": { - "type": "object", - "required": [], - "properties": { - "name": { - "type": "string" - }, - "version": { - "type": "string" - } - } - }, - "trace": { - "type": "object" - } - } - }, - "fingerprint": { - "type": "array", - "items": { - "type": "string" - } - }, - "breadcrumbs": { - "type": "object", - "required": [], - "properties": { - "values": { - "type": "array", - "items": { - "type": "object", - "required": [], - "properties": { - "category": { - "type": "string" - }, - "data": { - "type": "object" - }, - "message": { - "type": "string" - }, - "timestamp": { - "type": "number" - } - } - } - } - } - }, - "transaction": { - "type": "string" - }, "platform": { "type": "string" }, "sdk": { - "type": "object", - "required": [], - "properties": { - "name": { - "type": "string" - }, - "version": { - "type": "string" - } - } - }, - "request": { - "type": "object", - "required": [], - "properties": { - "url": { - "type": "string" - }, - "method": { - "type": "string" - }, - "headers": { - "type": "object" - }, - "env": { - "type": "object", - "required": [], - "properties": { - "SERVER_NAME": { - "type": "string" - }, - "SERVER_PORT": { - "type": "string" - } - } - } - } + "type": "object" }, "exception": { "type": "object", |