gardener-attic / component-spec

component descriptor specification and language bindings
2 stars 15 forks source link

Go-Binding: Validation detects duplicate instead of using the version attribute #50

Open enrico-kaack-comp opened 2 years ago

enrico-kaack-comp commented 2 years ago

What happened: The go-binding behaves not according to spec when presented with two component references that only differ in name. The validation fails with a duplicated dependency error.

What you expected to happen: Based on the spec, if two referenced artifacts (componentReference, resource, source) collide based on their name and extra identity, the version is implicitly added to the identity:

In v2, for backwards-compatibility-reasons, the (mandatory) version attribute is implicitly added to the set of additional identity attributes iff it is not explicitly declared as such, and the uniqueness constraint would otherwise be violated.

(https://gardener.github.io/component-spec/semantics.html#identities-and-accessors)

Anything else we need to know: Root cause for this bug is probably in: https://github.com/gardener/component-spec/blob/139929baecedfce543c389c1d09a065cc25b3c13/bindings-go/apis/v2/componentdescriptor.go#L230

Need to make sure this is correctly handled when accessing referenced artifacts as well.

Environment: