diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-05 12:08:05 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-05 12:08:05 +0300 |
commit | 963838b90c1c121d16ec43353a4e0d44450664cf (patch) | |
tree | 156f6b2c887641dd30539005287896275ea0f993 /app/validators | |
parent | 09f1028092f0580a26667ff67747f7ab0f759d56 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/validators')
-rw-r--r-- | app/validators/json_schema_validator.rb | 4 | ||||
-rw-r--r-- | app/validators/json_schemas/daily_build_group_report_result_data.json | 8 |
2 files changed, 12 insertions, 0 deletions
diff --git a/app/validators/json_schema_validator.rb b/app/validators/json_schema_validator.rb index f84186c9ced..f8c1727035c 100644 --- a/app/validators/json_schema_validator.rb +++ b/app/validators/json_schema_validator.rb @@ -10,8 +10,12 @@ # end # class JsonSchemaValidator < ActiveModel::EachValidator + FILENAME_ALLOWED = /\A[a-z0-9_-]*\Z/.freeze + FilenameError = Class.new(StandardError) + def initialize(options) raise ArgumentError, "Expected 'filename' as an argument" unless options[:filename] + raise FilenameError, "Must be a valid 'filename'" unless options[:filename].match?(FILENAME_ALLOWED) super(options) end 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 new file mode 100644 index 00000000000..2524ac63050 --- /dev/null +++ b/app/validators/json_schemas/daily_build_group_report_result_data.json @@ -0,0 +1,8 @@ +{ + "description": "Daily build group report result data", + "type": "object", + "properties": { + "coverage": { "type": "float" } + }, + "additionalProperties": false +} |