diff --git a/schemas/common/kafka/v1.schema.json b/schemas/common/kafka/v1.schema.json new file mode 100644 index 00000000..1f77a6d4 --- /dev/null +++ b/schemas/common/kafka/v1.schema.json @@ -0,0 +1,124 @@ +{ + "$id": "https://mapcolonies.com/common/kafka/v1", + "description": "Kafka configuration", + "type": "object", + "required": ["brokers", "enableSslAuth", "sslPaths"], + "unevaluatedProperties": true, + "properties": { + "brokers": { + "type": "array", + "items": { "type": "string" }, + "minItems": 1, + "description": "List of broker addresses", + "x-env-value": "KAFKA_BROKERS", + "x-env-format": "json" + }, + "clientId": { + "type": "string", + "description": "Client identifier", + "x-env-value": "KAFKA_CLIENT_ID" + }, + "enableSslAuth": { + "type": "boolean", + "description": "Enable SSL/TLS authentication", + "default": false, + "x-env-value": "KAFKA_ENABLE_SSL_AUTH" + }, + "sslPaths": { + "$ref": "#/definitions/sslPaths" + }, + "sasl": { + "$ref": "#/definitions/sasl" + }, + "consumer": { + "type": "object", + "properties": { + "groupId": { + "type": "string", + "description": "Consumer group identifier", + "x-env-value": "KAFKA_GROUP_ID" + } + } + }, + "producer": { + "type": "object" + }, + "outputTopic": { + "type": "string", + "description": "Kafka topic to produce messages to", + "x-env-value": "KAFKA_OUTPUT_TOPIC" + } + }, + "if": { + "properties": { + "enableSslAuth": { + "const": true + } + } + }, + "then": { + "properties": { + "sslPaths": { + "type": "object", + "required": ["ca", "key", "cert"] + } + } + }, + "definitions": { + "sslPaths": { + "type": "object", + "description": "SSL certificate paths", + "unevaluatedProperties": false, + "properties": { + "ca": { + "type": "string", + "description": "Path to the CA certificate file", + "x-env-value": "KAFKA_CA_PATH" + }, + "key": { + "type": "string", + "description": "Path to the client key file", + "x-env-value": "KAFKA_KEY_PATH" + }, + "cert": { + "type": "string", + "description": "Path to the client certificate file", + "x-env-value": "KAFKA_CERT_PATH" + } + } + }, + "sasl": { + "type": "object", + "description": "SASL authentication configuration", + "oneOf": [ + { + "type": "object", + "required": ["mechanism", "username", "password"], + "properties": { + "mechanism": { "const": "plain", "x-env-value": "KAFKA_SASL_MECHANISM" }, + "username": { "type": "string", "x-env-value": "KAFKA_SASL_USERNAME" }, + "password": { "type": "string", "x-env-value": "KAFKA_SASL_PASSWORD" } + } + }, + { + "type": "object", + "required": ["mechanism", "username", "password"], + "properties": { + "mechanism": { "const": "scram-sha-256", "x-env-value": "KAFKA_SASL_MECHANISM" }, + "username": { "type": "string", "x-env-value": "KAFKA_SASL_USERNAME" }, + "password": { "type": "string", "x-env-value": "KAFKA_SASL_PASSWORD" } + } + }, + { + "type": "object", + "required": ["mechanism", "username", "password"], + "properties": { + "mechanism": { "const": "scram-sha-512", "x-env-value": "KAFKA_SASL_MECHANISM" }, + "username": { "type": "string", "x-env-value": "KAFKA_SASL_USERNAME" }, + "password": { "type": "string", "x-env-value": "KAFKA_SASL_PASSWORD" } + } + } + ] + } + } +} diff --git a/schemas/vector/feedbackApi/v1.schema.json b/schemas/vector/feedbackApi/v1.schema.json new file mode 100644 index 00000000..ab57f364 --- /dev/null +++ b/schemas/vector/feedbackApi/v1.schema.json @@ -0,0 +1,95 @@ +{ + "$id": "https://mapcolonies.com/vector/feedbackApi/v1", + "type": "object", + "title": "vectorFeedbackApiV1", + "description": "Mapping configuration for external vector data to OSM tags", + "allOf": [ + { "$ref": "https://mapcolonies.com/common/boilerplate/v2" }, + { "$ref": "#/definitions/databases" }, + { "$ref": "#/definitions/appSchema" } + ], + "definitions": { + "databases": { + "type": "object", + "required": ["redis", "kafka"], + "properties": { + "redis": { + "allOf": [ + { "$ref": "https://mapcolonies.com/common/redis/v2" }, + { + "type": "object", + "properties": { + "connectTimeoutMs": { + "type": "number", + "x-env-value": "REDIS_CONNECT_TIMEOUT", + "default": 5000, + "minimum": 500 + }, + "ttl": { + "type": "number", + "description": "Redis ttl in seconds", + "x-env-value": "REDIS_TTL" + } + }, + "required": ["connectTimeoutMs", "ttl"] + } + ] + }, + "kafka": { + "allOf": [ + { "$ref": "https://mapcolonies.com/common/kafka/v1" }, + { + "type": "object", + "required": ["consumer", "producer", "outputTopic"] + } + ] + } + } + }, + "appSchema": { + "required": ["application", "schema"], + "type": "object", + "properties": { + "application": { + "type": "object", + "required": ["hashKey", "userValidation"], + "properties": { + "hashKey": { + "type": "object", + "required": ["enabled"], + "properties": { + "enabled": { + "type": "boolean", + "x-env-value": "APP_HASHKEY_ENABLED" + }, + "value": { + "type": "string", + "x-env-value": "APP_HASHKEY_VALUE" + } + }, + "if": { + "properties": { "enabled": { "const": true } } + }, + "then": { + "required": ["value"] + } + }, + "userValidation": { + "type": "array", + "items": { "type": "string" }, + "x-env-value": "USER_ID_DOMAIN", + "x-env-format": "json" + } + } + }, + "schema": { + "type": "object", + "properties": { + "provider": { "type": "string", "x-env-value": "SCHEMA_PROVIDER" }, + "filePath": { "type": "string", "x-env-value": "SCHEMA_FILE_PATH" } + } + } + } + } + } +}