microsoft / microsoft/aspire

Validation of resources and annotations

Open
#1,769 1 comment 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

The app model doesn't have a good validation story.

Resources and annotations are stored as loose collections:

* An app model has a collection of resources.
* A resource has a collection of annotations.

There is no centralized validation of values in these collections. Problems:

* Some validation is being placed in builder methods, but the collection can be added to directly.
* Validation logic is duplicated in many locations. Each builder method is making its own validation. Can go out of date, or be missed, etc.

For example, duplicate route names are not allowed. The AddProject/AddContainer/AddExecutable methods are checking for duplicate names but it's possible to add resources directly to the app model collection. There is duplicate validation in the `Build()` method to check again for duplicates.

The same issue exists with endpoints on a resource. A resource shouldn't have endpoints with duplicate names. There is validation in builder methods, but it's still possible to add a duplicate endpoint directly to the annotation.

There are also annotations that should have a maximum of one instance, e.g. `ManifestPublishingCallbackAnnotation`.

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.