microsoft / microsoft/aspire

Volume names required in manifest, but not always written in code

Open
#8,633 3 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

### Describe the bug

This code

https://github.com/dotnet/aspire/blob/f9035bc913df62c51ead803f0578518f53b0364a/src/Aspire.Hosting/Publishing/ManifestPublishingContext.cs#L593-L619

claims it is possible to not have a name on a volume.

However, the `name` property is marked as `required` in the manifest schema.

https://github.com/dotnet/aspire/blob/c29004a2da959df39a08b303733b19f4b3961dee/src/Schema/aspire-8.0.json#L670-L675

We need to resolve this discrepancy. Either names are required, or they aren't.

### Expected Behavior

_No response_

### Steps To Reproduce

```c#
var redis = builder.AddRedis("cache")
.WithVolume("/data");
```

Produces manifest:

```json
"cache": {
"type": "container.v0",
"connectionString": "{cache.bindings.tcp.host}:{cache.bindings.tcp.port},password={cache-password.value}",
"image": "docker.io/library/redis:7.4",
"entrypoint": "/bin/sh",
"args": [
"-c",
"redis-server --requirepass $REDIS_PASSWORD"
],
"volumes": [
{
"target": "/data",
"readOnly": false
}
],
"env": {
"REDIS_PASSWORD": "{cache-password.value}"
},
"bindings": {
"tcp": {
"scheme": "tcp",
"protocol": "tcp",
"transport": "tcp",
"targetPort": 6379
}
}
},
```

Which doesn't pass our manifest schema validation

### Exceptions (if any)

_No response_

### .NET Version info

_No response_

### Anything else?

cc @mitchdenny @davidfowl @DamianEdwards @vhvb1989

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.