We can validate the provided value of a new property called version with a validate block and, for example, a regex expression, as shown in the following code:
Puppet::Type.newtype(:mynewtype) do ... newproperty(:version) do validate do |value| fail("Invalid version specified") unless value =~ /^(\d+\.)?(\d+\.)?(\*|\d+)$/ end end ... end