Yes, I think extracting the optionalKey handling into ConfigAPI is the most reasonable approach. Then the fields don't really need to know it exists.