Query
Description
Represents a request for information from the system. Queries do not change state and are handled by Query Handlers.
Definition Schema
The definition for a query
component expects the following structure:
{
"$defs": {
"QueryParameterInputDTO": {
"description": "Generic DTO for defining a parameter (field) in a generated query class.",
"example": {
"default_value_str": null,
"param_name": "post_id",
"type": "uuid.UUID"
},
"properties": {
"name": {
"title": "Name",
"type": "string"
},
"type": {
"title": "Type",
"type": "string"
},
"default_value_str": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Default Value Str"
}
},
"required": [
"name",
"type"
],
"title": "QueryParameterInputDTO",
"type": "object"
}
},
"description": "DTO for defining a query class.",
"example": {
"parameters": [
{
"name": "post_id",
"param_type_str": "uuid.UUID"
}
],
"query_name": "GetPostByIdQuery"
},
"properties": {
"name": {
"title": "Name",
"type": "string"
},
"parameters": {
"items": {
"$ref": "#/$defs/QueryParameterInputDTO"
},
"title": "Parameters",
"type": "array"
}
},
"required": [
"name"
],
"title": "QueryInputDTO",
"type": "object"
}
Naming and Location Conventions
Class: PascalCase, typically ends with 'Query'. File: ${query_name}.py
(based on ${query_name}
). Location: app/application/${bounded_ctx}/queries
. (Requires context: ['bounded_ctx'])
Example Definition
{
"query_name": "GetPostByIdQuery",
"parameters": [
{
"name": "post_id",
"param_type_str": "uuid.UUID"
}
]
}