DDD.Params (vicander v0.1.1)

Copy Markdown View Source

The declared input of a use case: the fields, descriptions and validation that DDD.Command and DDD.Query share.

command do
  description "Add an item to a todo list"

  field :list_id, :uuid, required: true, description: "The list to add to"
  field :title,   :string, required: true, description: "What needs doing"
  field :due_date, :date, description: "Optional; not in the past"
end

A field is field name, type, opts. The type is any DDD.Type. Options: required: true, default: value and description: "...". new/1 reports every missing required field and every value of the wrong type at once, as a DDD.Error with a violation per field.

The declaration is also readable by tools: __description__/0 and __params__/0 ([{name, type, opts}]), which is how the MCP server builds a tool's input schema.

Summary

Functions

Describe the use case in a sentence.

Declare a field: field name, type, required: true, default: ..., description: "...".

Functions

description(text)

(macro)

Describe the use case in a sentence.

field(name, type, opts \\ [])

(macro)

Declare a field: field name, type, required: true, default: ..., description: "...".