# Any way to reflect a PartialKeyPath from self?

**URL:** <https://forums.swift.org/t/any-way-to-reflect-a-partialkeypath-from-self/14205>\
**Category:** Using Swift\
**Tags:** keypath\
**Created:** [July 3, 2018, 3:33pm UTC](https://forums.swift.org/t/any-way-to-reflect-a-partialkeypath-from-self/14205 "2018-07-03T15:33:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Troy\_Harvey](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/troy_harvey/32/13926_2.png) [@Troy\_Harvey](https://forums.swift.org/u/Troy_Harvey)\
**Post date:** [July 3, 2018, 3:33pm UTC](https://forums.swift.org/t/any-way-to-reflect-a-partialkeypath-from-self/14205/1 "2018-07-03T15:33:04Z")

</div>

I've been rebuilding some code infrastructure with keyPaths.

I have a couple of issues. We have ORM code that does graph management, search, and navigation. For example it handles the navigation and graph walking from object A to object Z without dealing with what is in-between. For example: GetObjectPath(root: objectA, child:objectZ).

I'd like to use this in conjunction with our new keyPath based APIs, where the object walker returns a keyPath to self and appends it to the last, such that at the end of the search I have a full keyPath from /objectA...objectZ.

While chaining keyPaths seems straightforward, getting them does not. I was hoping there was a way to get the keyPath to self, or reflect a keyPath, or convert to a keypath from the walked string names. Is there anyway to solve this without pre-generating a bunch of manual PartialKeyPaths in a dictionary before compile time? (beside being more fragile to data model changes, it would be a lot of code!)

Troy
