百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
C

Corvus.JsonSchema

> 编程语言
开源

支持 Json Schema 验证和实体生成

196 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

支持 Json Schema 验证和实体生成

Corvus.Text.Json

High-performance, source-generated, strongly-typed C# models from JSON Schema — with pooled-memory parsing, full draft 4 through 2020-12 validation, and 136B per-document allocation.

Features

  • Source Generation — Generate strongly-typed C# from JSON Schema at build time with the Roslyn incremental source generator, or ahead of time with the corvusjson CLI tool.
  • OpenAPI — Generate strongly-typed OpenAPI 2.0, 3.0, 3.1, and 3.2 HTTP clients and ASP.NET Core server stubs with typed parameters, request/response validation, streaming, and result matching.
  • AsyncAPI — Generate strongly-typed AsyncAPI 2.6 and 3.0 producers, consumers, handlers, and request/reply flows with broker transport packages for NATS, Kafka, AMQP, MQTT, WebSocket, and Azure Service Bus.
  • Schema Validation — Full JSON Schema draft 4, 6, 7, 2019-09, and 2020-12 validation. Over 10× faster than other .NET JSON Schema validators.
  • Pooled Memory — ParsedJsonDocument uses ArrayPool for minimal GC impact. Just 136 bytes per-document allocation.
  • Mutable Documents — JsonDocumentBuilder and JsonWorkspace provide a builder pattern for creating and modifying JSON with pooled workspace memory.
  • Extended Types — BigNumber for arbitrary-precision decimals, BigInteger for large integers, plus NodaTime integration for date, date-time, time, and duration formats.
  • Pattern Matching — Type-safe Match() for oneOf/anyOf discriminated unions with exhaustive dispatch.
  • JSONata — Full JSONata query and transformation language with 100% test-suite conformance. Interpreted and code-generated evaluation modes.
  • JMESPath — Full JMESPath query language with 100% conformance against the official test suite. Interpreted and code-generated evaluation modes.
  • JsonLogic — Complete JsonLogic rule engine for evaluating business rules against JSON data with interpreted and code-generated modes.
  • JSONPath — Full JSONPath (RFC 9535) query language with 100% conformance against the official compliance test suite. Interpreted and code-generated evaluation modes.
  • JSON Pointer — RFC 6901 JSON Pointer for navigating and resolving paths within JSON documents.
  • JSON Patch, Merge Patch & Diff — RFC 6902 JSON Patch, RFC 7396 Merge Patch, and diff with zero-allocation operations on JsonElement.
  • JSON Canonicalization — RFC 8785 JSON Canonicalization Scheme (JCS) for deterministic serialization. Zero heap allocation.
  • YAML — High-performance YAML 1.2 to JSON converter with 100% yaml-test-suite conformance. Zero-allocation ref struct tokenizer.
  • TOON — Bidirectional TOON (Token-Oriented Object Notation) conversion for compact JSON-shaped LLM prompts, with Corvus and System.Text.Json packages.

Quick Start

…

NuGet Packages

Most applications need Corvus.Text.Json plus either the source generator or the corvusjson CLI. Add the feature-specific runtime packages you use.

