Conversation
"clientSideParameterSet": "BatchAccount_Get", | ||
"filters": ... | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, I see only one element is allowed.
Should we support an array of x-ps-client-side-filter in x-ps-cmdlet-info Object for providing this wild card support for other clientSideParameterSet parameter sets?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs/extensions/readme.md
Outdated
Field Name | Type | Description | ||
---|:---:|--- | ||
type | `string` | Type of filter. Supported: 'wildcard', 'logicalOperation' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logicalOperation [](start = 58, length = 16)
What is the purpose of logicalOperation type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PSSwagger/Paths.psm1
Outdated
if (-not $clientSideParameterSet) { | ||
# Warning: Missing client-side parameter | ||
Write-Warning "Required server-side parameter '$($parameterDetailEntry.Value.Name)' is not required by the client-side, which will cause issues in client-side filtering. Can't include client-side filtering." | ||
$valid = $false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$valid [](start = 40, length = 6)
Is this required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PSSwagger/Test-FilteredResult.ps1
Outdated
|
||
$regex = $Filter.Value.Replace($Filter.Character, ".*") | ||
($Result.($Filter.Property)) -match $regex | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please consider using System.Management.Automation.WildcardPattern.
For example:
$inputNameWithOptionalWildcard = "Module*"
$resultName = "ModuleName"
$wildcardOptions = [System.Management.Automation.WildcardOptions]::CultureInvariant -bor [System.Management.Automation.WildcardOptions]::IgnoreCase
$wildcardPattern = New-Object System.Management.Automation.WildcardPattern $inputNameWithOptionalWildcard,$wildcardOptions
$wildcardPattern.IsMatch($resultName)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed to change default to '%' but option to change needs to stay (for cases where '%' is valid in the parameter string).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also move strings to Resources.psd1 Fixed: 4d0c04f |
foreach ($parameterDetailEntry in $parametersDetail.GetEnumerator()) { | ||
$getParameters += $parameterDetailEntry.Value | ||
if ($parameterDetailEntry.Value.ContainsKey('Alias')) { | ||
if ($parameterDetailEntry.Value.Alias -eq 'Name') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actual parameter name of a resource can be Name itself. In that case, wildcard functionality is not enabled, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add 'powershellWildcard' filter |
Add option for Azure not to automatically generate filter |
automatic client-side filtering
Fixes:
Features:
Example of filtering: