cvent / deprecated-json-schema-2-poco

Converts JSON schemas to C# POCOs
18 stars 27 forks source link

The "required" property is not supported ? #24

Open StefH opened 9 years ago

StefH commented 9 years ago

When using this Basic example schema on : http://json-schema.org/examples.html

{
    "title": "Example Schema",
    "type": "object",
    "properties": {
        "firstName": {
            "type": "string"
        },
        "lastName": {
            "type": "string"
        },
        "age": {
            "description": "Age in years",
            "type": "integer",
            "minimum": 0
        }
    },
    "required": ["firstName", "lastName"]
}

The software generates this error:

2015-06-16 21:19:15.1404 [Error] Could not parse the schema: file:///c:/temp/jschema.json
Make sure your schema is compatible.Examine the stack trace below.
2015-06-16 21:19:15.1603 [Fatal] System.ArgumentException: Can not convert Array to Boolean.
   at Newtonsoft.Json.Linq.JToken.op_Explicit(JToken value)
   at Newtonsoft.Json.Schema.JsonSchemaBuilder.ProcessSchemaProperties(JObject schemaObject)
   at Newtonsoft.Json.Schema.JsonSchemaBuilder.BuildSchema(JToken token)
   at Newtonsoft.Json.Schema.JsonSchemaBuilder.Read(JsonReader reader)
   at Newtonsoft.Json.Schema.JsonSchema.Read(JsonReader reader, JsonSchemaResolver resolver)
   at Newtonsoft.Json.Schema.JsonSchema.Parse(String json, JsonSchemaResolver resolver)
   at Cvent.SchemaToPoco.Core.JsonSchemaResolver.ResolveSchemaHelper(Uri curr, Uri parent, String data) in C:\Users\Stef\Documents\Github\forks\json-schema-2-poco
StefH commented 9 years ago

Probably related to https://github.com/JamesNK/Newtonsoft.Json/issues/115