Support for Bicep Parameters for Types other than string
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
Research direction
Start by tracing the C# implementation of Bicep template parameters and how it writes .bicepparam files; the issue does not name the relevant files or tests. Reproduce the boolean and object examples, then check how parameter values are serialized and whether strings containing single quotes are escaped. Done means non-string values produce valid Bicep parameter syntax and the examples pass focused tests.
Written by the indexing model from the issue text.
Description
Is there an existing issue for this?
- I have searched the existing issues
Is your feature request related to a problem? Please describe the problem.
Problem or scenario
I wish to be able to provide parameter values for Bicep Templates like this:
param myString string = 'hello-world'
param myBool bool = true
type myType = {
a: string
b: string
}
@description('All VCS variables')
param myParam myType = {
a: '1'
b: '2'
}
Uncommenting either of the below lines results in
builder.AddBicepTemplate("HelloWorld", "HelloWorld.bicep")
.WithParameter("myString", "5")
// .WithParameter("myBool", false)
// .WithParameter("myParam", "{'a':'1', 'b':'2'}")
;
myBool uncommented fails to even get as far as writing the bicepparam file.
Unsupported value type:
System.Text.Json.Nodes.JsonValuePrimitive`1[System.Boolean]
myParam uncommented produces the following HelloWorld.parameters.biceparam file:
using './HelloWorld.bicep'
param myString = '5'
param myParam = '{'a':'1', 'b':'2'}'
Note: this reveals an additional bug: Aspire, or Aspire-1p, is failing to escape the single quotes.
and error message:
Error BCP033: Expected a value of type "{ a: string, b: string }" but the provided value is of type
"'{'". [https://aka.ms/bicep/core-diagnostics#BCP033]
Also note: Aspire is not escaping ' when it should be
Describe the solution you'd like
Parameter support for Bicep types. Bicep's data model is json-centric, so continuing to treat them as strings, but if the bicep parameter is of a non-string type, converting it to Bicep's representation of the same, might be one option
Additional context
No response
- Dominant language
- C#
- Stars
- 6.4k
- Forks
- 1k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 406
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/aspire
-
Aspire.Hosting.Yarp flattens TimeSpan cluster settings (ActivityTimeout, health-check intervals) into per-property env vars the YARP container ignoresPossibly taken @itsrayeedscodespace claimed this 3 days ago. Openarea-integrations
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 2 days
-
Dashboard structured logs toolbar overlaps the resource name and wraps poorly in constrained layoutsOpenarea-dashboard
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 2 days
-
area-dashboard
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 2 days
-
area-dashboard
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 2 days
-
area-templates
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 2 days
All issues in microsoft/aspire
Similar issues
-
.NET Docs Next Major State: Needs Discussion
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
getsentry/sentry-dotnet#5912 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
BeyondDimension/SteamTools#4163 · 1 comment ·
-
Difficulty 1/5 1-3 hours Newbie friendliness 90/100
ShareX/XerahS#316 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
SubtitleEdit/subtitleedit#16825 ·
Maintainers usually reply within 1 day
-
ci-flake kind:tests size:S type:bug
Difficulty 1/5 Under an hour Newbie friendliness 82/100
elsa-workflows/elsa-foundation#4058 · 1 reaction ·
Maintainers usually reply within 1 day