Skip to content

Commit 202666d

Browse files
Gabriel123NBernieWhite
andauthored
Add support for min/max values and length for arrays/string properties (#263)
* Add support for min/max length/value for integers and arrays * Adapt test data for the new output * Corrects typo and incorrect property reference minValue for $result['minLength'] and maxValue for $result['minLength'] * Corrects missing space --------- Co-authored-by: Bernie White <bewhite@microsoft.com>
1 parent 6f5603e commit 202666d

3 files changed

Lines changed: 85 additions & 0 deletions

File tree

src/PSDocs.Azure/docs/Azure.Template.Doc.ps1

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,19 @@ function global:GetTemplateParameter {
2828
if ([bool]$property.Value.PSObject.Properties['allowedValues']) {
2929
$result['allowedValues'] = $property.Value.allowedValues;
3030
}
31+
if ([bool]$property.Value.PSObject.Properties['minValue']) {
32+
$result['minValue'] = $property.Value.minValue;
33+
}
34+
if ([bool]$property.Value.PSObject.Properties['maxValue']) {
35+
$result['maxValue'] = $property.Value.maxValue;
36+
}
37+
38+
if ([bool]$property.Value.PSObject.Properties['minLength']) {
39+
$result['minLength'] = $property.Value.minLength;
40+
}
41+
if ([bool]$property.Value.PSObject.Properties['maxLength']) {
42+
$result['maxLength'] = $property.Value.maxLength;
43+
}
3144
[PSCustomObject]$result;
3245
}
3346
}
@@ -323,6 +336,26 @@ Document 'README' -With 'Azure.TemplateSchema' {
323336
"**$($LocalizedData.AllowedValues)**"
324337
$parameter.AllowedValues | Code 'text'
325338
}
339+
340+
if ($Null -ne $parameter.MinValue -and $parameter.MinValue.Length -gt 0) {
341+
"**$($LocalizedData.MinValue)**"
342+
$parameter.MinValue | Code 'text'
343+
}
344+
345+
if ($Null -ne $parameter.MaxValue -and $parameter.MaxValue.Length -gt 0) {
346+
"**$($LocalizedData.MaxValue)**"
347+
$parameter.MaxValue | Code 'text'
348+
}
349+
350+
if ($Null -ne $parameter.MinLength -and $parameter.MinLength.Length -gt 0) {
351+
"**$($LocalizedData.MinLength)**"
352+
$parameter.MinLength | Code 'text'
353+
}
354+
355+
if ($Null -ne $parameter.MaxLength -and $parameter.MaxLength.Length -gt 0) {
356+
"**$($LocalizedData.MaxLength)**"
357+
$parameter.MaxLength | Code 'text'
358+
}
326359
}
327360
}
328361
}

src/PSDocs.Azure/en/PSDocs-strings.psd1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,8 @@
1717
Required = 'Required'
1818
RequiredYes = 'Yes'
1919
RequiredNo = 'No'
20+
MinValue = 'Minimum value'
21+
MaxValue = 'Maximum value'
22+
MinLength = 'Minimum length'
23+
MaxLength = 'Maximum length'
2024
}

templates/storage/v1/README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,18 @@ Determine how many additional characters are added to the storage account name a
7474
0
7575
```
7676

77+
**Minimum value**
78+
79+
```text
80+
0
81+
```
82+
83+
**Maximum value**
84+
85+
```text
86+
13
87+
```
88+
7789
### containers
7890

7991
![Parameter Setting](https://img.shields.io/badge/parameter-optional-green?style=flat-square)
@@ -98,6 +110,18 @@ The number of days to retain deleted blobs. When set to 0, soft delete is disabl
98110
0
99111
```
100112

113+
**Minimum value**
114+
115+
```text
116+
0
117+
```
118+
119+
**Maximum value**
120+
121+
```text
122+
365
123+
```
124+
101125
### containerSoftDeleteDays
102126

103127
![Parameter Setting](https://img.shields.io/badge/parameter-optional-green?style=flat-square)
@@ -110,6 +134,18 @@ The number of days to retain deleted containers. When set to 0, soft delete is d
110134
0
111135
```
112136

137+
**Minimum value**
138+
139+
```text
140+
0
141+
```
142+
143+
**Maximum value**
144+
145+
```text
146+
365
147+
```
148+
113149
### shares
114150

115151
![Parameter Setting](https://img.shields.io/badge/parameter-optional-green?style=flat-square)
@@ -140,6 +176,18 @@ The number of days to retain deleted shares. When set to 0, soft delete is disab
140176
0
141177
```
142178

179+
**Minimum value**
180+
181+
```text
182+
0
183+
```
184+
185+
**Maximum value**
186+
187+
```text
188+
365
189+
```
190+
143191
### allowBlobPublicAccess
144192

145193
![Parameter Setting](https://img.shields.io/badge/parameter-optional-green?style=flat-square)

0 commit comments

Comments
 (0)