ZibStack.NET.TypeGen 3.2.4

There is a newer version of this package available.
See the version list below for details.
dotnet add package ZibStack.NET.TypeGen --version 3.2.4
                    
NuGet\Install-Package ZibStack.NET.TypeGen -Version 3.2.4
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ZibStack.NET.TypeGen" Version="3.2.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ZibStack.NET.TypeGen" Version="3.2.4" />
                    
Directory.Packages.props
<PackageReference Include="ZibStack.NET.TypeGen" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ZibStack.NET.TypeGen --version 3.2.4
                    
#r "nuget: ZibStack.NET.TypeGen, 3.2.4"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ZibStack.NET.TypeGen@3.2.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ZibStack.NET.TypeGen&version=3.2.4
                    
Install as a Cake Addin
#tool nuget:?package=ZibStack.NET.TypeGen&version=3.2.4
                    
Install as a Cake Tool

ZibStack.NET.TypeGen

Roslyn source generator that emits TypeScript (.ts) and OpenAPI 3.0 (.yaml / .json) from C# DTOs annotated with [GenerateTypes]. Optional Python (Pydantic v2 / dataclass) output. Compile-time only, zero reflection, no running app required.

What it does

[GenerateTypes(Targets = TypeTarget.TypeScript | TypeTarget.OpenApi, OutputDir = "generated")]
public class Order
{
    public int Id { get; set; }
    public string Customer { get; set; } = "";
    public List<OrderItem> Items { get; set; } = new();
    public OrderStatus Status { get; set; }
}

public class OrderItem { public int Qty { get; set; } public Product Product { get; set; } = new(); }
public class Product { public string Sku { get; set; } = ""; }
public enum OrderStatus { Pending, Shipped }

→ at dotnet build (or on save in IDE — see below):

  • generated/Order.ts, OrderItem.ts, Product.ts, OrderStatus.ts — each with cross-file import { X } from './X'; statements that compile directly with tsc.
  • generated/openapi.yaml — OpenAPI 3.0.3 schema with every class under components/schemas, correct $refs, and nullable / required / validation constraints pulled from ZibStack.NET.Validation attributes.

Nested types without their own [GenerateTypes] are auto-discovered by walking the property graph, so you only annotate root aggregates.

Highlights

  • Transitive type discovery — nested objects, enums, collections, dictionaries all pulled in automatically.
  • C# inheritance preserved — emitted TS keeps the full extends chain; OpenAPI uses allOf.
  • [TsType<T>] / [TsType("expr", ImportFrom = "./…")] — override the TS type expression. Generic form auto-computes the relative import path.
  • [JsonStringEnumConverter] aware — string-valued TS enums + Python (str, Enum) when the enum carries the converter attribute.
  • [JsonExtensionData] → schema-level additionalProperties (OpenAPI) / index signature [key: string]: unknown (TypeScript).
  • [CrudApi] integration with ZibStack.NET.Dto — emits OpenAPI paths (GET list, GET by id, POST, PATCH, DELETE) with the right request/response schema refs, pagination wrappers, and query-string bindings for ZibStack.NET.Query when referenced.
  • Fluent project-wide config via ITypeGenConfigurator — global output dir, file layout (FilePerClass / SingleFile), naming styles, per-type overrides, property-level overrides.
  • Live regen on save — generator writes .ts / .yaml files directly from the Roslyn pipeline, so your frontend dev server picks changes up without a full dotnet build. Falls back to an MSBuild post-compile target in sandboxed analyzer hosts.
  • Stale file sweep — renames drop old files; the sweep is banner-gated so hand-written files in the same directory are safe.

Install

dotnet add package ZibStack.NET.TypeGen

That's it — ZibStack.NET.TypeGen.Abstractions (attributes + settings types) is pulled in transitively. The analyzer self-registers; everything else is in the attribute / configurator surface.

Docs

Full reference — type mapping, diagnostic list (TG0001-TG0021), fluent DSL, [CrudApi] integration, Python emitter, file layout options — lives at mistykuu.github.io/ZibStack.NET/packages/typegen.

License

MIT. See the repository root LICENSE file.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.2.7 109 6/13/2026
3.2.6 113 6/11/2026
3.2.5 108 6/10/2026
3.2.4 103 4/21/2026
3.2.3 99 4/21/2026
3.2.2 87 4/21/2026
3.2.1 103 4/21/2026
3.2.0 111 4/21/2026
3.1.5 99 4/20/2026
3.1.4 102 4/20/2026
3.1.3 108 4/20/2026
3.1.2 109 4/20/2026
3.1.1 104 4/20/2026
3.1.0 99 4/20/2026
3.0.6 106 4/20/2026
3.0.5 105 4/20/2026
3.0.4 100 4/20/2026
3.0.3 106 4/20/2026
3.0.2 101 4/20/2026
3.0.1 111 4/20/2026
Loading failed