Adds allow_nil for media_type validation for backward compatibility