RicoSuter / NJsonSchema

JSON Schema reader, generator and validator for .NET
http://NJsonSchema.org
MIT License
1.38k stars 532 forks source link

Extract annotations into own package #1641 follow up #1642

Closed trejjam closed 10 months ago

trejjam commented 10 months ago

Move JsonInheritanceAttribute into Annotations package

trejjam commented 10 months ago

If you do not find it useful, just close it

RicoSuter commented 10 months ago

The problem is that in your model you’d also need the converter in the base class. This would lead to a dep to STJ in annotations.. also newtonsoft would then need the same move into NJS.NewtonsoftJson.Annotations

RicoSuter commented 10 months ago

Btw with net7 you dont need these anymore https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/polymorphism?pivots=dotnet-7-0

trejjam commented 10 months ago

I know that I personally do not need them. I just saw an attribute when I was searching about JsonConvertor<>. And this is the result.

I had in my mind that NJS.NewtonsoftJson.Annotations and NJS.SystemTextJson.Annotations might appear in the future. I do not think I need them now, but I am willing to prepare PR, so they will exist in the stable 11 release.

trejjam commented 10 months ago

I did not know that NewtonsoftJson has its own JsonInheritanceAttribute in NJsonSchema.NewtonsoftJson.Converters. It makes this PR useless

RicoSuter commented 10 months ago

The plan is that the default packages will eventually be stj only and newtonsoft lives in additional packges for legacy