Domain Value Object
Description
An immutable object defined by its attributes rather than a unique identity. Used to measure, quantify, or describe things in the domain.
Definition Schema
The definition for a domain_value_object
component expects the following structure:
{
"$defs": {
"ValueObjectFieldInputDTO": {
"description": "Defines a field within a Value Object.",
"example": {
"name": "amount",
"type_str": "Decimal"
},
"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": "ValueObjectFieldInputDTO",
"type": "object"
}
},
"description": "DTO for defining a Value Object class.",
"example": {
"description": "Represents a monetary value with currency.",
"fields": [
{
"name": "amount",
"type_str": "Decimal"
},
{
"name": "currency",
"type_str": "str"
}
],
"name": "MoneyVO"
},
"properties": {
"name": {
"title": "Name",
"type": "string"
},
"fields": {
"items": {
"$ref": "#/$defs/ValueObjectFieldInputDTO"
},
"title": "Fields",
"type": "array"
},
"description": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Description"
}
},
"required": [
"name"
],
"title": "ValueObjectInputDTO",
"type": "object"
}
Naming and Location Conventions
Class: PascalCase, typically ends with 'ValueObject'. File: ${domain_value_object_name}.py
(based on ${domain_value_object_name}
). Location: app/domain/${bounded_ctx}/value_objects
. (Requires context: ['bounded_ctx'])
Example Definition
{
"name": "MoneyVO",
"description": "Represents a monetary value with currency.",
"fields": [
{
"name": "amount",
"type_str": "Decimal"
},
{
"name": "currency",
"type_str": "str"
}
]
}