Go Formats
Module: github.com/redelay/go-framework/core
The Redelay compilation pipeline supports importing from and exporting to multiple specification formats. All formats convert to/from the canonical IR before any processing.
AsyncAPI import/export
The core/asyncapi package imports AsyncAPI 2.x YAML documents and exports IR Documents
to AsyncAPI 2.6 YAML.
Import
import "github.com/redelay/go-framework/core/asyncapi"
doc, err := asyncapi.ImportYAML(reader) // AsyncAPI YAML → *ir.Document
Converts channels to ir.Channel with publish/subscribe events and Kafka group ID bindings.
Export
err := asyncapi.Export(doc, writer) // *ir.Document → AsyncAPI 2.6 YAML
Export behavior:
- IR channels with publish/subscribe events → AsyncAPI channels
- If no channels exist but events are present, creates synthetic channels using
entity_type.actionas topic name - Kafka bindings for group IDs
AsyncAPI YAML example
asyncapi: "2.6.0"
info:
title: My Events
version: "1.0"
channels:
order.created:
description: Order creation events
publish:
operationId: OrderCreated
message:
name: OrderCreated
bindings:
kafka:
groupId: order-service
Business model import/export
The core/businessmodel package parses business model YAML and converts to/from IR.
Import
import "github.com/redelay/go-framework/core/businessmodel"
spec, err := businessmodel.ParseYAML(reader) // YAML → *Spec
doc := businessmodel.Normalize(spec) // *Spec → *ir.Document
Export
err := businessmodel.Export(doc, writer) // *ir.Document → business model YAML
Export behavior:
- If modules exist, each module becomes a domain with entities, events, and processes (workflows)
- If no modules exist, creates a single domain from top-level items
Business model YAML format
title: E-Commerce Platform
version: "1.0"
domains:
- name: billing
description: Billing domain
entities:
- name: invoice
fields: [amount, currency, status]
events:
- name: invoice_created
entity_type: invoice
action: created
processes:
- name: payment_flow
triggers: [invoice_created]
steps: [validate, charge, confirm]
Domain types
| Type | Description |
|---|---|
Spec | Root business model document |
Domain | Bounded context / business domain |
BizEntity | Business entity with field name list |
BizEvent | Business event (entity_type + action) |
Actor | Person or system interacting with the domain |
Process | Business process with named steps and triggers |
OpenAPI tool schema export
The core/openapi package provides functions for exporting IR Documents as
function-calling tool definitions (JSON Schema format compatible with LLM tool-use APIs).
Export functions
import "github.com/redelay/go-framework/core/openapi"
tools := openapi.ExportActions(doc) // IR actions → tool definitions
tools = openapi.ExportEntities(doc) // IR entities → get_<name> lookup tools
tools = openapi.ExportCommands(doc) // IR commands → tool definitions
tools = openapi.ExportAll(doc) // all of the above combined
err := openapi.WriteTools(writer, tools) // serialize as JSON
Output format
[
{
"type": "function",
"function": {
"name": "create_invoice",
"description": "Create a new invoice",
"parameters": {
"type": "object",
"properties": {
"amount": { "type": "number", "description": "Invoice amount" },
"currency": { "type": "string" }
},
"required": ["amount"]
}
}
}
]
Type mapping (IR → JSON Schema)
| IR FieldType | JSON Schema type |
|---|---|
string, date, datetime, uuid | "string" |
integer | "integer" |
float | "number" |
boolean | "boolean" |
array | "array" |
object | "object" |
Supports nested properties, items for arrays, enum, format, and required fields.
Format conversion matrix
All formats can be converted via the IR hub:
| From | To |
|---|---|
flowdsl | json, yaml, flowdsl, openapi |
openapi | json, yaml, flowdsl, openapi |
asyncapi | json, yaml, flowdsl, openapi |
businessmodel | json, yaml, flowdsl, openapi |
Use the redelayctl CLI to convert between formats from the command line.