Skip to content

feat(codegen): generate C# process api (beta) - #90

Merged
emaarco merged 1 commit into
mainfrom
issue-89
Sep 17, 2026
Merged

emaarco merged 1 commit into
mainfrom
issue-89

Conversation

@emaarco

@emaarco emaarco commented Sep 15, 2026

Copy link
Copy Markdown
Member

Closes #89

What

Adds OutputLanguage.CSHARP, generating a static class of const string constants so .NET workers talking to a JVM-hosted engine stop hardcoding BPMN strings.

Beta scope

Constants only: process id, engine, elements, call activities, messages, service tasks, timers, errors, escalations, signals, variables.

Relations / Variants are not generated — every node of them derives from the JVM-only bpmn-to-code-runtime, so a partial navigation API would not compile. In exchange the generated .cs file has no dependencies at all. Variable direction moves from the wrapper type into an XML doc comment, so it still shows in IntelliSense.

Two corrections to the issue

  • The issue assumed C# could mirror Java's "class with public static final" shape. Since typed navigation landed, every section except ServiceTasks wraps values in runtime types — so plain const string is the only dependency-free option.
  • The issue points at static/js/app.js, which is dead code (index.html loads main.js). Web changes are in main.js. app.js / json-app.js want deleting in a separate cleanup.

Notable

CSharpWriter disambiguates a member whose name equals its enclosing type — C# rejects that (CS0542), which a BPMN element called Elements would otherwise trigger. The JVM builders never hit it because their constants are UPPER_SNAKE.

Emission is templated since no C# poet library exists. Recorded in ADR 020, which amends ADR 005.

Verification

  • Generated C# compiled with the real compiler (TreatWarningsAsErrors=true): 0 warnings, 0 errors for Zeebe, Camunda 7, Operaton and nested subprocesses
  • CSharpCompilationTest skips without a .NET SDK; actions/setup-dotnet added to build-backend.yml so it gates PRs
  • 100% line coverage on the new classes; PIT 84% (threshold 80)
  • Web UI checked end to end: .cs filename, C# highlighting, and the JVM runtime-dependency / library-sources panels correctly hidden — Kotlin path unchanged

Release

Intended to ship inside 6.0.0 — the version is already major from the existing breaking commits. Land this first, let release-please regenerate #88, then merge #88.

@emaarco emaarco self-assigned this Sep 16, 2026
Adds OutputLanguage.CSHARP, emitting a static class of const string
constants so .NET workers talking to a JVM-hosted engine can stop
hardcoding BPMN strings.

Beta scope is constants only. Relations/Variants are omitted because
every node of them derives from the JVM-only bpmn-to-code-runtime; in
exchange the generated .cs file has no dependencies at all. Variable
direction moves from the wrapper type into an XML doc comment.

Emission is templated (CSharpWriter) since no C# poet library exists —
recorded in ADR 020, which amends ADR 005. Output is compile-checked
against the real C# compiler for all three engines, skipped when no
.NET SDK is present and installed in CI.

Closes #89
@github-actions

Copy link
Copy Markdown
Contributor

Test Coverage

Module Line Coverage
bpmn-to-code-core 97.7% (2429/2485 lines)
bpmn-to-code-gradle 25.7% (29/113 lines)
bpmn-to-code-maven 62.2% (28/45 lines)
bpmn-to-code-web 95.7% (198/207 lines)
bpmn-to-code-testing 97.2% (171/176 lines)
bpmn-to-code-runtime 100.0% (80/80 lines)

@emaarco
emaarco merged commit a03b492 into main Sep 17, 2026
5 checks passed
@emaarco
emaarco deleted the issue-89 branch September 17, 2026 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Generate C# (.NET) Process API output (beta)

1 participant