Add function for retrieving an optional injection
Add :function key to the metadata passed to namespace middleware