Command introspection
A tool that fills in a command form, or a test that checks nobody removed a command, needs the command’s route and the exact shape of its body. GET /.cratis/commands returns a JSON array with one entry per registered command. For the Tasks sample, which registers its generated metadata:
[{ "name": "RegisterTask", "namespace": "Tasks.Registration", "route": "/api/tasks/registration/register-task", "type": "RegisterTask", "documentationSummary": "Register a task.", "payloadSchema": { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": { "type": "string", "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$", "format": "uuid" }, "title": { "type": "string" } }, "required": ["id", "title"] }}]| Field | Meaning |
|---|---|
name | The command name |
namespace | The namespace, or "" |
route | The execution route; the validation route is this plus /validate |
type | The command name |
documentationSummary | A low-level definition’s summary, or the JSDoc summary of a model-bound command when generated artifact metadata is registered; otherwise "" |
payloadSchema | JSON Schema 2020-12 of the request body |
A concept field appears as its underlying scalar, here a UUID string. Optional and defaulted fields are left out of required, a nullable field is anyOf its type and null, and an @enumeration field is anyOf one const per enum value. Concepts in the document, Enums in the document, and How types appear in the document cover each case; the same schema is the command’s OpenAPI request body.