Skip to main content
Schemas tell Devset what your event payloads look like. They serve two purposes: they power the Function Studio’s field tree picker so you can select fields by name rather than typing paths by hand, and they provide the type information needed for Protobuf binary encoding. You store schemas in the built-in Schema Repo, give each one a unique ID, and reference that ID from your workflows and stages.

JSON Schema

Devset accepts standard JSON Schema (draft-07 and later) for JSON payloads. Define the properties, type, and any required fields you want Devset to surface in the field picker.
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "OrderCreated",
  "type": "object",
  "properties": {
    "orderId": {
      "type": "string",
      "format": "uuid",
      "description": "Unique identifier for the order"
    },
    "customerId": {
      "type": "string",
      "description": "Identifier of the customer who placed the order"
    },
    "total": {
      "type": "number",
      "description": "Total order value in the smallest currency unit"
    },
    "currency": {
      "type": "string",
      "enum": ["USD", "EUR", "GBP"]
    },
    "status": {
      "type": "string",
      "enum": ["pending", "confirmed", "processing", "shipped"]
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    }
  },
  "required": ["orderId", "customerId", "total", "currency", "status", "createdAt"]
}
Paste this document into the Schema Repo editor and save it with a unique schema ID such as order-created-v1.

Protobuf

For binary payloads, Devset accepts .proto source file content directly. When you save a Protobuf schema, Devset compiles it to a FileDescriptorSet — a binary representation of the compiled type tree — which the engine uses at runtime to serialise payloads into the correct wire format.
syntax = "proto3";

package devset.events;

message PaymentInitiated {
  string payment_id = 1;
  string customer_id = 2;
  int64 amount = 3;
  string currency = 4;
  string method = 5;
  int64 initiated_at_ms = 6;
}
Devset compiles your .proto source automatically when you save the schema. You do not need to run protoc locally or upload a pre-compiled descriptor. If the schema contains syntax errors, the Schema Repo editor will report the compilation failure inline.
When using a Protobuf schema, set contentType: "application/x-protobuf" on your workflow and add a wireFormat block to the stages that should serialise in binary:
{
  "stage": "build-payment",
  "event": "payment.initiated",
  "schemaId": "payment-initiated-v1",
  "wireFormat": {
    "messageType": "PaymentInitiated"
  },
  "set": {
    "payment_id": { "$fn": "uuid()" },
    "amount": { "$fn": "long(100, 100000)" },
    "currency": { "$fn": "choice(USD, EUR, GBP)" }
  },
  "emit": true
}

Referencing a Schema in a Workflow

Attach a schema to an entire workflow with the top-level schemaId field. Every stage in the workflow inherits this schema unless it declares its own:
{
  "id": "order-flow",
  "messageType": "kafka",
  "contentType": "application/json",
  "producerName": "local-kafka",
  "topic": "orders",
  "schemaId": "order-created-v1",
  "executions": 20,
  "state": {},
  "pipeline": [...]
}
To use a different schema on an individual stage, add schemaId directly to that stage object. The stage-level value takes precedence over the workflow-level default:
{
  "stage": "build-line-item",
  "event": "order.item.added",
  "schemaId": "order-item-v2",
  "set": { ... }
}
If most stages in a workflow share a schema but one or two differ, set the common schema at the workflow level and override only the exceptions at the stage level. This reduces repetition and makes the workflow easier to maintain.

Schemas in Function Studio

Function Studio is the visual editor for building stage set expressions. When a schema is associated with a stage, Function Studio loads the schema’s field tree and presents it as a picker. You can click a field to insert the correct $ref or $path expression without typing paths manually.
  • JSON Schema — all properties at every nesting level appear in the picker.
  • Protobuf — fields are read from the compiled FileDescriptorSet and presented in the same picker UI.
A schema is not required to use Function Studio, but without one you must type field paths by hand. Attaching a schema to your workflow or stage is the fastest way to work with complex nested payloads.

Managing Schemas

Open the Schema Repo at /schema-repo in the Devset UI. From there you can:
  1. Create a schema — click New Schema, enter a unique schema ID, choose the type (JSON Schema or Protobuf), paste your definition, and click Save.
  2. Edit a schema — select an existing schema from the list, modify the content, and save. Workflows that reference the schema will use the updated version on their next run.
  3. Delete a schema — select the schema and click Delete. Workflows that reference a deleted schema ID will fail to compile until you update or remove the schemaId reference.
Schema IDs are global within your Devset instance. Renaming a schema ID requires updating every workflow that references the old ID. Use versioned IDs such as order-created-v1 from the start to make future migrations easier.