Corvus.Text.Json.SourceGenerator
5.8.8
dotnet add package Corvus.Text.Json.SourceGenerator --version 5.8.8
NuGet\Install-Package Corvus.Text.Json.SourceGenerator -Version 5.8.8
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="Corvus.Text.Json.SourceGenerator" Version="5.8.8"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Corvus.Text.Json.SourceGenerator" Version="5.8.8" />
<PackageReference Include="Corvus.Text.Json.SourceGenerator"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
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 Corvus.Text.Json.SourceGenerator --version 5.8.8
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Corvus.Text.Json.SourceGenerator, 5.8.8"
#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 Corvus.Text.Json.SourceGenerator@5.8.8
#: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=Corvus.Text.Json.SourceGenerator&version=5.8.8
#tool nuget:?package=Corvus.Text.Json.SourceGenerator&version=5.8.8
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Corvus.Text.Json.SourceGenerator
Roslyn incremental source generator that produces strongly-typed C# from JSON Schema at build time.
Supports JSON Schema draft 4, 6, 7, 2019-09, and 2020-12. Generated types are lightweight readonly struct wrappers over pooled JSON data with type-safe property accessors, validation, serialization, and implicit conversions.
Installation
<PackageReference Include="Corvus.Text.Json.SourceGenerator" Version="5.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
You also need the runtime library:
dotnet add package Corvus.Text.Json
Usage
- Add a JSON Schema file to your project (e.g.
Schemas/person.json) - Annotate a partial struct:
using Corvus.Text.Json;
[JsonSchemaTypeGenerator("Schemas/person.json")]
public readonly partial struct Person;
- Use the generated type:
using var doc = ParsedJsonDocument<Person>.Parse(
"""{"name":"Alice","age":30}""");
Person person = doc.RootElement;
string name = (string)person.Name;
int age = person.Age;
bool valid = person.EvaluateSchema();
What Gets Generated
- Property accessors for each schema property
EvaluateSchema()for full JSON Schema validationMatch()methods foroneOf/anyOfdiscriminated unionsFrom()conversions forallOfcomposition- Implicit conversions to/from .NET primitives
Buildertype for creating instances with the builder patternMutabletype for in-place modification
Related Packages
| Package | Purpose |
|---|---|
| Corvus.Text.Json | Core runtime library (required) |
| Corvus.Json.CodeGenerator | CLI alternative for ahead-of-time generation |
Documentation
See the Source Generator guide.
License
Apache 2.0 — see LICENSE.
There are no supported framework assets in this package.
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- No dependencies.
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 |
|---|---|---|
| 5.8.8 | 69 | 11/6/2026 |
| 5.8.7 | 62 | 11/5/2026 |
| 5.8.5 | 453 | 11/4/2026 |
| 5.8.4 | 100 | 11/3/2026 |
| 5.8.0 | 737 | 10/31/2026 |
| 5.7.9 | 4,133 | 10/17/2026 |
| 5.7.8 | 107 | 10/17/2026 |
| 5.7.7 | 849 | 10/14/2026 |
| 5.7.6 | 858 | 10/7/2026 |
| 5.7.5 | 5,994 | 10/1/2026 |
| 5.7.4 | 202 | 10/1/2026 |
| 5.7.3 | 260 | 9/29/2026 |
| 5.6.1 | 1,832 | 9/13/2026 |
| 5.5.5 | 308 | 9/9/2026 |
| 5.5.4 | 2,972 | 9/1/2026 |
| 5.5.3 | 134 | 9/1/2026 |
| 5.5.2 | 3,982 | 8/30/2026 |
| 5.5.1 | 158 | 8/30/2026 |
| 5.5.0 | 422 | 8/27/2026 |
Loading failed