Skip to main content

Shared Event

Description

A Domain Event that is part of the Shared Kernel, understood by multiple Bounded Contexts.

Definition Schema

The definition for a shared_event component expects the following structure:

{
"$defs": {
"EventParameterInputDTO": {
"description": "Generic DTO for defining a parameter (field) in a generated event class.",
"example": {
"default_value_str": null,
"param_name": "user_id",
"param_type_str": "int"
},
"properties": {
"param_name": {
"title": "Param Name",
"type": "string"
},
"param_type_str": {
"title": "Param Type Str",
"type": "string"
},
"default_value_str": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Default Value Str"
}
},
"required": [
"param_name",
"param_type_str"
],
"title": "EventParameterInputDTO",
"type": "object"
}
},
"description": "DTO for defining an event class.",
"example": {
"event_name": "UserCreated",
"parameters": [
{
"param_name": "user_id",
"param_type_str": "int"
},
{
"param_name": "username",
"param_type_str": "str"
},
{
"param_name": "created_at",
"param_type_str": "datetime"
}
]
},
"properties": {
"name": {
"title": "Name",
"type": "string"
},
"parameters": {
"items": {
"$ref": "#/$defs/EventParameterInputDTO"
},
"title": "Parameters",
"type": "array"
}
},
"required": [
"name"
],
"title": "EventInputDTO",
"type": "object"
}

Naming and Location Conventions

Class: PascalCase, typically ends with 'Event'. File: ${shared_event_name}.py (based on ${shared_event_name}). Location: app/domain/shared_kernel/events.

Example Definition

{
"event_name": "UserCreated",
"parameters": [
{
"param_name": "user_id",
"param_type_str": "int"
},
{
"param_name": "username",
"param_type_str": "str"
},
{
"param_name": "created_at",
"param_type_str": "datetime"
}
]
}