diff --git a/manifests/conffile.pp b/manifests/conffile.pp
index 6173916ddde48eed374f6be377305e2ef272067e..2c32464ddd087ff82331a083ff9d0d0ead26f9e6 100644
--- a/manifests/conffile.pp
+++ b/manifests/conffile.pp
@@ -44,22 +44,15 @@
 # }
 #
 define postfix::conffile (
-  $ensure   = 'present',
-  $source   = undef,
-  $content  = undef,
-  $path     = "/etc/postfix/${name}",
-  $mode     = '0644',
-  $options  = {},
+  Enum['present', 'absent', 'directory'] $ensure   = 'present',
+  Variant[Array[String], String, Undef]  $source   = undef,
+  Optional[String]                       $content  = undef,
+  Stdlib::Absolutepath                   $path     = "/etc/postfix/${name}",
+  String                                 $mode     = '0644',
+  Hash                                   $options  = {},
 ) {
   include ::postfix::params
 
-  validate_absolute_path($path)
-  if !is_string($source) and !is_array($source) { fail("value for source should be either String type or Array type got ${source}") }
-  if !is_string($content) { fail("value for content should be String type; got ${content}") }
-  validate_re($ensure, ['present', 'absent', 'directory'],
-    "\$ensure must be either 'present', 'absent' or 'directory', got '${ensure}'")
-  validate_hash($options)
-
   if (!defined(Class['postfix'])) {
     fail 'You must define class postfix before using postfix::config!'
   }
@@ -68,7 +61,6 @@ define postfix::conffile (
     fail 'You must provide either \'source\' or \'content\', not both'
   }
 
-  validate_hash($options)
   if !$source and !$content and $ensure == 'present' and empty($options) {
     fail 'You must provide \'options\' hash parameter if you don\'t provide \'source\' neither \'content\''
   }
diff --git a/manifests/config.pp b/manifests/config.pp
index 36135780e5cc63e910361cc62357d0a142b7a7c5..7eb10ae41e19a05c729aa887f6f7c297a644730b 100644
--- a/manifests/config.pp
+++ b/manifests/config.pp
@@ -27,13 +27,15 @@
 #     ensure => 'blank',
 #   }
 #
-define postfix::config ($value = undef, $ensure = 'present') {
+define postfix::config (
+  Optional[String]                   $value  = undef,
+  Enum['present', 'absent', 'blank'] $ensure = 'present',
+) {
 
-  validate_re($ensure, ['present', 'absent', 'blank'],
-    "\$ensure must be either 'present', 'absent' or 'blank', got '${ensure}'")
   if ($ensure == 'present') {
-    validate_re($value, '^.+$',
-      '$value can not be empty if ensure = present')
+    assert_type(Pattern[/^.+$/], $value) |$e, $a| {
+      fail '$value can not be empty if ensure = present'
+    }
   }
 
   if (!defined(Class['postfix'])) {
diff --git a/manifests/files.pp b/manifests/files.pp
index 448ae5607e124b671ef63216381b2dbbc7a10817..22956e17ce34533ef04faac444137a9da29a5eea 100644
--- a/manifests/files.pp
+++ b/manifests/files.pp
@@ -19,9 +19,9 @@ class postfix::files {
   $use_schleuder       = $postfix::use_schleuder
   $use_sympa           = $postfix::use_sympa
 
-  validate_string($mastercf_source)
-  validate_string($master_smtp)
-  validate_string($master_smtps)
+  assert_type(Optional[String], $mastercf_source)
+  assert_type(Optional[String], $master_smtp)
+  assert_type(Optional[String], $master_smtps)
 
   File {
     replace => $manage_conffiles,
diff --git a/manifests/hash.pp b/manifests/hash.pp
index 117ca65d2a051432731aa17ef00eabed8e4e450f..ddeb3fd1ec1b88c842870016dd6ada21505ea9ce 100644
--- a/manifests/hash.pp
+++ b/manifests/hash.pp
@@ -25,17 +25,13 @@
 #   }
 #
 define postfix::hash (
-  $ensure='present',
-  $source=undef,
-  $content=undef,
+  Enum['present', 'absent']             $ensure='present',
+  Variant[Array[String], String, Undef] $source=undef,
+  Variant[Array[String], String, Undef] $content=undef,
 ) {
   include ::postfix::params
 
-  validate_absolute_path($name)
-  if !is_string($source) and !is_array($source) { fail("value for source should be either String type or Array type got ${source}") }
-  if !is_string($content) and !is_array($content) { fail("value for source should be either String type or Array type got ${content}") }
-  validate_re($ensure, ['present', 'absent'],
-    "\$ensure must be either 'present' or 'absent', got '${ensure}'")
+  assert_type(Stdlib::Absolutepath, $name)
 
   if (!defined(Class['postfix'])) {
     fail 'You must define class postfix before using postfix::config!'
diff --git a/manifests/init.pp b/manifests/init.pp
index eac07ffda553a592f22e3430573472ccf4887813..ce9e80078c900c80c82a98e83df686bc15a8f9cb 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -72,64 +72,38 @@
 #   }
 #
 class postfix (
-  $alias_maps          = 'hash:/etc/aliases',
-  $inet_interfaces     = 'all',
-  $ldap                = false,
-  $ldap_base           = undef,
-  $ldap_host           = undef,
-  $ldap_options        = undef,
-  $mail_user           = 'vmail',       # postfix_mail_user
-  $mailman             = false,
-  $maincf_source       = "puppet:///modules/${module_name}/main.cf",
-  $manage_conffiles    = true,
-  $manage_mailx        = true,
-  $mastercf_source     = undef,
-  $master_smtp         = undef,         # postfix_master_smtp
-  $master_smtps        = undef,         # postfix_master_smtps
-  $master_submission   = undef,         # postfix_master_submission
-  $mta                 = false,
-  $mydestination       = '$myorigin',   # postfix_mydestination
-  $mynetworks          = '127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128', # postfix_mynetworks
-  $myorigin            = $::fqdn,
-  $relayhost           = undef,         # postfix_relayhost
-  $manage_root_alias   = true,
-  $root_mail_recipient = 'nobody',      # root_mail_recipient
-  $satellite           = false,
-  $smtp_listen         = '127.0.0.1',   # postfix_smtp_listen
-  $use_amavisd         = false,         # postfix_use_amavisd
-  $use_dovecot_lda     = false,         # postfix_use_dovecot_lda
-  $use_schleuder       = false,         # postfix_use_schleuder
-  $use_sympa           = false,         # postfix_use_sympa
-  $postfix_ensure      = 'present',
-  $mailx_ensure        = 'present',
+  String                          $alias_maps          = 'hash:/etc/aliases',
+  String                          $inet_interfaces     = 'all',
+  Boolean                         $ldap                = false,
+  Optional[String]                $ldap_base           = undef,
+  Optional[String]                $ldap_host           = undef,
+  Optional[String]                $ldap_options        = undef,
+  String                          $mail_user           = 'vmail',       # postfix_mail_user
+  Boolean                         $mailman             = false,
+  String                          $maincf_source       = "puppet:///modules/${module_name}/main.cf",
+  Boolean                         $manage_conffiles    = true,
+  Boolean                         $manage_mailx        = true,
+  Optional[String]                $mastercf_source     = undef,
+  Optional[String]                $master_smtp         = undef,         # postfix_master_smtp
+  Optional[String]                $master_smtps        = undef,         # postfix_master_smtps
+  Optional[String]                $master_submission   = undef,         # postfix_master_submission
+  Boolean                         $mta                 = false,
+  String                          $mydestination       = '$myorigin',   # postfix_mydestination
+  String                          $mynetworks          = '127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128', # postfix_mynetworks
+  String                          $myorigin            = $::fqdn,
+  Optional[String]                $relayhost           = undef,         # postfix_relayhost
+  Boolean                         $manage_root_alias   = true,
+  Variant[Array[String], String]  $root_mail_recipient = 'nobody',      # root_mail_recipient
+  Boolean                         $satellite           = false,
+  String                          $smtp_listen         = '127.0.0.1',   # postfix_smtp_listen
+  Boolean                         $use_amavisd         = false,         # postfix_use_amavisd
+  Boolean                         $use_dovecot_lda     = false,         # postfix_use_dovecot_lda
+  Boolean                         $use_schleuder       = false,         # postfix_use_schleuder
+  Boolean                         $use_sympa           = false,         # postfix_use_sympa
+  String                          $postfix_ensure      = 'present',
+  String                          $mailx_ensure        = 'present',
 ) inherits postfix::params {
 
-
-  validate_bool($ldap)
-  validate_bool($mailman)
-  validate_bool($mta)
-  validate_bool($manage_root_alias)
-  validate_bool($manage_mailx)
-  validate_bool($satellite)
-  validate_bool($use_amavisd)
-  validate_bool($use_dovecot_lda)
-  validate_bool($use_schleuder)
-  validate_bool($use_sympa)
-
-  validate_string($alias_maps)
-  validate_string($inet_interfaces)
-  validate_string($mail_user)
-  validate_string($mydestination)
-  validate_string($mynetworks)
-  validate_string($myorigin)
-  validate_string($relayhost)
-  if ! is_array($root_mail_recipient) {
-    validate_string($root_mail_recipient)
-  }
-  validate_string($smtp_listen)
-
-
-
   $_smtp_listen = $mailman ? {
     true    => '0.0.0.0',
     default => $smtp_listen,
diff --git a/manifests/ldap.pp b/manifests/ldap.pp
index ad1a6be2ecce3e341768752d798eb2f02b905360..7dd838493113f0f3105401c164bfc5a715b042ca 100644
--- a/manifests/ldap.pp
+++ b/manifests/ldap.pp
@@ -15,9 +15,9 @@
 #
 class postfix::ldap {
 
-  validate_string($postfix::ldap_base)
-  validate_string($postfix::ldap_host)
-  validate_string($postfix::ldap_options)
+  assert_type(String, $postfix::ldap_base)
+  assert_type(String, $postfix::ldap_host)
+  assert_type(String, $postfix::ldap_options)
 
   if $::osfamily == 'Debian' {
     package {'postfix-ldap':
diff --git a/manifests/map.pp b/manifests/map.pp
index bc66ecb9a3cfd08ff334ab35b6cb878ded3e621d..f79e54c18ef156931042311b7be0a8928bd42319 100644
--- a/manifests/map.pp
+++ b/manifests/map.pp
@@ -27,20 +27,14 @@
 #   }
 #
 define postfix::map (
-  $ensure = 'present',
-  $source = undef,
-  $content = undef,
-  $type = 'hash',
-  $path = "/etc/postfix/${name}",
+  Enum['present', 'absent']             $ensure = 'present',
+  Variant[Array[String], String, Undef] $source = undef,
+  Variant[Array[String], String, Undef] $content = undef,
+  String                                $type = 'hash',
+  Stdlib::Absolutepath                  $path = "/etc/postfix/${name}",
 ) {
   include ::postfix::params
 
-  validate_absolute_path($path)
-  if !is_string($source) and !is_array($source) { fail("value for source should be either String type or Array type got ${source}") }
-  if !is_string($content) and !is_array($content) { fail("value for source should be either String type or Array type got ${content}") }
-  validate_re($ensure, ['present', 'absent'],
-    "\$ensure must be either 'present' or 'absent', got '${ensure}'")
-
   if (!defined(Class['postfix'])) {
     fail 'You must define class postfix before using postfix::config!'
   }
diff --git a/manifests/mta.pp b/manifests/mta.pp
index 727c4cf8bb52978616191a67730890208fce8226..0d742df390956593b301bc4d867d153f2c7923e6 100644
--- a/manifests/mta.pp
+++ b/manifests/mta.pp
@@ -26,18 +26,11 @@
 #   }
 #
 class postfix::mta (
-  $mydestination = $postfix::mydestination,
-  $mynetworks    = $postfix::mynetworks,
-  $relayhost     = $postfix::relayhost,
+  Pattern[/^\S+(?:,\s*\S+)*$/]               $mydestination = $postfix::mydestination,
+  Pattern[/^(?:\S+?(?:(?:,\s)|(?:\s))?)*$/]  $mynetworks    = $postfix::mynetworks,
+  Pattern[/^\S+$/]                           $relayhost     = $postfix::relayhost,
 ) {
 
-  validate_re($relayhost, '^\S+$',
-              'Wrong value for $relayhost')
-  validate_re($mydestination, '^\S+(?:,\s*\S+)*$',
-              'Wrong value for $mydestination')
-  validate_re($mynetworks, '^(?:\S+?(?:(?:,\s)|(?:\s))?)*$',
-              'Wrong value for $mynetworks')
-
   # If direct is specified then relayhost should be blank
   if ($relayhost == 'direct') {
     postfix::config { 'relayhost': ensure => 'blank' }
diff --git a/manifests/satellite.pp b/manifests/satellite.pp
index e35582786c88c8841999c2fbaefce50a0ba8c415..4e98b5e320b6132dcb61c18a34cd2ca8c519010e 100644
--- a/manifests/satellite.pp
+++ b/manifests/satellite.pp
@@ -28,7 +28,7 @@ class postfix::satellite (
   $relayhost     = $postfix::relayhost,
 ) {
 
-  validate_re($postfix::myorigin, '^\S+$')
+  assert_type(Pattern[/^\S+$/], $postfix::myorigin)
 
   class { '::postfix::mta':
     mydestination => $mydestination,
diff --git a/manifests/transport.pp b/manifests/transport.pp
index 363a753b6ddfbebe0c575df79fc6a29bfc98e635..09a520219a214990faa93360c7d3a205a6a36988 100644
--- a/manifests/transport.pp
+++ b/manifests/transport.pp
@@ -35,19 +35,13 @@
 #   }
 #
 define postfix::transport (
-  $destination=undef,
-  $nexthop=undef,
-  $file='/etc/postfix/transport',
-  $ensure='present'
+  Optional[String]          $destination = undef,
+  Optional[String]          $nexthop=undef,
+  Stdlib::Absolutepath      $file='/etc/postfix/transport',
+  Enum['present', 'absent'] $ensure='present'
 ) {
   include ::postfix::augeas
 
-  validate_string($destination)
-  validate_string($nexthop)
-  validate_string($file)
-  validate_absolute_path($file)
-  validate_string($ensure)
-
   case $ensure {
     'present': {
       if ($destination) {
diff --git a/manifests/virtual.pp b/manifests/virtual.pp
index 7b8a1502c3dc5af2586599ea01133db9450ad935..07bab2cc73eba902c56c7c3b29cd47ebe058c7ed 100644
--- a/manifests/virtual.pp
+++ b/manifests/virtual.pp
@@ -35,17 +35,12 @@
 #   }
 #
 define postfix::virtual (
-  $destination,
-  $file='/etc/postfix/virtual',
-  $ensure='present'
+  String                    $destination,
+  Stdlib::Absolutepath      $file='/etc/postfix/virtual',
+  Enum['present', 'absent'] $ensure='present'
 ) {
   include ::postfix::augeas
 
-  validate_string($destination)
-  validate_string($file)
-  validate_absolute_path($file)
-  validate_string($ensure)
-
   case $ensure {
     'present': {
       $changes = [
diff --git a/spec/defines/postfix_conffile_spec.rb b/spec/defines/postfix_conffile_spec.rb
index 682da7113c207b3f7789ba1177e0cf50866bd80c..17308e95d1608eb7101c15c7a6b41ce77257e15e 100644
--- a/spec/defines/postfix_conffile_spec.rb
+++ b/spec/defines/postfix_conffile_spec.rb
@@ -31,7 +31,7 @@ describe 'postfix::conffile' do
         it 'should fail' do
           expect {
             is_expected.to contain_file('postfix conffile foo')
-          }.to raise_error(Puppet::Error, /must be either 'present', 'absent' or 'directory'/)
+          }.to raise_error(Puppet::Error, /got 'running'/)
         end
       end
 
diff --git a/spec/defines/postfix_config_spec.rb b/spec/defines/postfix_config_spec.rb
index deb9630bf9ff52038fe9c065b905dbf42dfd66bb..f1dd18df396a4d657f360a7b5481d511c50e63db 100644
--- a/spec/defines/postfix_config_spec.rb
+++ b/spec/defines/postfix_config_spec.rb
@@ -52,7 +52,7 @@ describe 'postfix::config' do
         it 'should fail' do
           expect {
             is_expected.to contain_augeas("set postfix 'foo'")
-          }.to raise_error(Puppet::Error, /must be either 'present', 'absent' or 'blank'/)
+          }.to raise_error(Puppet::Error, /got 'running'/)
         end
       end
 
diff --git a/spec/defines/postfix_hash_spec.rb b/spec/defines/postfix_hash_spec.rb
index 31c14b070bba23427e08c6e5ac651e0367143b25..6502d8996b2177b7149659288cf606ca5acd32a2 100644
--- a/spec/defines/postfix_hash_spec.rb
+++ b/spec/defines/postfix_hash_spec.rb
@@ -31,7 +31,7 @@ describe 'postfix::hash' do
         it 'should fail' do
           expect {
             is_expected.to contain_file('/tmp/foo')
-          }.to raise_error(Puppet::Error, /must be either 'present' or 'absent'/)
+          }.to raise_error(Puppet::Error, /got 'running'/)
         end
       end
 
@@ -40,7 +40,7 @@ describe 'postfix::hash' do
         it 'should fail' do
           expect {
             is_expected.to contain_file('/tmp/foo')
-          }.to raise_error(Puppet::Error, /"foo" is not an absolute path/)
+          }.to raise_error(Puppet::Error, /got 'foo'/)
         end
       end
 
diff --git a/spec/defines/postfix_map_spec.rb b/spec/defines/postfix_map_spec.rb
index 1e3f22468869bc29bccf5abf67206e5697e5ca24..f525a91f87cce3dc5d444216a8e7f35a5722be3d 100644
--- a/spec/defines/postfix_map_spec.rb
+++ b/spec/defines/postfix_map_spec.rb
@@ -31,7 +31,7 @@ describe 'postfix::map' do
         it 'should fail' do
           expect {
             is_expected.to contain_file('postfix map foo')
-          }.to raise_error(Puppet::Error, /must be either 'present' or 'absent'/)
+          }.to raise_error(Puppet::Error, /got 'running'/)
         end
       end
 
diff --git a/spec/defines/postfix_transport_spec.rb b/spec/defines/postfix_transport_spec.rb
index ce45381985b9549e3a4c863bfb34f2ced92e9dda..8e1e31cc85f846004d5193fc06da023eac7e9852 100644
--- a/spec/defines/postfix_transport_spec.rb
+++ b/spec/defines/postfix_transport_spec.rb
@@ -63,7 +63,7 @@ describe 'postfix::transport' do
         it 'should fail' do
           expect {
             is_expected.to contain_augeas('Postfix transport - foo')
-          }.to raise_error(Puppet::Error, /"baz" is not an absolute path/)
+          }.to raise_error(Puppet::Error, /got 'baz'/)
         end
       end
 
@@ -89,7 +89,7 @@ describe 'postfix::transport' do
         it 'should fail' do
           expect {
             is_expected.to contain_augeas('Postfix transport - foo')
-          }.to raise_error(Puppet::Error, /\$ensure must be either/)
+          }.to raise_error(Puppet::Error, /got 'running'/)
         end
       end
 
diff --git a/spec/defines/postfix_virtual_spec.rb b/spec/defines/postfix_virtual_spec.rb
index d9fb0b1602af6abbf047ecf0046b00b1e9f2fdb1..86d9b1ac00a5580d85664ed356b7e9e58aa333ef 100644
--- a/spec/defines/postfix_virtual_spec.rb
+++ b/spec/defines/postfix_virtual_spec.rb
@@ -58,7 +58,7 @@ describe 'postfix::virtual' do
         it 'should fail' do
           expect {
             is_expected.to contain_augeas('Postfix virtual - foo')
-          }.to raise_error(Puppet::Error, /"baz" is not an absolute path/)
+          }.to raise_error(Puppet::Error, /got 'baz'/)
         end
       end
 
@@ -84,7 +84,7 @@ describe 'postfix::virtual' do
         it 'should fail' do
           expect {
             is_expected.to contain_augeas('Postfix virtual - foo')
-          }.to raise_error(Puppet::Error, /\$ensure must be either/)
+          }.to raise_error(Puppet::Error, /got 'running'/)
         end
       end