← All posts

JSON Schema for Typed Workflow Inputs (Forms, APIs, and Agents)

How Wavemaker promotes workflow inputs into Draft 2020-12 JSON Schema on GET /w/{slug}, validates runs server-side, and keeps one contract for Hub forms, REST, and MCP wf_ tools.

Illustration for: JSON Schema for Typed Workflow Inputs (Forms, APIs, and Agents)
Conceptual illustration — product screenshots appear in the guide below where they help you click through.

One input contract, three surfaces: the Hub form on /w/{slug}, your backend’s POST /w/{slug}/runs, and your agent’s wf_<slug> MCP tool all read from the same JSON Schema. That is how Wavemaker avoids the classic generative-API problem — undocumented prompt blobs — on the workflow API. This post covers promotion, schema shape, validation, and codegen — not Comfy node widgets (those transpile separately; see Import ComfyUI workflows).

Answer-first: what integrators download

curl -s https://api.wavemaker.io/api/v1/w/product-teaser \
  -H "Authorization: Bearer mcp_your_key" | jq '.workflow.input_schema'

You get Draft 2020-12 JSON Schema describing the inputs object for runs:

  • Required fields match what the compile gate enforced at publish time.
  • Enums surface when the builder locked choices (aspect ratio presets, voice ids from allowlists).
  • Format hints (uri, image_asset) map to platform validators — not every JSON Schema keyword is exposed to anonymous clients on premium listings, but runners always see enough to submit.

The static app page hydrates the same document client-side (Publish your AI workflow as an app).

From builder fields to $input wiring

Authors declare promoted inputs in the workflow editor — each input has:

ConceptRole
keyStable id referenced as $input.product_url in block params
typestring, number, boolean, enum, image, etc.
defaultOptional; shown on Hub and applied when omitted if allowed
label / descriptionUX + agent-readable help

At compile time, the compiler resolves $input.* references, typechecks against block manifests, and builds the cost envelope from literal + input-driven params. At publish, the promoted input list freezes into workflow_spec_versions — API consumers pin version to keep the schema stable (workflows as API endpoints).

Changing inputs after publish requires a new published version; integrators on default “latest published” pick up schema changes when creators ship — plan semver-style communication with your customers.

Server-side validation on run and estimate

POST /w/{slug}/estimate and /runs share validation:

  1. Parse JSON body inputs.
  2. Validate against the pinned version’s schema (or latest published).
  3. On success, estimate computes line items; run enqueues kernel execution.

Validation errors return structured 400s with JSON Pointer paths — feed them to agents for self-repair loops (AI agents that build pipelines). Estimates are free; use them as a dry-run validator in CI.

Image and URL inputs

  • URL fields must be HTTPS reachable from Wavemaker runners (scraping blocks enforce robots and size caps).
  • Image inputs typically reference upload keys from POST /api/v1/uploads or dataset items — not raw megabyte base64 in JSON. The schema documents allowed patterns; MCP tools mirror the same constraints.

Brand-site URLs often pair with scrape blocks — schema describes one string; behavior lives in the graph (Turn a website URL into a video covers managed video; workflows use the same scrape primitives in blocks).

Client codegen patterns

Because GET /api/v1/openapi.json describes routes but per-slug input shapes vary, most teams:

  1. Fetch GET /w/{slug} at deploy time (or when creators publish).
  2. Generate a TypeScript interface or JSON Schema file checked into repo.
  3. Call estimate in CI with fixture inputs before promoting config.

OpenAPI alone cannot enumerate every Hub workflow — combine platform OpenAPI (OpenAPI for generative media) with per-slug schema artifacts. For agents, paste input_schema into context or rely on MCP tool parameters (Dynamic MCP tools).

Hub form parity

AppPageIsland renders from the same schema — conditional fields, enum selects, and estimate buttons. Runners see what API integrators get; no hidden required params. Signed-out visitors may see redacted premium pricing but still read input definitions for SEO and sharing.

Workflow app page — form generated from JSON Schema inputs

Published Hub app page at /w/{slug} with typed inputs and Run.

