Open JamesNK opened 8 months ago
For the last one I started to add some loose validation in my recent changes to the Redis resource. I think we may need to start to have different kinds of annotations, (singletons etc) which also have static methods defined on their interfaces for set validation etc.
The app model doesn't have a good validation story.
Resources and annotations are stored as loose collections:
There is no centralized validation of values in these collections. Problems:
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
.