Jakar.Json.OpenApi 10.3.0

dotnet add package Jakar.Json.OpenApi --version 10.3.0
                    
NuGet\Install-Package Jakar.Json.OpenApi -Version 10.3.0
                    
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="Jakar.Json.OpenApi" Version="10.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Jakar.Json.OpenApi" Version="10.3.0" />
                    
Directory.Packages.props
<PackageReference Include="Jakar.Json.OpenApi" />
                    
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 Jakar.Json.OpenApi --version 10.3.0
                    
#r "nuget: Jakar.Json.OpenApi, 10.3.0"
                    
#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 Jakar.Json.OpenApi@10.3.0
                    
#: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=Jakar.Json.OpenApi&version=10.3.0
                    
Install as a Cake Addin
#tool nuget:?package=Jakar.Json.OpenApi&version=10.3.0
                    
Install as a Cake Tool

Jakar.Json.OpenApi

OpenAPI documents that describe [JsonModel] types with the property names Jakar.Json actually writes.

Both OpenAPI generators name properties from System.Text.Json's options, usually camelCase. A model's own naming can differ: a [JsonModel(Naming = ...)] policy, [assembly: JsonDefaults], [JsonMember(Name = ...)] / [JsonKey], [JsonMember(Ignore = true)] / [JsonSkip], ReadOnlyMembers = Ignore, or included non-public members ([JsonOptIn]). Without this package, the document describes names your API doesn't use.

// Microsoft.AspNetCore.OpenApi
builder.Services.AddOpenApi(o => o.AddJakarJsonSchemas());

// Swashbuckle
builder.Services.AddSwaggerGen();
builder.Services.AddJakarJsonSwagger();

Every other type is described as before.

Keep the attributes

Jakar.Json's attributes are compiled away by default: [JsonModel], [JsonMember] and [JsonDefaults] are [Conditional("JAKAR_JSON_KEEP_ATTRIBUTES")], because the generator reads them at compile time. Schemas need them at run time. This package defines JAKAR_JSON_KEEP_ATTRIBUTES in every project that references it, through buildTransitive.

Models declared in another assembly (a shared contracts project, for example) need it there too:

<PropertyGroup>
  <DefineConstants>$(DefineConstants);JAKAR_JSON_KEEP_ATTRIBUTES</DefineConstants>
</PropertyGroup>

A model compiled without the attributes keeps System.Text.Json's description.

What's resolved

The rules are the ones the generator applies:

  • Members: public properties and fields, plus members marked [JsonMember], [JsonKey] or [JsonOptIn].
    • Excluded: [JsonMember(Ignore = true)], [JsonSkip] (unless [JsonMember(Ignore = false)] overrides it), extension data ([JsonOverflow]), and, with ReadOnlyMembers = Ignore on the model, the assembly or the member, get-only members that no constructor parameter binds.
    • Base members come first. An override appears once.
  • Names, by precedence:
    1. [JsonMember(Name)], then [JsonKey].
    2. The naming policy, from the first of these that sets one: [JsonModel(Naming)], then [assembly: JsonDefaults]. With none, names are as declared.
  • Policies: camelCase, PascalCase, snake_case and kebab-case, lower and upper, computed exactly as the generator does.

JsonModelContract.GetMembers(type) exposes the resolved members if you need them elsewhere.

The package uses reflection, as both OpenAPI generators do, so it isn't marked AOT-compatible. Document generation usually runs at build or design time.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in 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
10.3.0 51 10/24/2026
10.2.0 71 10/22/2026
10.1.0 86 10/18/2026

10.3.0 (breaking): schemas follow Jakar.Json 11's member rules: [JsonKey], [JsonSkip], [JsonOptIn], [JsonOverflow], [JsonCreator] and ReadOnlyMembers; System.Text.Json attributes and contexts no longer affect [JsonModel] schemas. Built against Jakar.Json 10.3.0. 10.2.0: built against Jakar.Json 10.2.0, whose writers take a ref TWriter; 10.1.0 calls the removed IBufferWriter overloads and throws MissingMethodException with Jakar.Json 10.2.0. 10.1.0: initial release.