Version pinning and schema drift

StrategySchema source
Default latest publishedChanges when creator publishes
"version": N in run bodyFrozen to version N’s promotion set
Fork after remixNew spec id + slug under your org

Remix lineage is visible on Hub pages (Remixing AI workflows) — schema diffs should be release-noted when you maintain public integrations.

Enum and constraint patterns

Authors use enums when integrators should not send free-form strings:

  • Aspect ratio presets matching engine capability grids
  • Voice id from org allowlist after design_voice bindings
  • Style profile ids from published style-locked workflows (Style-locked workflows)

JSON Schema minimum / maximum on numeric inputs guard duration and batch sizes at validation time — compile may still fail if block manifests require stricter bounds.

Anonymous vs authenticated schema reads

Hub SEO pages expose input labels to crawlers; premium listings may hide creator graph but keep runner-facing schema on authenticated API. Public estimate previews on /w/{slug} let signed-out visitors see approximate pricing — integrators should always authenticate for production quotes with BYOK lines (BYOK AI media generation).

Multi-input workflows and $expr

Advanced specs combine inputs with lightweight expressions (concat labels, conditional defaults). The promoted schema exposes only inputs, not internal $expr — runners stay unaware of graph glue. When debugging validation failures, fetch compile diagnostics — they reference internal node ids while API 400s reference JSON Pointer paths under inputs.

Testing schemas in staging

  1. Clone Open workflow from Hub via remix (Remixing AI workflows).
  2. Publish to staging org slug.
  3. Snapshot input_schema into repo; wire contract test to estimate endpoint.
  4. On creator publish notification, diff schema in CI.

Interop with form builders

Because schema is Draft 2020-12, @rjsf/core, react-jsonschema-form, and similar renderers work against GET /w/{slug} responses. File upload widgets map to Wavemaker upload keys — flow: POST /uploads → pass key in inputs.image_ref (exact key names per workflow).

FAQs for schema authors

Optional vs required: optional inputs must have defaults or blocks must tolerate absence — compile fails otherwise.

Breaking changes: renaming keys breaks integrators; prefer additive keys and deprecate in description text.

Premium workflows: schema + pricing only — graph remains hidden.

Style and image inputs in schema

Workflows with style-locked references or image inputs declare typed fields — runners upload via API first, then pass keys in inputs. Schema descriptions should link to max file sizes and moderation rules (workflows overview). Agents using MCP must call upload tools in full mode or REST uploads before wf_ tools when inputs require asset keys.

Premium hide and public SEO

Search engines index /w/{slug} copy and input labels; JSON-LD FAQ from blog posts is separate. Schema on public pages helps LLM crawlers (AI workflow builder) understand required runner fields without leaking premium graph JSON.

Migrating from untyped JSON configs

Teams often start with { "prompt": "..." } blobs in config files. Migration path:

  1. Publish workflow with promoted inputs replacing free text where possible.
  2. Fetch input_schema and replace config keys one field at a time.
  3. Run estimate in CI until legacy keys are removed.

Typed inputs reduce agent hallucination — enums especially for aspect ratio and model pins.

Where to go next

Frequently asked questions

Where do I fetch a workflow's input schema?
GET /api/v1/w/{slug} returns input_schema (JSON Schema Draft 2020-12) alongside human labels, defaults, and run/estimate URLs. Anonymous callers can read Open listings for discovery; runs require auth.
How are workflow inputs defined in the builder?
Promoted inputs on the WorkflowSpec — text, number, boolean, enum, URL, image upload keys, and structured objects — compile through the same gate as blocks. Publish freezes the promoted set into the version row.
Does MCP use the same schema?
Yes. Dynamic wf_<slug> tools expose the identical property bag as JSON Schema tool parameters; run_hub_workflow accepts the same inputs object as POST /w/{slug}/runs.
Can I validate payloads client-side before spend?
Yes — compile the schema with your validator (Ajv, zod-from-json-schema, OpenAPI codegen) and call POST /w/{slug}/estimate with the same body; estimates are free and run the same validation path minus execution.