Skip to content

API Reference parrot_formdesigner.services.metadata_callbacks

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot_formdesigner.services.metadata_callbacks

View source

Pydantic I/O models for submission metadata callbacks.

A metadata callback is an async coroutine registered with register_form_callback (in :mod:.callback_registry) and referenced from a FormMetadataField with source='callback'. The submit handler invokes the callback in the enrichment step (after validation, before storage) and merges its output into the persisted submission.

These models intentionally live in their own module — separate from rest_field_resolver — because the input payload is shaped around form answers rather than uploaded file content.

Alias FormMetadataField

Re-exported from parrot_formdesigner.core.schema.FormMetadataField.

Class MetadataCallbackInput

Payload delivered to a registered metadata-callback coroutine.

Fields:

Field Type Default Description
form_id str ID of the form being submitted.
submission_id str UUID of the in-flight submission (not yet stored).
user_id str | None None Authenticated user ID (may be None).
username str | None None Authenticated username (may be None).
org_id int | None None Authenticated organization ID (may be None).
tenant str | None None Tenant slug (may be None).
programs list[str] Tenant programs list (may be empty).
submitted_at datetime UTC timestamp of the submission.
answers dict[str, Any] Sanitized form answers as produced by the validator. The callback MUST treat this dict as read-only.
field FormMetadataField The FormMetadataField declaration that triggered this invocation. Carries options / default for the callback to honour.

Class MetadataCallbackOutput

Return value from a registered metadata-callback coroutine.

A callback MAY return either a single value (stored under the declaring field's key) OR a fan-out dict of additional keys merged into the submission. When values is set it takes precedence over value.

Fields:

Field Type Default Description
success bool Whether the callback completed successfully. False triggers either the default substitution (when the field is not required) or a 422 (when it is).
value Any | None None Single computed value, stored under the field's key. Used only when values is None.
values dict[str, Any] | None None Optional fan-out dict merged flat into the submission. Every key must be a valid identifier — keys are checked at merge time by the enricher.
error str | None None Human-readable error message on failure (logged).

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally