private void AppendPath()

in src/Microsoft.OpenApi.OData.Reader/Edm/ODataPathProvider.cs [124:170]


        private void AppendPath(ODataPath path)
        {
            Debug.Assert(path != null);

            ODataPathKind kind = path.Kind;
            switch(kind)
            {
                case ODataPathKind.ComplexProperty:
                case ODataPathKind.TypeCast:
                case ODataPathKind.DollarCount:
                case ODataPathKind.Entity:
                case ODataPathKind.EntitySet:
                case ODataPathKind.Singleton:
                case ODataPathKind.MediaEntity:
                    if (path.FirstSegment is ODataNavigationSourceSegment navigationSourceSegment)
                    {
                        if(!_allNavigationSourcePaths.TryGetValue(navigationSourceSegment.EntityType, out IList<ODataPath> nsList))
                        {
                            nsList = new List<ODataPath>();
                            _allNavigationSourcePaths[navigationSourceSegment.EntityType] = nsList;
                        }
                        nsList.Add(path);
                    }
                    break;

                case ODataPathKind.NavigationProperty:
                case ODataPathKind.Ref:
                    ODataNavigationPropertySegment navigationPropertySegment = path.OfType<ODataNavigationPropertySegment>().Last();

                    if (!_allNavigationPropertyPaths.TryGetValue(navigationPropertySegment.EntityType, out IList<ODataPath> npList))
                    {
                        npList = new List<ODataPath>();
                        _allNavigationPropertyPaths[navigationPropertySegment.EntityType] = npList;
                    }

                    npList.Add(path);
                    break;

                case ODataPathKind.Operation:
                case ODataPathKind.OperationImport:
                    _allOperationPaths.Add(path);
                    break;

                default:
                    return;
            }
        }