{ "$schema": "http://json-schema.org/draft/draft-07/schema#", "$id": "gallifrey-rules/namespace-schema.01.json", "description": "namespace schema version 01", "type": "object", "properties": { "$namespace": { "type": "string" }, "$namespaceAliases": { "type": "array", "items": { "type": "string" } }, "$modulesPaths": { "type": "array", "items": { "type": "string" } }, "$entities": { "type": "object", "$ref": "#/definitions/entities" }, "$config": { "type": "object", "description": "namespace level config" }, "$atomicEntity": { "type": "boolean", "description": "Lock will be based on the entity name and event ID" }, "$atomicEvent": { "type": "boolean", "description": "Lock will be based on the entity name, event name and event ID" }, "$schemaFile": { "type": "string", "description": "points to a JSON schema file to enforce on the event payload" }, "$providers": { "type": "object", "$ref": "#/definitions/providers" }, "$consumers": { "type": "array", "items": { "$ref": "#/definitions/consumer" } }, "$asyncActions": { "type": "array", "items": { "$ref": "#/definitions/asyncAction" } } }, "required": [ "$namespace", "$modulesPaths", "$entities" ], "additionalProperties": false, "definitions": { "entities": { "type": "object", "additionalProperties": { "$ref": "#/definitions/namespaceSchemaEvent" } }, "providers": { "type": "object", "properties": { "actionQueuer": { "type": "string" }, "activeEventsReferenceCounter": { "type": "string" }, "configuration": { "type": "string" }, "journalLogger": { "type": "string" }, "logger": { "type": "string" }, "metrics": { "type": "string" }, "scheduledEvents": { "type": "string" }, "distributedLocks": { "type": "string" }, "reactToFailure": { "type": "string" } }, "additionalProperties": false }, "consumer": { "type": "object", "properties": { "name": { "type": "string" }, "envVariable": { "type": "string" }, "type": { "type": "string", "enum": [ "kafka", "kafka:scheduled-events", "kafka:async-actions" ] }, "config": { "oneOf": [ { "if": { "properties": { "type": { "anyOf": [ { "const": "kafka" }, { "const": "kafka:scheduled-events" }, { "const": "kafka:async-actions" } ] } } }, "then": { "$ref": "#/definitions/kafkaConsumerConfig" } } ] }, "eventDispatcher": { "type": "string" } }, "required": [ "name", "type", "config" ], "if": { "properties": { "type": { "const": "kafka" } } }, "then": { "required": [ "eventDispatcher" ] }, "additionalProperties": false }, "asyncAction": { "type": "object", "properties": { "actionPluginName": { "type": "string" }, "queuerConfig": { "type": "object" } }, "required": [ "actionPluginName", "queuerConfig" ], "additionalProperties": false }, "namespaceSchemaEvent": { "type": "object", "properties": { "$config": { "type": "object", "description": "entity level config" }, "$atomicEntity": { "type": "boolean", "description": "Lock will be based on the entity name and event ID" }, "$atomicEvent": { "type": "boolean", "description": "Lock will be based on the entity name, event name and event ID" }, "$schemaFile": { "type": "string", "description": "points to a JSON schema file to enforce on the event payload" } }, "patternProperties": { "^(?!\\$config|\\$atomicEntity|\\$atomicEvent|\\$schemaFile)[\\w\\d_-]+$": { "$ref": "#/definitions/namespaceSchemaEventValue" } }, "additionalProperties": false }, "namespaceSchemaEventValue": { "type": "object", "properties": { "$config": { "type": "object", "description": "event level config" }, "$atomicEntity": { "type": "boolean", "description": "Lock will be based on the entity name and event ID" }, "$atomicEvent": { "type": "boolean", "description": "Lock will be based on the entity name, event name and event ID" }, "$schemaFile": { "type": "string", "description": "points to a JSON schema file to enforce on the event payload" }, "$filters": { "type": "array", "items": { "type": "string" } }, "$rules": { "type": "array", "items": { "type": "string" } } }, "required": [ "$rules" ], "additionalProperties": false }, "kafkaConsumerConfig": { "type": "object", "properties": { "properties": { "groupId": { "type": "string", "description": "The group ID of the consumer" }, "topics": { "anyOf": [ { "type": "string" }, { "type": "array", "items": { "type": "string" } } ], "description": "The topic or list of topics to listen to" }, "fromBeginning": { "type": "boolean", "description": "Whether to start consuming from the beginning of the topic" }, "brokers": { "type": "array", "items": { "type": "string" }, "description": "Optional brokers for this consumer. If not given, they would be expected to be provided in the environment variable `GR_KAFKA_BROKERS`" }, "clientId": { "type": "string", "description": "Optional client ID. If not provided, it would be expected to be provided in the environment variable `GR_KAFKA_CLIENT_ID`" } }, "required": [ "groupId", "topics", "fromBeginning" ] } } } }