Skip to content

Commit acc2ace

Browse files
fix: Fixed deserialized if allowed value is a number
1 parent cb5df63 commit acc2ace

File tree

4 files changed

+27
-3
lines changed

4 files changed

+27
-3
lines changed

Bicep.Docs.Tests/BasicTests.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,10 @@ public void Basic_WhenBicepFileIsProvidedWithBooleanValueForParameter_Documentat
1919
{
2020
Program.Main(["--template", "templates/keyvault/main.bicep"]);
2121
}
22+
23+
[Test]
24+
public void Basic_WhenTemplateContainParameterTypeNumber_DocumentationShouldBeGenerated()
25+
{
26+
Program.Main(["--template", "templates/postgresql/main.bicep"]);
27+
}
2228
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
param parLocation string
2+
3+
@allowed([
4+
128
5+
256
6+
1024
7+
])
8+
param parStorageSize int = 1024
9+
10+
resource db 'Microsoft.DBforPostgreSQL/flexibleServers@2022-12-01' = {
11+
name: 'database'
12+
location: parLocation
13+
properties: {
14+
storage: {
15+
storageSizeGB: parStorageSize
16+
}
17+
}
18+
}

Bicep.Docs/BicepCompiler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ internal class BicepCompiler
3434
{
3535
// There's also a problem when using Bicep.Docs on Windows if Azure CLI is available via
3636
// system PATH, rather than user's PATH. We can try to avoid that by
37-
Console.WriteLine("Compilation failed, attempting to compile Bicep file using Azure CLI.");
38-
CompileBicepWith("C:\\Program Files\\Microsoft SDKs\\Azure\\CLI2\\wbin\\az", $"bicep build --file {templateFile} --stdout", token, out template);
37+
Console.WriteLine("Compilation failed, attempting to compile Bicep file using Azure CLI (fixed location).");
38+
CompileBicepWith("cmd", $"bicep build --file {templateFile} --stdout", token, out template);
3939
}
4040

4141
throw;

Bicep.Docs/TemplateSchema.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ internal class TemplateParameter
2626
public object? DefaultValue { get; set; }
2727

2828
[JsonPropertyName("allowedValues")]
29-
public string[]? AllowedValues { get; set; }
29+
public object[]? AllowedValues { get; set; }
3030

3131
[JsonPropertyName("metadata")]
3232
public IDictionary<string, string>? Metadata { get; set; }

0 commit comments

Comments
 (0)