Skip to content

API Reference parrot_formdesigner.extractors.pydantic

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

parrot_formdesigner.extractors.pydantic

View source

Pydantic model extractor for FormSchema generation.

Introspects Pydantic v2 BaseModel classes and produces FormSchema instances. Supports type mapping, Optional/Literal/Enum handling, nested models, list types, and Field() metadata extraction.

Alias FieldConstraints

Re-exported from parrot_formdesigner.core.constraints.FieldConstraints.

Alias FieldOption

Re-exported from parrot_formdesigner.core.options.FieldOption.

Alias FieldType

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

Alias FormField

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

Alias FormSchema

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

Alias FormSection

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

Class PydanticExtractor

Extracts FormSchema from Pydantic v2 BaseModel classes.

Introspects model fields using Pydantic v2's model_fields API and maps Python type annotations to FormField/FieldType values.

Supported mappings:

  • str -> TEXT
  • int -> INTEGER
  • float -> NUMBER
  • bool -> BOOLEAN
  • datetime.datetime -> DATETIME
  • datetime.date -> DATE
  • datetime.time -> TIME
  • Optional[T] -> required=False, type of T
  • Literal["a", "b"] -> SELECT with options
  • Enum subclass -> SELECT with enum values
  • nested BaseModel -> GROUP with children
  • list[T] -> ARRAY with item_template

Method PydanticExtractor.extract

Introspect a Pydantic model and produce a FormSchema.

extract(model: type[BaseModel], *, form_id: str | None = None, title: str | None = None, locale: str = 'en') -> FormSchema

Parameter Type Default Description
model type[BaseModel] Pydantic BaseModel subclass to introspect.
form_id str | None None Optional form identifier. Defaults to lowercase model name.
title str | None None Optional form title. Defaults to CamelCase-to-Title conversion.
locale str 'en' Locale for generated labels.

Returns: FormSchema — FormSchema representing the model's fields.

Alias resolve_rule_references

Re-exported from parrot_formdesigner.core.resolution.resolve_rule_references.

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