diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-20 17:22:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-20 17:22:11 +0300 |
commit | 0c872e02b2c822e3397515ec324051ff540f0cd5 (patch) | |
tree | ce2fb6ce7030e4dad0f4118d21ab6453e5938cdd /app/validators | |
parent | f7e05a6853b12f02911494c4b3fe53d9540d74fc (diff) |
Add latest changes from gitlab-org/gitlab@15-7-stable-eev15.7.0-rc42
Diffstat (limited to 'app/validators')
8 files changed, 63 insertions, 35 deletions
diff --git a/app/validators/iso8601_date_validator.rb b/app/validators/iso8601_date_validator.rb new file mode 100644 index 00000000000..2b4682f0572 --- /dev/null +++ b/app/validators/iso8601_date_validator.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class Iso8601DateValidator < ActiveModel::EachValidator + def validate_each(record, attribute, value) + Date.iso8601(record.read_attribute_before_type_cast(attribute).to_s) + rescue ArgumentError, TypeError + record.errors.add(attribute, _('must be in ISO 8601 format')) + end +end diff --git a/app/validators/json_schemas/build_metadata_id_tokens.json b/app/validators/json_schemas/build_metadata_id_tokens.json index 7f39c7274f3..d97b2241ca3 100644 --- a/app/validators/json_schemas/build_metadata_id_tokens.json +++ b/app/validators/json_schemas/build_metadata_id_tokens.json @@ -5,18 +5,27 @@ "patternProperties": { ".*": { "type": "object", - "patternProperties": { - "^id_token$": { - "type": "object", - "required": ["aud"], - "properties": { - "aud": { "type": "string" }, - "field": { "type": "string" } - }, - "additionalProperties": false + "required": [ + "aud" + ], + "properties": { + "aud": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + }, + "minItems": 1, + "uniqueItems": true + } + ] } }, "additionalProperties": false } } -} +}
\ No newline at end of file diff --git a/app/validators/json_schemas/build_report_result_data.json b/app/validators/json_schemas/build_report_result_data.json index 0a12c9c39a7..d109389a046 100644 --- a/app/validators/json_schemas/build_report_result_data.json +++ b/app/validators/json_schemas/build_report_result_data.json @@ -3,11 +3,16 @@ "description": "Build report result data", "type": "object", "properties": { - "coverage": { "type": "float" }, + "coverage": { + "type": "number", + "format": "float" + }, "tests": { "type": "object", - "items": { "$ref": "./build_report_result_data_tests.json" } + "items": { + "$ref": "./build_report_result_data_tests.json" + } } }, "additionalProperties": false -} +}
\ No newline at end of file diff --git a/app/validators/json_schemas/build_report_result_data_tests.json b/app/validators/json_schemas/build_report_result_data_tests.json index 610070fde5f..3b6a2688313 100644 --- a/app/validators/json_schemas/build_report_result_data_tests.json +++ b/app/validators/json_schemas/build_report_result_data_tests.json @@ -3,12 +3,24 @@ "description": "Build report result data tests", "type": "object", "properties": { - "name": { "type": "string" }, - "duration": { "type": "string" }, - "failed": { "type": "integer" }, - "errored": { "type": "integer" }, - "skipped": { "type": "integer" }, - "success": { "type": "integer" } + "name": { + "type": "string" + }, + "duration": { + "type": "string" + }, + "failed": { + "type": "integer" + }, + "errored": { + "type": "integer" + }, + "skipped": { + "type": "integer" + }, + "success": { + "type": "integer" + } }, "additionalProperties": false -} +}
\ No newline at end of file diff --git a/app/validators/json_schemas/ci_secure_file_metadata.json b/app/validators/json_schemas/ci_secure_file_metadata.json index 46a7ff60b8f..66e778d6026 100644 --- a/app/validators/json_schemas/ci_secure_file_metadata.json +++ b/app/validators/json_schemas/ci_secure_file_metadata.json @@ -4,10 +4,10 @@ "properties": { "id": { "type": "string" }, "team_name": { "type": "string" }, - "team_id": { "type": "string" }, + "team_id": { "type": "array" }, "app_name": { "type": "string" }, "app_id": { "type": "string" }, - "app_id_prefix": { "type": "string" }, + "app_id_prefix": { "type": "array" }, "xcode_managed": { "type": "boolean" }, "entitlements": { "type": "object" }, "devices": { "type": "array" }, diff --git a/app/validators/json_schemas/daily_build_group_report_result_data.json b/app/validators/json_schemas/daily_build_group_report_result_data.json index 2b073506375..5b153b47b1e 100644 --- a/app/validators/json_schemas/daily_build_group_report_result_data.json +++ b/app/validators/json_schemas/daily_build_group_report_result_data.json @@ -3,7 +3,10 @@ "description": "Daily build group report result data", "type": "object", "properties": { - "coverage": { "type": "float" } + "coverage": { + "type": "number", + "format": "float" + } }, "additionalProperties": false -} +}
\ No newline at end of file diff --git a/app/validators/json_schemas/merge_request_predictions_suggested_reviewers.json b/app/validators/json_schemas/merge_request_predictions_suggested_reviewers.json deleted file mode 100644 index 8e80b52d9b8..00000000000 --- a/app/validators/json_schemas/merge_request_predictions_suggested_reviewers.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "description": "Merge request predictions suggested reviewers", - "type": "object", - "properties": { - "top_n": { "type": "number" }, - "version": { "type": "string" }, - "reviewers": { "type": "array" } - }, - "additionalProperties": true -} diff --git a/app/validators/json_schemas/web_hooks_url_variables.json b/app/validators/json_schemas/web_hooks_url_variables.json index ea504d114e3..27b251a059f 100644 --- a/app/validators/json_schemas/web_hooks_url_variables.json +++ b/app/validators/json_schemas/web_hooks_url_variables.json @@ -8,7 +8,7 @@ "^[A-Za-z]+[0-9]*(?:[._-][A-Za-z0-9]+)*$": { "type": "string", "minLength": 1, - "maxLength": 100 + "maxLength": 2048 } } } |