private static void Enrich(IField field, ContentFieldData fieldData, string partitionKey) { var defaultValue = DefaultValueFactory.CreateDefaultValue(field, SystemClock.Instance.GetCurrentInstant(), partitionKey); if (field.RawProperties.IsRequired || defaultValue == null || defaultValue.Type == JsonValueType.Null) { return; } if (!fieldData.TryGetValue(partitionKey, out _)) { fieldData.AddLocalized(partitionKey, defaultValue); } }
private static void Enrich(IField field, ContentFieldData fieldData, string partitionKey) { Guard.NotNull(fieldData, nameof(fieldData)); var defaultValue = DefaultValueFactory.CreateDefaultValue(field, SystemClock.Instance.GetCurrentInstant()); if (field.RawProperties.IsRequired || defaultValue == null || defaultValue.Type == JsonValueType.Null) { return; } if (!fieldData.TryGetValue(partitionKey, out var value) || ShouldApplyDefaultValue(field, value)) { fieldData.AddJsonValue(partitionKey, defaultValue); } }