You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When try it use like this:
Test-PodeOAVersion -Version 3.1
got error:
Test-PodeOAVersion : Cannot validate argument on parameter 'Version'. The argument "3,1" does not belong to the set "3.1,3" specified by the ValidateSet attribute. Supply an argument that is in the set and then try the command again.
You cannot define $Version as [int] otherwise 3.1 is not accepted. What we can do is to change it to string.
I've a branch open to fix any OpenAPI issues. I'm going to add the workaround to the branch
Describe the Bug
Bug in different powershell version, decimal value validation not works fine.
Steps To Reproduce
Steps to reproduce the behavior:
In this component file:
Pode/blob/develop/src/Public/OAComponents.ps1
function Test-PodeOAVersion
When try it use like this:
Test-PodeOAVersion -Version 3.1
got error:
Test-PodeOAVersion : Cannot validate argument on parameter 'Version'. The argument "3,1" does not belong to the set "3.1,3" specified by the ValidateSet attribute. Supply an argument that is in the set and then try the command again.
function Test-PodeOAVersion
[Parameter(Mandatory = $true)]
[ValidateSet( 3.1 , 3.0 )]
[decimal]
$Version,
Version validation shoud be changed to [int] value .
Platform
Additional Context
This issue works only using this Powershell version (may be grate version also , i don't test ):
$PSVersionTable
Name Value
PSVersion 5.1.22621.2506
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.22621.2506
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
For example on this powershell version it works fine
$PSVersionTable
Name Value
PSVersion 5.1.14393.6343
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.6343
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
The text was updated successfully, but these errors were encountered: