// ========================================================================== // Squidex Headless CMS // ========================================================================== // Copyright (c) Squidex UG (haftungsbeschraenkt) // All rights reserved. Licensed under the MIT license. // ========================================================================== using System.Collections.Generic; using System.Text; namespace Squidex.Domain.Apps.Core.ValidateContent { public static class ObjectPath { public static string ToPathString(this IEnumerable path) { var sb = new StringBuilder(); var index = 0; foreach (var property in path) { if (index == 0) { sb.Append(property); } else { if (property[0] != '[') { sb.Append('.'); } sb.Append(property); } index++; } return sb.ToString(); } } }