Area Package Description
Core runtime Corvus.Text.Json Core V5 runtime library. Required by all V5 generated types.
JSON Schema generation Corvus.Text.Json.SourceGenerator Roslyn incremental source generator for JSON Schema model generation at build time.
JSON Schema generation Corvus.Text.Json.CodeGeneration Shared JSON Schema code-generation engine for tools and advanced extension scenarios.
JSON Schema generation Corvus.Json.Cli CLI tool (corvusjson) for ahead-of-time JSON Schema, OpenAPI, AsyncAPI, and query-language code generation.
JSON Schema generation Corvus.Json.CodeGenerator Immutable-model CLI tool (generatejsonschematypes). Delegates to the same engines; defaults to V4.
Dynamic validation Corvus.Text.Json.Validator Load and validate JSON against JSON Schema at runtime with the runtime evaluator: no code generation, millisecond cold start.
Compatibility Corvus.Text.Json.Compatibility Bridge helpers for interop with V4 Corvus.Json.ExtendedTypes and System.Text.Json during migration.
Migration Corvus.Text.Json.Migration.Analyzers Roslyn analyzers and code fixes for migrating V4 Corvus.Json code to V5 Corvus.Text.Json.
OpenAPI Corvus.Text.Json.OpenApi Runtime abstractions for generated OpenAPI clients and ASP.NET Core server stubs.
OpenAPI Corvus.Text.Json.OpenApi.HttpTransport HttpClient transport for generated OpenAPI clients.
OpenAPI Corvus.Text.Json.OpenApi.CodeGeneration Code-generation engine for OpenAPI and related API-generation tooling.
OpenAPI Corvus.Text.Json.OpenApi20 Strongly-typed V5 model types for OpenAPI 2.0 (Swagger) documents.
OpenAPI Corvus.Text.Json.OpenApi30 Strongly-typed V5 model types for OpenAPI 3.0 documents.
OpenAPI Corvus.Text.Json.OpenApi31 Strongly-typed V5 model types for OpenAPI 3.1 documents.
OpenAPI Corvus.Text.Json.OpenApi32 Strongly-typed V5 model types for OpenAPI 3.2 documents.
AsyncAPI Corvus.Text.Json.AsyncApi Runtime support for generated AsyncAPI producers, consumers, handlers, and request/reply flows.
AsyncAPI Corvus.Text.Json.AsyncApi.CodeGeneration Code-generation engine for AsyncAPI producer/consumer generation.
AsyncAPI Corvus.Text.Json.AsyncApi26 Strongly-typed V5 model types for AsyncAPI 2.6 documents.
AsyncAPI Corvus.Text.Json.AsyncApi30 Strongly-typed V5 model types for AsyncAPI 3.0 documents.
AsyncAPI transports Corvus.Text.Json.AsyncApi.Nats NATS transport for generated AsyncAPI applications.
AsyncAPI transports Corvus.Text.Json.AsyncApi.Kafka Kafka transport for generated AsyncAPI applications.
AsyncAPI transports Corvus.Text.Json.AsyncApi.Amqp AMQP 0-9-1/RabbitMQ transport for generated AsyncAPI applications.
AsyncAPI transports Corvus.Text.Json.AsyncApi.Mqtt MQTT 3.1.1/5.0 transport for generated AsyncAPI applications.
AsyncAPI transports Corvus.Text.Json.AsyncApi.WebSocket WebSocket transport for generated AsyncAPI applications.
AsyncAPI transports Corvus.Text.Json.AsyncApi.AzureServiceBus Azure Service Bus transport for generated AsyncAPI applications.
AsyncAPI support Corvus.Text.Json.AsyncApi.Testing In-memory transport for testing generated AsyncAPI producers and consumers.
AsyncAPI support Corvus.Text.Json.AsyncApi.HealthChecks ASP.NET Core health checks for AsyncAPI transports.
AsyncAPI support Corvus.Text.Json.AsyncApi.Polly Polly-based resilience middleware for AsyncAPI handlers/transports.
JSONata Corvus.Text.Json.Jsonata JSONata query and transformation evaluator.
JSONata Corvus.Text.Json.Jsonata.SourceGenerator Roslyn source generator for compile-time JSONata code generation.
JSONata Corvus.Text.Json.Jsonata.CodeGeneration Code-generation engine for JSONata expressions.
JMESPath Corvus.Text.Json.JMESPath JMESPath query-language evaluator.
JMESPath Corvus.Text.Json.JMESPath.SourceGenerator Roslyn source generator for compile-time JMESPath code generation.
JMESPath Corvus.Text.Json.JMESPath.CodeGeneration Code-generation engine for JMESPath expressions.
JsonLogic Corvus.Text.Json.JsonLogic JsonLogic rule engine.
JsonLogic Corvus.Text.Json.JsonLogic.SourceGenerator Roslyn source generator for compile-time JsonLogic code generation.
JsonLogic Corvus.Text.Json.JsonLogic.CodeGeneration Code-generation engine for JsonLogic rules.
JSONPath Corvus.Text.Json.JsonPath JSONPath (RFC 9535) query-language evaluator.
JSONPath Corvus.Text.Json.JsonPath.SourceGenerator Roslyn source generator for compile-time JSONPath code generation.
JSONPath Corvus.Text.Json.JsonPath.CodeGeneration Code-generation engine for JSONPath expressions.
JSON Patch Corvus.Text.Json.Patch RFC 6902 JSON Patch, RFC 7396 Merge Patch, and diff.
YAML Corvus.Text.Json.Yaml YAML 1.2 to JSON converter with Corvus document model integration.
YAML Corvus.Yaml.SystemTextJson YAML 1.2 to JSON converter using only System.Text.Json.
TOON Corvus.Text.Json.Toon TOON to JSON and JSON to TOON converter with Corvus document model integration.
TOON Corvus.Toon.SystemTextJson TOON to JSON and JSON to TOON converter using only System.Text.Json.

