versions: pass string to factory

Closes #20951.