Data model and events¶
The plan¶
classDiagram
class GenerationPlan {
project_name
namespace
source_service_type: SOAP|REST
target_service_type: SOAP|REST
document_type
soap_version: 1.1|1.2
artifact_type: osb|openapi|wsdl|dotnet
documentation: bool
confirmed: bool
rationale
notes[]
service_metadata
}
class PlannedOperation {
name
http_method
path
selected: bool
group_hint
source_document
}
class ProxyGroup {
name
operations[] (shared allowed)
endpoint_path
target_service_type
namespace
}
class BusinessServiceSpec {
name
operations[]
endpoint_uri
source_service_type
source_document
}
GenerationPlan "1" *-- "*" PlannedOperation : operations
GenerationPlan "1" *-- "*" ProxyGroup : proxies
GenerationPlan "1" *-- "*" BusinessServiceSpec : business_services
models/domain.GenerationPlan with models/plan.ProxyGroup and BusinessServiceSpec. service_metadata caches the parsed operations (fields, parameters, responses, contracts) so a run does not parse the documents again.
Defaults when the lists are empty (plan_ops.effective_groups / effective_business_services):
| Default | |
|---|---|
| Proxy groups | One proxy named after the project with every selected operation, or one proxy per source document when operations come from several documents |
| Business services | {Project}_BS for a single source document; otherwise {Document}_BS per document |
| Proxy endpoint | /ProxyServices/{Proxy} |
| Proxy namespace | The plan namespace for a single proxy; {namespace}/{Proxy} with several |
| Business service namespace | {namespace}_BS for the default service; {namespace}/{Service} otherwise |
| Backend URI | http://localhost/{Name} (SOAP) or http://localhost:8001/{Name} (REST) |
| Namespace | http://www.sample/{Project} when the plan has none |
These are resolved into an OsbLayout (generators/layout.resolve_layout) for each run. An operation may appear in several proxy groups; it always belongs to exactly one business service.
Resolved layout¶
Each ResolvedProxy in the layout carries, besides its name, endpoint, namespace and pipeline:
| Field | Meaning |
|---|---|
routes |
One ProxyRoute per business service the proxy uses, in order of first use: the operations sent to it and the HTTP headers its route forwards |
business_service |
The default route: the business service with most operations (the only one for a direct route) |
contracts |
One ProxyContract per schema that defines some of the proxy's operations: schema_name, namespace, operations, reused (another proxy's schema imported unchanged) and xslt_prefix ("" for the shared {Op}Request.xsl, {Proxy}_ for proxy-specific files) |
Layouts stored by earlier versions have no routes or contracts; they are read as one direct route and the proxy's own schema. See Composing services for the rules.
Plan operations¶
Every change to a plan, from the Designer, the chat or PATCH /v1/sessions/{id}/plan, is a list of these operations, applied in order:
op |
Fields | Effect |
|---|---|---|
create_group |
name, operations, endpoint_path? |
New proxy group (the operations move into it) |
rename_group |
group, new_name |
Rename a proxy group |
move_operations |
operations, to_group |
Put operations in this proxy only, removing them from every other proxy (the group is created if missing) |
assign_operations |
operations, to_group |
Add operations to a proxy; proxies that already expose them keep them |
unassign_operations |
operations, group |
Remove operations from one proxy; other proxies keep them |
remove_group |
group, move_to? |
Remove a group; its operations are added to move_to, or stay in their other proxies, or become unassigned |
set_group_endpoint |
group, endpoint_path |
Proxy endpoint, must start with / |
set_group_target |
group, target_service_type |
SOAP or REST for one proxy |
set_group_namespace |
group, namespace |
Namespace of one proxy |
exclude_operations |
operations |
Leave operations out of generation (removed from every proxy) |
include_operations |
operations, group? |
Bring them back (into group when groups exist) |
apply_grouping |
strategy |
Replace all groups with a suggestion: single, path_segment, group_hint, source_document |
set_groups |
groups |
Replace all groups at once (what the Designer sends; an operation may be listed in several groups) |
set_business_service_endpoint |
business_service, endpoint_uri |
Backend URL of a business service |
set_field |
field, value |
project_name, namespace, source_service_type, target_service_type, artifact_type, soap_version or documentation (true/false) |
Operation and group names are matched case-insensitively; unknown names are rejected with close matches ("Did you mean …"). An edit based on a stale plan version is rejected with the current version.
Plan validation¶
plan_ops.validate_plan and sessions.session_issues produce PlanIssues (code, message, severity, group, operations). Errors block approval.
| Code | Severity | Meaning |
|---|---|---|
NO_OPERATIONS |
error | No operation is selected |
DUPLICATE_OPERATION_NAME |
error | Two source documents define the same operation name |
INVALID_NAME |
error | A proxy name is not a valid NCName / file name |
DUPLICATE_GROUP |
error | Two proxies have the same name |
NAME_CONFLICT |
error | A proxy has the same name as a business service |
EMPTY_GROUP |
error | A proxy has no operations |
UNKNOWN_OPERATION |
error | A proxy lists an operation that is not in the catalog |
EXCLUDED_IN_GROUP |
error | A proxy lists an excluded operation |
INVALID_ENDPOINT |
error | An endpoint does not start with / |
ENDPOINT_CONFLICT |
error | Two proxies share an endpoint |
UNASSIGNED_OPERATION |
error | A selected operation is in no proxy (an operation in several proxies is allowed) |
BS_UNASSIGNED_OPERATION, BS_DUPLICATE_ASSIGNMENT |
error | An operation is in no business service, or in more than one |
MISSING_SCHEMA |
error | A schema referenced by an interface document was not uploaded |
NAMESPACE_REQUIRED |
error | The target is SOAP and no namespace is set |
OUTPUT_TYPE_REQUIRED |
error | No output type |
UNSUPPORTED_DOCUMENT |
error | The primary document is an ICD (specification); generation needs WSDL, WADL or OpenAPI |
DOTNET_NOT_AVAILABLE |
warning | .NET output or a DB mapping was requested; it is a stub |
NO_PLAN, NOT_APPROVED, NO_DOCUMENT |
error | Returned by approve / start-run when there is nothing to run |
Artifact validation¶
generators/validate.validate_artifacts checks each generated file and the references between them. Findings are reported as the run's final_issues; they do not stop the run.
| Code | Meaning |
|---|---|
INVALID_XML, INVALID_JSON |
Not well-formed |
MISSING_ROOT, MISSING_NAMESPACE, MISSING_ELEMENT, MISSING_OPERATION, MISSING_HTTP_METHOD, MISSING_PATH |
A required part of a WSDL, XSD, WADL, XSLT or OpenAPI document is missing |
WRONG_SOAP_VERSION |
WSDL binding does not match the SOAP version |
EXCLUDED_OPERATION |
An artifact exposes an operation not assigned to it |
BROKEN_REFERENCE |
A ref= in a proxy, pipeline or business service, or an XSLT a pipeline uses, points to a file that was not generated |
ROUTING_MISMATCH |
A pipeline does not route to exactly the business services of its operations, or mixes backends without a routing table |
BROKEN_BINDING |
A service names a WSDL binding the WSDL does not define |
MISSING_SCHEMA_REF, OSB_STRUCTURE |
WSDL without its schema; an OSB folder missing |
NO_OPERATIONS |
Nothing to generate for an artifact |
DOCUMENTATION_FAILED |
The technical documentation could not be generated (the project is still complete) |
Database¶
Two SQLite files under {data}/state/:
forge.db: the application database. WAL journal; the schema is managed by Alembic (persistence/migrations) and upgraded automatically at startup.checkpoints.db: LangGraph checkpoints (generation runs byrun_id, session turns bysession:{id}).
erDiagram
sessions ||--o{ session_documents : has
sessions ||--o{ session_plan_versions : has
sessions ||--o{ session_events : has
sessions ||..o{ runs : "session_id (context)"
runs ||--o{ run_events : has
runs ||..o{ repo_changes : "run_id"
sessions {
string id PK
string title
string status
text plan_json
int plan_version
int approved_version
string active_run_id
string last_run_id
text context_json
}
session_documents {
string id PK
string session_id FK
string filename
text stored_path
string document_type
string role
string sha256
}
session_plan_versions {
string session_id PK
int version PK
text plan_json
string source
text summary
}
session_events {
int id PK
string session_id FK
int seq
string type
text payload_json
}
runs {
string id PK
string status
string project_name
string session_id
text snapshot_json
text context_json
}
run_events {
int id PK
string run_id FK
int seq
string event
text payload_json
}
repo_changes {
string id PK
string run_id
string session_id
string repo_id
string branch
string status
text preview_json
text result_json
}
sessions.context_jsonholds turn state: the document fingerprint, missing schemas, specification text, the pending repository change.runs.context_jsonholds what is needed to execute or resume the run: document paths, output folder, plan, plan version, previous run id.- Saving a plan version uses
expected_versionfor optimistic concurrency (VersionConflict→ HTTP 409).
Session events¶
Every change to a session is appended to session_events with an increasing seq and pushed to SSE subscribers.
| Type | Emitted when | Payload (besides created_at) |
|---|---|---|
session_created, session_renamed |
Created / renamed | title |
document_added, document_removed |
Upload / removal | document view, replaced |
message |
A chat message (user, assistant or system) | role, kind (text, plan, warning, error), text, data.actions, data.run_id, data.change_id |
plan_updated |
A new plan version | version, source (ui, chat, system), summary, plan view |
plan_approved |
Approval | version |
run_started, run_finished |
A run starts / ends | run_id, plan_version, previous_run_id / status |
status_changed |
Session status changes | status |
repository_previewed, repository_applied |
Repository preview / apply | change_id, counts / status, result |
run_progress |
Any run progress (transient, no seq) |
run_id, event, node, status, message, progress |
Session statuses: collecting (no interface document), planning, generating, needs_input (run paused or interrupted), completed (the approved version was generated).
Runs¶
Run statuses: queued, running, awaiting_human, interrupted, completed, failed, cancelled.
Progress events (ProgressEvent, stored compactly in run_events): run_started, node_started, node_completed, node_failed, node_skipped, checklist_update, log, artifact_written, interrupt, run_completed, run_failed, run_cancelled.
The checklist (progress/models.checklist_for) per output type:
| Output | Steps |
|---|---|
| OSB | confirm_plan, parse_document, validate_document, human_review, generate_business_service, generate_pipeline, generate_proxy_service, generate_xslts, write_output, final_validate, generate_documentation (when enabled), refine |
| OpenAPI / WSDL | confirm_plan, parse_document, validate_document, human_review, generate_documents, write_output, final_validate, refine |
| .NET / DB mapping | confirm_plan, parse_document, validate_document, human_review, stub_dotnet, refine |
human_review is marked skipped when validation passes. Progress is the share of steps finished (success or skipped).
Generation units¶
| Unit id | Files |
|---|---|
shared |
Pipelines/BasePipelineSoap12.ptx |
business_service:{Name} |
the .bix, its WSDL, XSD and (REST) WADL |
pipeline:{Proxy} |
Pipelines/{Proxy}_PL.pipeline |
proxy:{Proxy} |
the .proxy, its WSDL, XSD and (REST) WADL |
xslt:{Operation} |
Resources/XSLs/{Operation}Request.xsl and …Response.xsl |
documents:{Proxy} |
OpenAPI or WSDL + XSD output for one proxy group |
docs |
Docs/* (Word, Postman, SoapUI) |
Files¶
Data folder¶
{FORGE_DATA_DIR}/
├── state/forge.db, checkpoints.db
├── uploads/{session_id}/… uploaded documents (+ _supplementary/ staged schemas)
├── runs/{run_id}/{Project}/… one folder per run, never shared
├── workspaces/{repo_id}/cache clone without checkout, fetched before each preview
├── workspaces/{repo_id}/changes/{id} git worktree of one change (removed after apply)
└── tmp/ scratch, including the GIT_ASKPASS helper
Generated OSB project¶
{Project}/
├── ProxyServices/{Proxy}_PS.proxy
├── Pipelines/{Proxy}_PL.pipeline
├── Pipelines/BasePipelineSoap12.ptx
├── BusinessServices/{Service}.bix
├── Resources/
│ ├── WSDLs/{Proxy}.wsdl, {Service}.wsdl
│ ├── Schemas/{Proxy}.xsd, {Service}.xsd, CommonSchema.xsd
│ ├── {Proxy}.wadl, {Service}.wadl (REST layers)
│ └── XSLs/{Operation}Request.xsl, {Operation}Response.xsl
└── Docs/
├── {Project}-technical-design.docx
├── {Project}.postman_collection.json
├── {Project}.postman_environment.json
└── {Project}-soapui-project.xml (when a proxy uses SOAP)
Document-only output writes {Project}/{Proxy}.openapi.json, or {Project}/{Proxy}.wsdl and {Proxy}.xsd, per proxy group.
In a repository the project goes under the repository's subpath, and .forge/manifest.json at the repository root records the hash, run and time of every file Middleware Forge wrote.