Skip to content

C# target

Use the C# target for .NET product surfaces that need generated model types with JSON and YAML serialization helpers.

emit-targets:
- type: CSharp
output-dir: "generated/csharp"
test-dir: "generated/csharp/tests"
namespace: "Typra.Fixtures"
protocol-scaffolds: "compile-only"
OptionWhy it matters
output-dirWhere generated C# source is written.
test-dirWhere generated C# tests are written.
namespaceNamespace for generated types.
protocol-scaffoldsEmits compile-only test scaffolds for generated protocols.

Generated C# surfaces include model types, System.Text.Json helpers, FromYaml/ToYaml helpers, tests, and protocol scaffolds.

using Typra.Fixtures;
var root = FixtureRoot.FromJson(jsonText);
var saved = root.ToJson();

FromYaml and ToYaml provide the same round-trip against YAML input.

Confirm namespace conventions and nullable behavior before publishing generated C# output as a package.