Skip to content

API Reference parrot_formdesigner.core.file_envelope

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

parrot_formdesigner.core.file_envelope

View source

Canonical value shape for upload field types (FEAT-460).

This module defines the FileEnvelope Pydantic model — the unified value shape adopted by all upload-capable field types (FILE, IMAGE, IMAGE_DROPZONE, MULTI_UPLOAD) — along with the UPLOAD_FIELD_TYPES constant and the is_single_cardinality helper used to distinguish single-file fields (FILE, IMAGE) from multi-file fields (IMAGE_DROPZONE, MULTI_UPLOAD).

Alias FieldType

Re-exported from parrot_formdesigner.core.types.FieldType.

Class FileEnvelope

Canonical value shape for all upload field types.

Fields:

Field Type Default Description
filename str Original filename with extension (e.g. "report.pdf").
content_type str MIME type (e.g. "application/pdf").
size int File size in bytes.
blob_ref str | None None Server-side storage reference (e.g. "s3://bucket/key"). None when the file is inline-only (not persisted to blob storage).
data_url str | None None Inline base64 data URL (e.g. "data:image/png;base64,..."). None when the file exceeds max_inline_size_bytes.
thumbnail_url str | None None URL to a server-generated thumbnail (images only). None for non-image files or when generation fails.
checksum str | None None SHA-256 integrity hash (e.g. "sha256:abcdef..."). Always computed server-side from the received content.

Attribute UPLOAD_FIELD_TYPES

Field types whose value shape is (or maps to) a FileEnvelope.

Type: frozenset[FieldType]

Function is_single_cardinality

Return whether an upload field type accepts a single file only.

is_single_cardinality(field_type: FieldType) -> bool

Parameter Type Default Description
field_type FieldType The field type to check.

Returns: bool — True for FILE and IMAGE (single-file fields). False for IMAGE_DROPZONE and MULTI_UPLOAD (multi-file fields).

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