private static void Build()

in src/JetBrains.Space.Generator/CodeGeneration/PathToResourceMapper.cs [19:48]


    private static void Build(
        Dictionary<string, List<ApiResource>> targetMap, 
        ApiResource apiResource, 
        string currentPath, 
        int currentDepth)
    {
        currentPath = (currentPath.Length > 0 ? currentPath + "/" : currentPath) + apiResource.DisplaySingular;

        // Self
        if (currentDepth >= MinDepth)
        {
            if (!targetMap.TryGetValue(currentPath, out var list))
            {
                list = new List<ApiResource>();
                targetMap[currentPath] = list;
            }

            list.Add(apiResource);
        }

        // Nested resources
        var newDepth = currentDepth + 1;
        if (newDepth < MaxDepth)
        {
            foreach (var apiNestedResource in apiResource.NestedResources)
            {
                Build(targetMap, apiNestedResource, currentPath, newDepth);
            }
        }
    }