Newtonsoft.Json.Schema.JsonSchemaModel.Create C# (CSharp) Method

Create() public static method

public static Create ( IList schemata ) : JsonSchemaModel
schemata IList
return JsonSchemaModel
    public static JsonSchemaModel Create(IList<JsonSchema> schemata)
    {
      JsonSchemaModel model = new JsonSchemaModel();

      foreach (JsonSchema schema in schemata)
      {
        Combine(model, schema);
      }

      return model;
    }

Usage Example

    private JsonSchemaModel BuildNodeModel(JsonSchemaNode node)
    {
      JsonSchemaModel model;
      if (_nodeModels.TryGetValue(node, out model))
        return model;
      
      model = JsonSchemaModel.Create(node.Schemas);
      _nodeModels[node] = model;

      foreach (KeyValuePair<string, JsonSchemaNode> property in node.Properties)
      {
        if (model.Properties == null)
          model.Properties = new Dictionary<string, JsonSchemaModel>();

        model.Properties[property.Key] = BuildNodeModel(property.Value);
      }
      foreach (KeyValuePair<string, JsonSchemaNode> property in node.PatternProperties)
      {
        if (model.PatternProperties == null)
          model.PatternProperties = new Dictionary<string, JsonSchemaModel>();

        model.PatternProperties[property.Key] = BuildNodeModel(property.Value);
      }
      for (int i = 0; i < node.Items.Count; i++)
      {
        if (model.Items == null)
          model.Items = new List<JsonSchemaModel>();

        model.Items.Add(BuildNodeModel(node.Items[i]));
      }
      if (node.AdditionalProperties != null)
        model.AdditionalProperties = BuildNodeModel(node.AdditionalProperties);

      return model;
    }
All Usage Examples Of Newtonsoft.Json.Schema.JsonSchemaModel::Create
JsonSchemaModel