Skip to content

Validate Organization Settings against JSON schema

Rutger Wessels requested to merge 394801-validate-data-type into master

What does this MR do and why?

Related Issue #394801 (closed)

MR !123380 (merged) introduced JSONB as storage for the settings. Since we store settings as JSON, PostgreSQL is no longer aware of the data types being used. To address that, this MR adds validation of settings attribute against JSON schema.

We do not use these settings yet. A follow-up MR will start reading and writing the setting.

How to set up and validate locally

  1. Using Rails console: Organizations::OrganizationSetting.new(settings: { some_key: 'invalid'}).valid? should be false
  2. Organizations::OrganizationSetting.new(settings: { restricted_visibility_levels: [10]}).valid? should be true

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Rutger Wessels

Merge request reports

Loading