add validation for namespace before creating fields
add nil guard for missing metadata