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

Addressing fixes for GitHub issues 738, 753 and 745 #754

Merged
merged 7 commits into from
Nov 20, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Addressing pr comments
  • Loading branch information
Pallavi Sah committed Nov 10, 2023
commit 5cef22fbdbfea43541e26ae76bfa657cf7c3acc6
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,19 @@ foreach ($inner in $originalInnerTemplates) {
$parent.parameters.$mappedParameterName.type -ne $innerTemplateParameterType # with a different type.
) {
$innerTemplateParamValue = $innerTemplateParam.Value
$regexParam = "parameters(?<mappedParameterName>\(.*\))(\[.*?\]|\.|\,)(.*)\]" # https://regex101.com/r/ao6tsK/1 https://github.com/Azure/arm-ttk/issues/635
$regexParam = ".*parameters(?<mappedParameterName>\(.*\))(\[.*?\]|\.|\,)(.*)\]" # https://regex101.com/r/V0dzVv/1 and https://regex101.com/r/ao6tsK/1 https://github.com/Azure/arm-ttk/issues/635
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i thinkyou need .*[ right ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is [.*, will add it

if($null -ne $innerTemplateParamValue.value)
{
$innerTemplateParamValue = $innerTemplateParamValue.value
}
if(($innerTemplateParamValue -is [string]) -and ($innerTemplateParamValue -notmatch $regexParam))
{
# If this is the case, write an error
# If this is the case, write an error
Write-Error -ErrorId Inconsistent.Parameter -Message "Type Mismatch: Parameter '$parameterName' in nested template '$($inner.ParentObject[0].name)' is defined as $innerTemplateParameterType, but the parent template defines it as $($parent.parameters.$mappedParameterName.type))." -TargetObject ([PSCustomObject]@{
JSONPath = $inner.JSONPath + ".parameters.$parameterName"})
JSONPath = $inner.JSONPath + ".parameters.$parameterName"
})
break # and then stop processing, because we only wish to compare this against the immediate parent template.
}

}
}
}
Expand Down
Loading