Skip to main content

Domain Specification

Description

Encapsulates a business rule or query predicate that can be combined with other specifications.

Definition Schema

The definition for a domain_specification component expects the following structure:

{
"$defs": {
"SpecificationParameterInputDTO": {
"properties": {
"name": {
"title": "Name",
"type": "string"
},
"type_str": {
"title": "Type Str",
"type": "string"
},
"default_value_str": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Default Value Str"
}
},
"required": [
"name",
"type_str"
],
"title": "SpecificationParameterInputDTO",
"type": "object"
}
},
"properties": {
"name": {
"description": "Name of the Specification class (e.g., UserIsActive).",
"title": "Name",
"type": "string"
},
"applies_to_entity_name": {
"description": "Name of the entity this specification applies to (e.g., User).",
"title": "Applies To Entity Name",
"type": "string"
},
"applies_to_entity_module": {
"description": "Module path for the entity (e.g., app_root_name.domain.users.aggregates.user_aggregate).",
"title": "Applies To Entity Module",
"type": "string"
},
"constructor_parameters": {
"description": "Parameters for the __init__ method.",
"items": {
"$ref": "#/$defs/SpecificationParameterInputDTO"
},
"title": "Constructor Parameters",
"type": "array"
},
"description": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Optional docstring for the class.",
"title": "Description"
}
},
"required": [
"name",
"applies_to_entity_name",
"applies_to_entity_module"
],
"title": "SpecificationEngineInputDTO",
"type": "object"
}

Naming and Location Conventions

Class: PascalCase, typically ends with 'Specification'. File: ${domain_specification_name}.py (based on ${domain_specification_name}). Location: app/domain/${bounded_ctx}/specifications. (Requires context: ['bounded_ctx'])

Example Definition

No example available.