Skip to content

API Reference parrot_formdesigner.renderers.jsonschema

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

parrot_formdesigner.renderers.jsonschema

View source

JSON Schema renderer for FormSchema.

Renders FormSchema as a structural JSON Schema with custom x- extensions, suitable for consumption by custom form-builder components (e.g., Svelte).

Output:

  • content: structural JSON Schema dict (type=object, properties, required)
  • style_output: StyleSchema.model_dump() dict
  • content_type: "application/schema+json"

Alias AbstractFormRenderer

Re-exported from parrot_formdesigner.renderers.base.AbstractFormRenderer.

Attribute FILE_ENVELOPE_SCHEMA

Type: dict[str, Any]

Alias FallbackRenderer

Re-exported from parrot_formdesigner.renderers.base.FallbackRenderer.

Alias FieldRenderer

Re-exported from parrot_formdesigner.renderers.base.FieldRenderer.

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 FormSubsection

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

Class JsonSchemaRenderer

Renders FormSchema as a structural JSON Schema with x- extensions.

The output is designed for custom frontend components that need both the data schema and form metadata (sections, labels, dependencies).

Output format:

  • content: JSON Schema dict (type=object, $schema, title, properties, required)
  • style_output: StyleSchema dict (layout, field styles, etc.)
  • content_type: "application/schema+json"

Extensions used:

  • x-field-type: original FieldType value
  • x-section: section metadata (section_id, title, description)
  • x-depends-on: conditional visibility rule (serialized DependencyRule, including any operations on the rule)
  • x-post-depends: forward effects (serialized list of PostDependency objects, present only when field.post_depends is non-empty)
  • x-options-source: dynamic options source configuration
  • x-placeholder: placeholder text
  • x-read-only: read-only flag

Under form.unknown_fields == UnknownFieldsPolicy.REJECT (FEAT-458), the top-level schema also emits additionalProperties: false — the server will 422 an undeclared key, so a standards-compliant client can validate that locally. drop and keep emit nothing, keeping the output byte-identical to every pre-FEAT-458 form.

Method JsonSchemaRenderer.render

Render a FormSchema as a structural JSON Schema.

render(form: FormSchema, style: StyleSchema | None = None, *, locale: str = 'en', prefilled: dict[str, Any] | None = None, errors: dict[str, str] | None = None) -> RenderedForm

Parameter Type Default Description
form FormSchema The form schema.
style StyleSchema | None None Style configuration. Serialized to style_output.
locale str 'en' Locale for i18n label resolution.
prefilled dict[str, Any] | None None Pre-filled values (included as x-default in properties).
errors dict[str, str] | None None Field errors (ignored in schema output).

Returns: RenderedForm — RenderedForm with JSON Schema dict as content, style dict as style_output, and content_type="application/schema+json".

Alias LocalizedString

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

Alias RenderedForm

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

Alias StyleSchema

Re-exported from parrot_formdesigner.core.style.StyleSchema.

Alias UnknownFieldsPolicy

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

Attribute logger

Function type_level_value_shape

Return the type-only JSON Schema value-shape contract for a FieldType.

FEAT-448 (TASK-2338): this is the single source of truth published in the GET /api/v1/form-controls catalog's value_shape field (controls/builtin.py) — a client asserts a submitted value against this shape without maintaining its own copy. It reuses exactly the same _TYPE_MAP / _FORMAT_MAP / _STRUCTURAL_EXTRAS that _field_to_property() uses for per-field rendering, so there is no second list to drift out of sync.

Unlike _field_to_property(), this is type-level only: it carries no per-field data (constraints, options, labels) since the catalog describes a type, not a specific field instance.

type_level_value_shape(field_type: FieldType) -> dict[str, Any]

Parameter Type Default Description
field_type FieldType The FieldType to describe.

Returns: dict[str, Any] — A JSON Schema fragment: at minimum {"type": ...}, plus "format" where applicable, plus any structural extras (items/properties/required) for types whose value shape is more than a bare scalar.

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