diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-28 06:10:17 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-28 06:10:17 +0000 |
commit | d3eb1e90a58fc97c9c1548e8ac9631c233e723ea (patch) | |
tree | 0be332ab901bd95225437ffd332bc83c30c99742 /app/validators | |
parent | 6078d7becc4a0d70aafc4a3934a70b8cf2b3775e (diff) | |
download | gitlab-ce-d3eb1e90a58fc97c9c1548e8ac9631c233e723ea.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/validators')
-rw-r--r-- | app/validators/json_schema_validator.rb | 1 | ||||
-rw-r--r-- | app/validators/json_schemas/google_service_account_key.json | 48 |
2 files changed, 49 insertions, 0 deletions
diff --git a/app/validators/json_schema_validator.rb b/app/validators/json_schema_validator.rb index 4896c2ea2ef..9c246a114f6 100644 --- a/app/validators/json_schema_validator.rb +++ b/app/validators/json_schema_validator.rb @@ -25,6 +25,7 @@ class JsonSchemaValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) value = value.to_h.stringify_keys if options[:hash_conversion] == true + value = Gitlab::Json.parse(value.to_s) if options[:parse_json] == true && !value.nil? unless valid_schema?(value) record.errors.add(attribute, _("must be a valid json schema")) diff --git a/app/validators/json_schemas/google_service_account_key.json b/app/validators/json_schemas/google_service_account_key.json new file mode 100644 index 00000000000..d040ef19f66 --- /dev/null +++ b/app/validators/json_schemas/google_service_account_key.json @@ -0,0 +1,48 @@ +{ + "description": "Google service account key", + "type": "object", + "required": [ + "type", + "project_id", + "private_key_id", + "private_key", + "client_email", + "client_id", + "auth_uri", + "token_uri", + "auth_provider_x509_cert_url", + "client_x509_cert_url" + ], + "properties": { + "type": { + "const": "service_account" + }, + "project_id": { + "type": "string" + }, + "private_key_id": { + "type": "string" + }, + "private_key": { + "type": "string" + }, + "client_email": { + "type": "string" + }, + "client_id": { + "type": "string" + }, + "auth_uri": { + "type": "string" + }, + "token_uri": { + "type": "string" + }, + "auth_provider_x509_cert_url": { + "type": "string" + }, + "client_x509_cert_url": { + "type": "string" + } + } +} |