4.7 KiB
Unified Schema Format: Flat Format for All Schema Types
Date: 2026-02-05
Summary
Unified all schema types (param_schema, out_schema, conf_schema) to use the same flat StackStorm-style format with inline required and secret per parameter. Previously, param_schema used flat format while out_schema and conf_schema used standard JSON Schema ({ type: "object", properties: { ... }, required: [...] }). This inconsistency prevented features like secret badges from working on output and configuration schemas.
Motivation
- No reason for
conf_schemaandout_schemato use a different format thanparam_schema - Users should be able to mark
secretandrequiredinline on any schema type - Eliminates dual-format shim logic in the web UI (
extractPropertiesbackward compatibility branch) - Project is pre-production — no data migration needed, just adjust configurations
Changes
Pack YAML Files (12 files)
Converted all top-level type: object + properties wrappers to flat format, moving required array entries inline:
packs/core/pack.yaml—conf_schemapacks/examples/pack.yaml—conf_schemapacks/core/sensors/interval_timer_sensor.yaml—parameterspacks/core/triggers/intervaltimer.yaml—outputpacks/core/triggers/crontimer.yaml—outputpacks/core/triggers/datetimetimer.yaml—outputpacks/core/actions/http_request.yaml—output_schemapacks/core/actions/build_pack_envs.yaml—output_schemapacks/core/actions/download_packs.yaml—output_schemapacks/core/actions/get_pack_dependencies.yaml—output_schemapacks/core/actions/register_packs.yaml—output_schemapacks/core/workflows/install_packs.yaml—output_schemapacks/examples/actions/list_example.yaml—output_schema
Nested structures (e.g., items: { type: object, properties: { ... } } within array parameters) remain unchanged — only the top-level wrapper was converted.
Web UI (6 files)
ParamSchemaForm.tsx— Removed legacy JSON Schema branch fromextractProperties(). RemovedextractJsonSchemaProperties()(no longer needed). SingleextractProperties()handles all schema types.ParamSchemaDisplay.tsx— Updated doc comment, tightenedschemaprop type fromParamSchema | anytoParamSchema.SchemaBuilder.tsx— Removed legacy JSON Schema reading from bothuseEffectinitializer andhandleRawJsonChange. Only reads/writes flat format.PackForm.tsx— UpdatedconfSchemainitial state from JSON Schema to{}. UpdatedhasSchemaPropertiescheck (no longer looks for.propertiessub-key). Updated config sync logic, validation, schema examples (API/Database/Webhook examples now use flat format withsecretandrequiredinline), andParamSchemaFormpass-through (passesconfSchemadirectly instead ofconfSchema.properties).TriggerForm.tsx— UpdatedparamSchemaandoutSchemainitial states from JSON Schema to{}.TriggersPage.tsx— UsesextractProperties()for bothparam_schemaandout_schema.
Backend Rust (5 files)
crates/api/src/validation/params.rs— Addedflat_to_json_schema()function that converts flat format to JSON Schema internally before passing tojsonschema::Validator. Updatedvalidate_trigger_params()andvalidate_action_params()to call the converter. Converted all 29 test schemas from JSON Schema to flat format. Added 4 unit tests forflat_to_json_schema()and 1 test for secret field validation.crates/api/src/dto/action.rs— Updatedout_schemadoc comment and utoipa example.crates/api/src/dto/trigger.rs— Updatedout_schemaand sensorparam_schemadoc comments and utoipa examples.crates/api/src/dto/workflow.rs— Updatedout_schemadoc comment and utoipa example.crates/api/src/dto/pack.rs— Updatedconf_schemadoc comment and utoipa example.crates/api/src/dto/inquiry.rs— Updatedresponse_schemadoc comment and utoipa example.
Documentation
AGENTS.md— Updated "Parameter Schema Format" section to "Schema Format (Unified)", reflecting that all schema types now use the same flat format.
Test Results
- All 29 backend validation tests pass (converted to flat format schemas)
- TypeScript compilation clean (zero errors)
- Rust workspace compilation clean (zero warnings)
Format Reference
Before (JSON Schema for out_schema/conf_schema):
output:
type: object
properties:
fired_at:
type: string
format: date-time
required:
- fired_at
After (unified flat format):
output:
fired_at:
type: string
format: date-time
required: true
secret: false # optional, can mark outputs as secret too