AllowEmptyString() is only needed on mandatory parameters

This commit is contained in:
Petri Asikainen 2021-06-08 08:08:33 +03:00
parent 9562ab3d46
commit 1e31256487
8 changed files with 11 additions and 20 deletions

View file

@ -84,7 +84,7 @@ function Set-SnipeItAccessory() {
[ValidateRange(1, [int]::MaxValue)] [ValidateRange(1, [int]::MaxValue)]
[int]$manufacturer_id, [int]$manufacturer_id,
[AllowEmptyString()]
[string]$order_number, [string]$order_number,
[float]$purchase_cost, [float]$purchase_cost,

View file

@ -86,7 +86,7 @@ function Set-SnipeItAsset()
[parameter(mandatory = $true,ValueFromPipelineByPropertyName)] [parameter(mandatory = $true,ValueFromPipelineByPropertyName)]
[int[]]$id, [int[]]$id,
[AllowEmptyString()]
[string]$name, [string]$name,
[int]$status_id, [int]$status_id,
@ -101,7 +101,7 @@ function Set-SnipeItAsset()
[string]$serial, [string]$serial,
[AllowEmptyString()]
[string]$order_number, [string]$order_number,
[int]$warranty_months, [int]$warranty_months,

View file

@ -61,7 +61,7 @@ function Set-SnipeItComponent()
[int]$location_id, [int]$location_id,
[AllowEmptyString()]
[string]$order_number, [string]$order_number,
[datetime]$purchase_date, [datetime]$purchase_date,

View file

@ -107,7 +107,7 @@ function Set-SnipeItLicense() {
[string]$notes, [string]$notes,
[AllowEmptyString()]
[string]$order_number, [string]$order_number,
[float]$purchase_cost, [float]$purchase_cost,

View file

@ -68,30 +68,22 @@ function Set-SnipeitLocation() {
[ValidateLength(3, 255)] [ValidateLength(3, 255)]
[string]$name, [string]$name,
[AllowEmptyString()]
[string]$address, [string]$address,
[AllowEmptyString()]
[string]$address2, [string]$address2,
[AllowEmptyString()]
[string]$state, [string]$state,
[AllowEmptyString()]
[string]$country, [string]$country,
[AllowEmptyString()]
[string]$zip, [string]$zip,
[AllowEmptyString()]
[string]$city, [string]$city,
[AllowEmptyString()]
[string]$currency, [string]$currency,
[int]$manager_id, [int]$manager_id,
[AllowEmptyString()]
[string]$ldap_ou, [string]$ldap_ou,
[int]$parent_id, [int]$parent_id,

View file

@ -46,7 +46,6 @@ function Set-SnipeItModel() {
[ValidateLength(1, 255)] [ValidateLength(1, 255)]
[string]$name, [string]$name,
[AllowEmptyString()]
[string]$model_number, [string]$model_number,
[int]$category_id, [int]$category_id,

View file

@ -80,13 +80,13 @@ function Set-SnipeItUser() {
[string]$userName, [string]$userName,
[AllowEmptyString()]
[string]$jobtitle, [string]$jobtitle,
[AllowEmptyString()]
[string]$email, [string]$email,
[AllowEmptyString()]
[string]$phone, [string]$phone,
[int]$company_id, [int]$company_id,
@ -97,12 +97,12 @@ function Set-SnipeItUser() {
[int]$manager_id, [int]$manager_id,
[AllowEmptyString()]
[string]$employee_num, [string]$employee_num,
[bool]$activated, [bool]$activated,
[AllowEmptyString()]
[string]$notes, [string]$notes,
[parameter(mandatory = $true)] [parameter(mandatory = $true)]

View file

@ -25,7 +25,7 @@ function Update-SnipeItAlias()
param( param(
[Parameter(Mandatory = $true, [Parameter(Mandatory = $true,
ValueFromPipeline = $true)] ValueFromPipeline = $true)]
[AllowEmptyString()]
[string[]] [string[]]
$String $String
) )