microsoft / microsoft/aspire

Support complex objects as parameter types

Open
#9,449 2 comments 0 reactions 0 assignees View on GitHub
area-app-model
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Is your feature request related to a problem? Please describe the problem.

I's trying to add some parameter into my AppHost as Json.

I have tried by adding parameter like documented [here](https://learn.microsoft.com/en-us/dotnet/aspire/fundamentals/external-parameters#secret-values).

Into ```Program.cs```:
```csharp
var pullingServiceParameter = builder.AddParameter("status-pulling-service-parameter");
```
And into ```appsettings.json```
```json
{
// Some other configuration stuffs
"Parameters": {
"status-pulling-service-parameter": {
"Status": [
{
"Kind": "SqlServer"
}
]
}
}
}
```
Then and adding it as environment reference:
```csharp
var pullingServiceResource = builder.AddProject<...>("status-pulling-service")
// Some other references
.WithEnvironment("parameter", pullingServiceParameter);
```

As expected the value is missing:
![Image](https://github.com/user-attachments/assets/cd92cde5-c425-4c13-925a-0933f1fefeb9)

### Describe the solution you'd like

That's I wish is we to provide typed parameter like this:
```csharp
var pullingServiceParameter = builder.AddParameter(
name: "status-pulling-service-parameter",
value: new AwesomeType() {
// Some properties...
},
secret: true, /* It could be a secret */
persist: true /* It could be persisted */);
```
Or can be directly parsed like mechanism.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.