From 06b94228892d777de08679a8cc19096f3a5421b7 Mon Sep 17 00:00:00 2001 From: TULCHINSKI LIRAN Date: Tue, 2 Dec 2025 10:06:37 +0200 Subject: [PATCH 1/3] feat: added schema for yahalom-gateway --- schemas/yahalom-gateway/common/v1.schema.json | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 schemas/yahalom-gateway/common/v1.schema.json diff --git a/schemas/yahalom-gateway/common/v1.schema.json b/schemas/yahalom-gateway/common/v1.schema.json new file mode 100644 index 00000000..547126e6 --- /dev/null +++ b/schemas/yahalom-gateway/common/v1.schema.json @@ -0,0 +1,39 @@ +{ + "$id": "https://mapcolonies.com/yahalom-gateway/common/v1", + "type": "object", + "title": "commonYahalomGatewaySchemaV1", + "required": [], + "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" + }, + "database": { + "type": "string", + "description": "the database name", + "default": "default_db_mame", + "x-env-value": "DB_DATABASE" + } + } +} From c6837479717a2a42dc8ee81e16b3cd6a70e79134 Mon Sep 17 00:00:00 2001 From: TULCHINSKI LIRAN Date: Mon, 8 Dec 2025 12:07:49 +0200 Subject: [PATCH 2/3] refactor: add telemetry and openapiConfig to the schema --- schemas/yahalom-gateway/common/v1.schema.json | 200 +++++++++++++++--- 1 file changed, 172 insertions(+), 28 deletions(-) diff --git a/schemas/yahalom-gateway/common/v1.schema.json b/schemas/yahalom-gateway/common/v1.schema.json index 547126e6..52844146 100644 --- a/schemas/yahalom-gateway/common/v1.schema.json +++ b/schemas/yahalom-gateway/common/v1.schema.json @@ -1,39 +1,183 @@ { + "$schema": "http://json-schema.org/draft-07/schema#", + "description": "Yahalom Gateway basic configuration", "$id": "https://mapcolonies.com/yahalom-gateway/common/v1", "type": "object", - "title": "commonYahalomGatewaySchemaV1", - "required": [], + "title": "yahalomGatewayCommonV1", + "required": ["openapiConfig", "telemetry", "server", "database"], "properties": { - "host": { - "type": "string", - "description": "the host of the database", - "default": "localhost", - "x-env-value": "DB_HOST" + "openapiConfig": { + "description": "OpenAPI configuration", + "type": "object", + "default": {}, + "examples": [ + { + "filePath": "./openapi3.yaml", + "basePath": "/docs", + "rawPath": "/api", + "uiPath": "/api" + } + ], + "properties": { + "filePath": { + "default": "./openapi3.yaml", + "description": "Path to the OpenAPI 3.0 spec file", + "type": "string" + }, + "basePath": { + "default": "/docs", + "description": "The base path for the OpenAPI UI and raw OpenAPI spec", + "type": "string" + }, + "rawPath": { + "default": "/api", + "description": "The path to the raw OpenAPI spec", + "type": "string" + }, + "uiPath": { + "default": "/api", + "description": "The path to the OpenAPI UI", + "type": "string" + } + }, + "unevaluatedProperties": false, + "required": ["filePath", "basePath", "rawPath", "uiPath"] }, - "port": { - "type": "integer", - "description": "the port of the database", - "default": 5432, - "x-env-value": "DB_PORT" + + "telemetry": { + "description": "Telemetry configuration", + "type": "object", + "default": {}, + "unevaluatedProperties": false, + "examples": [ + { + "shared": { "serviceName": "yahalom-gateway" }, + "tracing": { "isEnabled": false }, + "logger": { "level": "info", "prettyPrint": false } + } + ], + "properties": { + "shared": { + "$ref": "https://mapcolonies.com/common/telemetry/base/v1" + }, + "tracing": { + "$ref": "https://mapcolonies.com/common/telemetry/tracing/v1" + }, + "logger": { + "$ref": "https://mapcolonies.com/common/telemetry/logger/v1" + } + }, + "required": ["logger", "shared", "tracing"] }, - "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" + + "server": { + "description": "Server configuration", + "type": "object", + "unevaluatedProperties": false, + "default": {}, + "examples": [ + { + "port": 8080, + "request": { "payload": { "limit": "1mb" } } + } + ], + "properties": { + "port": { + "minimum": 1, + "maximum": 65535, + "default": 8080, + "description": "The port the server will listen on", + "type": "integer", + "x-env-value": "SERVER_PORT" + }, + "request": { + "type": "object", + "default": {}, + "properties": { + "payload": { + "type": "object", + "default": {}, + "properties": { + "limit": { + "default": "1mb", + "description": "The maximum payload size of an incoming request", + "type": "string" + } + }, + "unevaluatedProperties": false, + "required": ["limit"] + } + }, + "unevaluatedProperties": false, + "required": ["payload"] + }, + "response": { + "type": "object", + "default": {}, + "properties": { + "compression": { + "type": "object", + "default": {}, + "properties": { + "enabled": { + "type": "boolean", + "default": true, + "description": "Whether to compress response bodies" + }, + "options": { + "type": ["null", "object"], + "default": null, + "description": "Options for compression module" + } + }, + "unevaluatedProperties": false + } + }, + "unevaluatedProperties": false + } + }, + "required": ["port", "request", "response"] }, + "database": { - "type": "string", - "description": "the database name", - "default": "default_db_mame", - "x-env-value": "DB_DATABASE" + "description": "Database configuration", + "type": "object", + "unevaluatedProperties": false, + "default": {}, + "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" + }, + "database": { + "type": "string", + "description": "the database name", + "default": "default_db_name", + "x-env-value": "DB_DATABASE" + } + }, + "required": ["host", "port", "username", "password", "database"] } } } From 207b0470aa200cb31811a9c8e3517625036ec980 Mon Sep 17 00:00:00 2001 From: TULCHINSKI LIRAN Date: Mon, 8 Dec 2025 12:30:36 +0200 Subject: [PATCH 3/3] refactor: add telemetry and openapiConfig to the schema --- schemas/yahalom-gateway/common/v1.schema.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/schemas/yahalom-gateway/common/v1.schema.json b/schemas/yahalom-gateway/common/v1.schema.json index 52844146..0a4f670e 100644 --- a/schemas/yahalom-gateway/common/v1.schema.json +++ b/schemas/yahalom-gateway/common/v1.schema.json @@ -53,7 +53,8 @@ { "shared": { "serviceName": "yahalom-gateway" }, "tracing": { "isEnabled": false }, - "logger": { "level": "info", "prettyPrint": false } + "logger": { "level": "info", "prettyPrint": false }, + "metrics": { "isEnabled": true } } ], "properties": { @@ -65,6 +66,9 @@ }, "logger": { "$ref": "https://mapcolonies.com/common/telemetry/logger/v1" + }, + "metrics": { + "description": "Metrics configuration" } }, "required": ["logger", "shared", "tracing"]