Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check optional vs required parameter description Feature Request #1034

Closed
eriqua opened this issue Feb 22, 2022 · 2 comments · Fixed by #1687
Closed

Check optional vs required parameter description Feature Request #1034

eriqua opened this issue Feb 22, 2022 · 2 comments · Fixed by #1687
Assignees
Labels
[cat] modules category: modules [cat] testing category: testing documentation Improvements or additions to documentation enhancement New feature or request

Comments

@eriqua
Copy link
Contributor

eriqua commented Feb 22, 2022

Description

Verify the description for Optional parameters is correct, i.e. parameter description should start with "Optional" if a default value is provided.

Verify the description for Required and Conditional parameters is correct, i.e. if the parameter description starts with "Required" or "Conditional" no default value should be provided.

For each of these scenarios a Pester test should be created.

@eriqua eriqua added enhancement New feature or request good first issue Good for newcomers [cat] modules category: modules labels Feb 22, 2022
@MariusStorhaug
Copy link
Contributor

MariusStorhaug commented Mar 6, 2022

Is this not already done?

It "[<moduleFolderName>] parameters' description shoud start either by 'Optional.' or 'Required.' or 'Generated.'" -TestCases $deploymentFolderTestCases {
param(
$moduleFolderName,
$templateContent
)
if (-not $templateContent.parameters) {
# Skip test
$true | Should -Be $true
return
}
$IncorrectParameters = @()
$Paramdescoutput = $templateContent.parameters.Keys
foreach ($Param in $Paramdescoutput) {
$Data = ($templateContent.parameters.$Param.metadata).description
if ($Data -notlike 'Optional. [a-zA-Z]*' -and $Data -notlike 'Required. [a-zA-Z]*' -and $Data -notlike 'Generated. [a-zA-Z]*') {
$IncorrectParameters += $Param
}
}
$IncorrectParameters | Should -BeNullOrEmpty
}

@eriqua
Copy link
Contributor Author

eriqua commented Mar 22, 2022

That is checking for the description regex but does not check if a default value is provided in case the description is Optional.

@rahalan rahalan closed this as completed Apr 15, 2022
@rahalan rahalan reopened this Apr 15, 2022
@rahalan rahalan added the [cat] testing category: testing label May 3, 2022
@eriqua eriqua added documentation Improvements or additions to documentation and removed good first issue Good for newcomers labels May 3, 2022
@AlexanderSehr AlexanderSehr self-assigned this Jul 17, 2022
@AlexanderSehr AlexanderSehr linked a pull request Jul 17, 2022 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[cat] modules category: modules [cat] testing category: testing documentation Improvements or additions to documentation enhancement New feature or request
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants