json-schema-org / json-schema-spec

The JSON Schema specification
http://json-schema.org/
Other
3.82k stars 266 forks source link

If-Then-Else supported? #1468

Closed alc-aardvark closed 1 year ago

alc-aardvark commented 1 year ago

I have loaded a schema from json-scema.org (here) that contains "anyOf" with 3 If-Then conditions. When I look inside the c# instance for AnyOf, then there are 3 rows but each row is just full of Null values. This leads me to think that If-Then-Else is not yet supported.

I also looked at the test json files and I do not see any with If-Then-Else conditions.

gregsdennis commented 1 year ago

Which implementation are you using? You mention c#, but we have several for .net (including mine, JsonSchema.Net, for which they are definitely supported).

alc-aardvark commented 1 year ago

I am using Microsoft.Json.Schema

gregsdennis commented 1 year ago

From their project repo:

A set of .NET components for working with JSON Schema Draft 4

That's pretty old. I'd recommend you choose a different implementation. All of the ones listed on the implementations page (link above) support at least draft 7, which defines if/then/else.

alc-aardvark commented 1 year ago

Thanks all. I am now using JsonSchema.Net .