Install

bash
# Core library
dotnet add package Corvus.Text.Json

# CLI code generator
dotnet tool install --global Corvus.Json.Cli

For the source generator, add as an analyzer reference:

xml

  all
  runtime; build; native; contentfiles; analyzers; buildtransitive

Target Frameworks

V5 engine (Corvus.Text.Json)

  • .NET 10.0, 9.0
  • .NET Standard 2.0, 2.1

V4 engine (Corvus.Json)

  • .NET 10.0, 9.0, 8.0
  • .NET Standard 2.0, 2.1

Note: .NET 8.0 is not supported on the V5 engine. The V4 engine will drop .NET 8.0 support in November 2026 when it reaches end-of-life.

Documentation

Full documentation is available at the Corvus.Text.Json documentation website.

To build and preview the docs locally:

powershell
cd docs/website
./preview.ps1

Then open http://localhost:5000.

Guides

  • Parsing & Reading JSON
  • Building & Mutating JSON
  • Source Generator
  • CLI Code Generation
  • Dynamic Schema Validation
  • OpenAPI Client and Server Generation
  • AsyncAPI Producer and Consumer Generation
  • JSONata Query & Transformation
  • JMESPath Query Language
  • JSONPath Query Language
  • JsonLogic Rule Engine
  • JSON Patch, Merge Patch & Diff
  • JSON Canonicalization (RFC 8785)
  • YAML to JSON Converter
  • TOON Converter
  • Migrating from V4

Building

bash
dotnet build Corvus.Text.Json.slnx

Testing

bash
dotnet test Corvus.Text.Json.slnx --filter "category!=failing&category!=outerloop"

Comparison with System.Text.Json

Feature System.Text.Json Corvus.Text.Json
Read-only parsing JsonDocument (pooled) ParsedJsonDocument (pooled, generic)
Mutable documents JsonNode (allocates per node) Builder pattern on pooled memory
Schema validation None built-in Draft 4/6/7/2019-09/2020-12 with full diagnostics
Code generation Serialization to/from POCOs Strongly-typed entities from JSON Schema
Date/Time DateTime, DateTimeOffset All .NET types plus NodaTime
Numeric precision decimal (28 digits) BigNumber (arbitrary precision), Int128, Half
String/URI handling .NET string allocation Zero-allocation UTF-8/UTF-16 access

JSONata

Corvus.Text.Json.Jsonata implements JSONata — an expressive, Turing-complete functional query and transformation language for JSON. It supports path navigation, predicate filtering, higher-order functions ($map, $filter, $reduce, $sort), object construction, string manipulation, arithmetic, regular expressions, and user-defined functions.

  • 100% conformance — passes all 1,665 tests in the official JSONata test suite
  • Up to 8× faster than Jsonata.Net.Native with 90–100% less memory allocation in the runtime evalua

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C#json-schemajson-schema-validator

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言