NJsonSchema
NJsonSchema copied to clipboard
JSON Schema reader, generator and validator for .NET
[Fluid.Core](https://github.com/sebastienros/fluid/blob/0de3b07a5eeba650d69f19849fa62255fa1b4ca9/Fluid/FluidParser.cs#L522) has a breaking change between 2.9.0 and 2.11.1 because Parlot, the library Fluid.Core depends on, has a [breaking change](https://github.com/sebastienros/parlot/pull/103/files#diff-075f3dea19a91e058660dfe2a77be11a72a2d4fbbcf24441ec6a5f9a46869540L9) which propagated to Fluid.Core between 2.9.0 and 2.11.1. This change...
* latest dependencies * target `net472` consistently for test projects * remove unnecessary `dotnet-xunit` reference * remove unused `using`s in test projects * remove problematic constructors for NBench based tests...
Fixes #1728 I do not know how to test it. The generated code in the liquid file is not the same as the 'real' ```NJsonSchema.Converters.JsonInheritanceConverter```, which has tests. Also the...
See example code & payload ``` [JsonInheritanceConverter(typeof(Event), "$type")] [JsonInheritanceAttribute("Arrival", typeof(Arrival))] [JsonInheritanceAttribute("Departure", typeof(Departure))] public partial class Event { } public partial class Data { [JsonPropertyName("events")] public ICollection Events { get; set;...
I'd like a sync variant of `JsonSchema.FromJsonAsync`, as there are scenarios in which an async call is not possible. ```cs var schema = JsonSchema.FromJson(myJsonString); ``` Currently, the only work around...
Fixes #1573 and #1703 In JSON references, the character "~" and "/" should be escaped as "~0" and "~1", respectively [(RFC 6901)](https://www.rfc-editor.org/rfc/rfc6901#section-3). The current version of JsonReferenceResolver would fail on...
System.Text.Json supports non-string discriminators using JsonDerivedType. This PR stringifies the discriminator value. Fixes #1723 From https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/polymorphism?pivots=dotnet-8-0#mix-and-match-type-discriminator-formats ``` [JsonDerivedType(typeof(ThreeDimensionalPoint), typeDiscriminator: 3)] [JsonDerivedType(typeof(FourDimensionalPoint), typeDiscriminator: "4d")] public class BasePoint { public int X...
STJ's [JsonDerivedTypeAttribute.TypeDiscriminator](https://learn.microsoft.com/en-us/dotnet/api/system.text.json.serialization.jsonderivedtypeattribute.typediscriminator?view=net-8.0#system-text-json-serialization-jsonderivedtypeattribute-typediscriminator) is of type `object?`. It looks like NJsonSchema always expects a STJ discriminator of type string based on the return type of [SystemTextJsonInheritanceWrapper.GetDiscriminatorValue](https://github.com/RicoSuter/NJsonSchema/blob/9bf8f695b373410e8b51e1363270c08dda7b8127/src/NJsonSchema/Generation/JsonSchemaGenerator.cs#L1144). Is there a reason for...
When using CSharpGenerator for [OpenAPI v2.0 Json Schema](https://github.com/OAI/OpenAPI-Specification/blob/master/schemas/v2.0/schema.json), the generated code contains the following error: 'MinLength': cannot derive from sealed type 'int' ConsoleApplication1 I think this is related to 'MinLength'...
Hi I would like to use `NJsonSchema` to generate the following schema. However, no matter what I tried, I was unable to generate the following schema. ```json { "$schema": "http://json-schema.org/draft-07/schema#",...