Domain Business Policy
Description
Encapsulates complex business rules or policies that may change independently of the core domain entities.
Definition Schema
The definition for a domain_business_policy
component expects the following structure:
{
"$defs": {
"PolicyMethodDTO": {
"properties": {
"name": {
"description": "Name of the policy method (e.g., 'is_satisfied_by', 'can_execute').",
"title": "Name",
"type": "string"
},
"parameters": {
"description": "Parameters for the policy method.",
"items": {
"$ref": "#/$defs/PolicyMethodParameterDTO"
},
"title": "Parameters",
"type": "array"
},
"return_type_str": {
"default": "bool",
"description": "Python type string for the return value.",
"title": "Return Type Str",
"type": "string"
},
"description": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Description of the method.",
"title": "Description"
}
},
"required": [
"name"
],
"title": "PolicyMethodDTO",
"type": "object"
},
"PolicyMethodParameterDTO": {
"properties": {
"name": {
"description": "Name of the parameter.",
"title": "Name",
"type": "string"
},
"type_str": {
"description": "Python type string for the parameter.",
"title": "Type Str",
"type": "string"
},
"description": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Description of the parameter.",
"title": "Description"
}
},
"required": [
"name",
"type_str"
],
"title": "PolicyMethodParameterDTO",
"type": "object"
}
},
"properties": {
"name": {
"description": "Name of the Business Policy class (e.g., UserRegistrationPolicy).",
"title": "Name",
"type": "string"
},
"description": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Description of the business policy.",
"title": "Description"
},
"methods": {
"description": "Methods to be included in the policy class.",
"items": {
"$ref": "#/$defs/PolicyMethodDTO"
},
"title": "Methods",
"type": "array"
},
"dependencies": {
"description": "Dependencies to be injected into the policy's __init__ method.",
"items": {
"$ref": "#/$defs/PolicyMethodParameterDTO"
},
"title": "Dependencies",
"type": "array"
}
},
"required": [
"name"
],
"title": "CreateBusinessPolicyDTO",
"type": "object"
}
Naming and Location Conventions
Class: PascalCase, typically ends with 'BusinessPolicy'. File: ${domain_business_policy_name}.py
(based on ${domain_business_policy_name}
). Location: app/domain/${bounded_ctx}/policies
. (Requires context: ['bounded_ctx'])
Example Definition
No example available.