public void Serialize(JsonObjectValidator objectValidator, IFormatter f, JsonSchemaValidationContext c, T o) { // Validates fields var validationResults = new Dictionary <string, ValidationResult>(); GenericValidator <T> .ValidationResults( objectValidator.Required, objectValidator.Properties, c, o, validationResults); // Serialize fields f.BeginMap(objectValidator.Properties.Count()); foreach (var property in objectValidator.Properties) { var fieldName = property.Key; var schema = property.Value; string[] deps = null; objectValidator.Dependencies.TryGetValue(fieldName, out deps); FieldSerializer fs; if (m_serializers.TryGetValue(fieldName, out fs)) { fs(schema, c, f, o, validationResults, deps); } } f.EndMap(); }