Corvus.Text.Json.SourceGenerator
5.2.5
dotnet add package Corvus.Text.Json.SourceGenerator --version 5.2.5
NuGet\Install-Package Corvus.Text.Json.SourceGenerator -Version 5.2.5
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.2.5"> <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.2.5" />
<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.2.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Corvus.Text.Json.SourceGenerator, 5.2.5"
#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.2.5
#: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.2.5
#tool nuget:?package=Corvus.Text.Json.SourceGenerator&version=5.2.5
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.2.5 | 144 | 7/7/2026 |
| 5.2.4 | 122 | 7/6/2026 |
| 5.2.3 | 367 | 6/27/2026 |
| 5.2.2 | 99 | 6/27/2026 |
| 5.2.1 | 159 | 6/25/2026 |
| 5.2.0 | 104 | 6/23/2026 |
| 5.1.19 | 108 | 6/19/2026 |
| 5.1.18 | 529 | 6/17/2026 |
| 5.1.17 | 105 | 6/17/2026 |
| 5.1.16 | 163 | 6/10/2026 |
| 5.1.14 | 94 | 6/9/2026 |
| 5.1.13 | 94 | 6/9/2026 |
| 5.1.12 | 93 | 6/8/2026 |
| 5.1.11 | 96 | 6/7/2026 |
| 5.1.10 | 99 | 6/7/2026 |
| 5.1.9 | 115 | 6/6/2026 |
| 5.1.8 | 95 | 6/5/2026 |
| 5.1.7 | 97 | 6/5/2026 |
| 5.1.6 | 101 | 6/4/2026 |
| 5.1.5 | 101 | 6/2/2026 |
Loading failed