2

Does System.Text.Json expose any methods to validate Json schemas? I have looked at their documentation but it appears that this is still tbd.

dbc
  • 104,963
  • 20
  • 228
  • 340
Kashif
  • 31
  • 3
  • Not as of .NET 7, and nothing is currently scheduled. See [`[System.Text.Json]` Json Schemas Support #29887](https://github.com/dotnet/runtime/issues/29887), which is currently "Open" with priority "Wishlist" and milestone "Future". Some 3rd party tools are promoted there as alternatives. – dbc Jan 10 '23 at 05:29
  • I am trying to avoid Newtonsoft.Json - as it's not going to be viable in a CI environment where more than 10 hits for schema validation are highly likely. Other 3rd party tools are less desirable. Would prefer to stay with System.Text.Json – Kashif Jan 11 '23 at 20:59

1 Answers1

2

you can take a look to the current JSON Schema .NET implementations here:

https://json-schema.org/implementations.html#validator-dotnet

benjagm
  • 21
  • 3
  • 2
    On that list, only JsonSchema.Net supports System.Text.Json. – gregsdennis Jan 10 '23 at 07:31
  • 1
    I not had much luck with trying to validate json schemas using System.Text.Json. By JsonSchema.Net are you referring to json-everything? If that is the case, then could you refer to some documentation how to validate schemas using that package in C#? I posted this question the other day with some sample code - but have not had any luck/response yet. https://stackoverflow.com/questions/75035777/json-not-validating-against-json-schema-c-sharp-draft-6-openapi-3-0 – Kashif Jan 11 '23 at 20:57