Understanding this feature is not coming with .NET Core v3, are there current plans to begin reviewing/development soon after?
Good job on initial work on new API :+1:
Any feedback is appreciated.
It is on our road-map for the future: https://github.com/dotnet/corefx/blob/master/src/System.Text.Json/roadmap/README.md#out-of-current-scope--future-considerations
Anything more concrete than future? Trying to decide on library usage
The JSON schema spec is not stable enough and iterating quite frequently for us to add support yet (and a feature like this would require a lot more design/thinking - draft-08 now). Hence, I think this has to remain as future for now (which is to say that it isn't planned for 5.0).
Reasonable. Sticking with JSON.NET for now then.
@ahsonkhan: _“The JSON schema spec is not stable enough and iterating quite frequently for us to add support yet … ( … draft-08 now). …”_
Would adding draft-07 support not still be a valid addition though, given a lot of the implementation could then be taken forward when draft-08 is stabilised, and at that point in time the majority of existing software that validates against a JSON schema will be doing so using draft-07 and older? I'm not contesting the decision by the way, just curious about how the roadmap items get prioritised 🙂
@SamuelEnglard : _“Reasonable. Sticking with JSON.NET for now then.”_
It's worth noting that Json.NET's schema validation functionality has been pulled-out of the main package and is now its own thing, which is no longer free. I found this out when I was recently working on some new validation stuff, and was a dealbreaker for what I was developing.
Fortunately, I stumbled across an alternative free library, called _Manatee.Json_, which provides much the same JSON schema validation functionality as Json.NET Schema; I'd highly recommend it based on my recent experiences with it, if free is something that's important to you or your project(s):
It's worth noting that Json.NET's schema validation functionality has been pulled-out of the main package and is now its own thing, which is no longer free. I found this out when I was recently working on some new validation stuff, and was a dealbreaker for what I was developing.
Fortunately, I stumbled across an alternative free library, called Manatee.Json, which provides much the same JSON schema validation functionality as Json.NET Schema; I'd highly recommend it based on my recent experiences with it, if free is something that's important to you or your project(s):
Currently in a debate over if we can or cannot use Newtonsoft.Json.Schema and funny enough Manatee.Json was the suggested alternative!
Another alternative I found was JSchema. I liked that it does integrate nicely with JSON.NET but the API's lack of Stream support was a deal breaker for me.
@SamuelEnglard, ah no way, haha! Didn't know there was a current Microsoft solution for JSON schema stuff either. For me, the dealbreaker would be that it's only for draft-04 and nothing newer.
@andidavies92 as a quick update: end of the debate is we're using Newtonsoft.Json for creating the JSON and Manatee.Json for validation (not the best but time isn't with me)
Nice, I did the same, but mostly because .NET Core 3 wasn't in GA when I wanted to start work on it. Plan to migrate the Json.NET stuff to .NET Core when I get the chance, as I now have unit and integration tests to check for regressions and performance tests to see whether I actually get much boosted performance.
Look at Cogito.Json.Schema.Validation. it's a open source valuator. It's 190 times faster than Newtonsofts. I'm the author. I've got it in my head to fork a second library for System.Text.Json.
It would be pretty easy. If anybody wanted to help.
Update: I began porting Cogito.Json.Schema.Validation
to run on top of System.Text.Json
. I have most of the basics working. Need to implement a few things like $ref support, and some per-schema version nuances.
But it's a good start, and validates quite a bit. For those of you who want to validate System.Text.Json streams, Cogito.Text.Json.Schema should get you pretty far. Pull requests for missing stuff accepted, of course. There's an alpha package on NuGet.
This validator is quite different from Newtonsofts. And quite faster. It actually compiles an Expression
tree that implements the validation for a given Schema instance. And then you can execute the expression tree against a JsonElement
to return pass or fail.
@andidavies92 @SamuelEnglard
@wasabii looks interesting, though time says we're sticking with what we have for now.
@ahsonkhan
It is on our road-map for the future: https://github.com/dotnet/corefx/blob/master/src/System.Text.Json/roadmap/README.md#out-of-current-scope--future-considerations
Unfortunately that link is dead. Is there another link where people can track this? Or will any updates be posted here and subscribing to this issue should be good?
@Felk new link: https://github.com/dotnet/runtime/tree/master/src/libraries/System.Text.Json/roadmap#out-of-current-scope--future-considerations
This is my only reason for still using Json.NET. Would be a much appreciated feature indeed!
I just released RC2 for JsonSchema.Net (on Nuget now). It has full support for drafts 6 through 2019-09 and is built 100% on System.Text.Json
. (~Working on streaming support.~ Stream supported as of 1.0.0.)
@andidavies92, thanks for the shout-out on Manatee.Json, but this one is so much faster.... and still free.
Most helpful comment
I just released RC2 for JsonSchema.Net (on Nuget now). It has full support for drafts 6 through 2019-09 and is built 100% on
System.Text.Json
. (~Working on streaming support.~ Stream supported as of 1.0.0.)@andidavies92, thanks for the shout-out on Manatee.Json, but this one is so much faster.... and still free.