Since the cases where you are trimming to the last '/' is only in the case of "properties", it makes perfect sense to drop the property name.

Re: switch logic, clearly have have considered the options and landed on the current approach. Let's stick with it.