From 8cdd1420f5ee5f882519b437c7322f34145c0a64 Mon Sep 17 00:00:00 2001 From: Niv Greenstein <88280771+NivGreenstein@users.noreply.github.com> Date: Tue, 23 Jun 2026 16:38:15 +0300 Subject: [PATCH 1/5] fix: optional ca --- schemas/common/db/partial/v2.schema.json | 83 ++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 schemas/common/db/partial/v2.schema.json diff --git a/schemas/common/db/partial/v2.schema.json b/schemas/common/db/partial/v2.schema.json new file mode 100644 index 00000000..07f9f2c2 --- /dev/null +++ b/schemas/common/db/partial/v2.schema.json @@ -0,0 +1,83 @@ +{ + "$id": "https://mapcolonies.com/common/db/partial/v1", + "description": "database configuration for postgres", + "type": "object", + "required": ["ssl"], + "properties": { + "host": { + "type": "string", + "description": "the host of the database", + "default": "localhost", + "x-env-value": "DB_HOST" + }, + "port": { + "type": "integer", + "description": "the port of the database", + "default": 5432, + "x-env-value": "DB_PORT" + }, + "username": { + "type": "string", + "description": "the username of the database", + "default": "postgres", + "maxLength": 63, + "x-env-value": "DB_USERNAME" + }, + "password": { + "type": "string", + "description": "the password of the database", + "default": "postgres", + "x-env-value": "DB_PASSWORD" + }, + "ssl": { + "$ref": "#/definitions/ssl" + } + }, + "definitions": { + "ssl": { + "type": "object", + "description": "ssl configuration", + "properties": { + "enabled": { + "type": "boolean", + "description": "enable ssl", + "default": false, + "x-env-value": "DB_ENABLE_SSL_AUTH" + }, + "ca": { + "type": "string", + "description": "the path to the ca file", + "x-env-value": "DB_CA_PATH" + }, + "cert": { + "type": "string", + "description": "the path to the cert file", + "x-env-value": "DB_CERT_PATH" + }, + "key": { + "type": "string", + "description": "the path to the key file", + "x-env-value": "DB_KEY_PATH" + } + }, + "unevaluatedProperties": false, + "if": { + "properties": { + "enabled": { + "const": true + } + } + }, + "then": { + "required": ["cert", "key"] + }, + "else": { + "properties": { + "enabled": { + "const": false + } + } + } + } + } +} From e0bf7b4fce596b288a81d6111812f7340b3b45e2 Mon Sep 17 00:00:00 2001 From: Niv Greenstein <88280771+NivGreenstein@users.noreply.github.com> Date: Tue, 23 Jun 2026 16:39:12 +0300 Subject: [PATCH 2/5] feat: create v2 config --- schemas/common/db/partial/v2.configs.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 schemas/common/db/partial/v2.configs.json diff --git a/schemas/common/db/partial/v2.configs.json b/schemas/common/db/partial/v2.configs.json new file mode 100644 index 00000000..1e3f9e83 --- /dev/null +++ b/schemas/common/db/partial/v2.configs.json @@ -0,0 +1,10 @@ +[ + { + "name": "db-connection", + "value": { + "ssl": { + "enabled": false + } + } + } +] From 64eedc68755677c2761d55d89def08e0c01ad31d Mon Sep 17 00:00:00 2001 From: Niv Greenstein <88280771+NivGreenstein@users.noreply.github.com> Date: Tue, 23 Jun 2026 16:40:47 +0300 Subject: [PATCH 3/5] feat: created v3 pg schema This schema defines the full database structure, including references to partial schemas and required properties. --- schemas/common/db/full/v3.schema.json | 34 +++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 schemas/common/db/full/v3.schema.json diff --git a/schemas/common/db/full/v3.schema.json b/schemas/common/db/full/v3.schema.json new file mode 100644 index 00000000..77a6cf69 --- /dev/null +++ b/schemas/common/db/full/v3.schema.json @@ -0,0 +1,34 @@ +{ + "$id": "https://mapcolonies.com/common/db/full/v2", + "description": "The full database schema including schema and database name", + "type": "object", + "allOf": [ + { + "$ref": "https://mapcolonies.com/common/db/partial/v2" + }, + { + "$ref": "#/definitions/db" + } + ], + "unevaluatedProperties": true, + "definitions": { + "db": { + "type": "object", + "required": ["database"], + "properties": { + "schema": { + "type": "string", + "description": "The schema name of the database", + "default": "public", + "x-env-value": "DB_SCHEMA" + }, + "database": { + "type": "string", + "description": "The database name", + "maxLength": 63, + "x-env-value": "DB_NAME" + } + } + } + } +} From f8bcdbedd39d39c7408ce230b838c09812b3c392 Mon Sep 17 00:00:00 2001 From: Niv Greenstein <88280771+NivGreenstein@users.noreply.github.com> Date: Tue, 23 Jun 2026 16:43:45 +0300 Subject: [PATCH 4/5] fix: changed schema id --- schemas/common/db/full/v3.schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schemas/common/db/full/v3.schema.json b/schemas/common/db/full/v3.schema.json index 77a6cf69..0dcd19e7 100644 --- a/schemas/common/db/full/v3.schema.json +++ b/schemas/common/db/full/v3.schema.json @@ -1,5 +1,5 @@ { - "$id": "https://mapcolonies.com/common/db/full/v2", + "$id": "https://mapcolonies.com/common/db/full/v3", "description": "The full database schema including schema and database name", "type": "object", "allOf": [ From 57c88b679b0d0c5e423cd69e4a5ef2d9929c81d9 Mon Sep 17 00:00:00 2001 From: Niv Greenstein <88280771+NivGreenstein@users.noreply.github.com> Date: Tue, 23 Jun 2026 16:45:02 +0300 Subject: [PATCH 5/5] fix: partial schema version --- schemas/common/db/partial/v2.schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schemas/common/db/partial/v2.schema.json b/schemas/common/db/partial/v2.schema.json index 07f9f2c2..5b07e74e 100644 --- a/schemas/common/db/partial/v2.schema.json +++ b/schemas/common/db/partial/v2.schema.json @@ -1,5 +1,5 @@ { - "$id": "https://mapcolonies.com/common/db/partial/v1", + "$id": "https://mapcolonies.com/common/db/partial/v2", "description": "database configuration for postgres", "type": "object", "required": ["ssl"],