wadm icon indicating copy to clipboard operation
wadm copied to clipboard

[BUG] Empty `metadata.annotations` passes validation

Open mikenikles opened this issue 7 months ago • 2 comments

I initially reported this at https://github.com/wasmCloud/wasmCloud/issues/4481.

The following manifest passes validation, but fails at deploy time:

metadata:
  name: test
  annotations:

I was hoping that validate_manifest() (source) would report errors for the invalid manifest listed above.

mikenikles avatar May 28 '25 04:05 mikenikles

Oh yeah interesting @mikenikles , likely because we interpret that as an empty list of annotations which isn't technically an issue?

This is a bug and we should be able to fix this in the validate code 👍🏻

brooksmtownsend avatar May 28 '25 20:05 brooksmtownsend

Are we sure that this needs to be implemented on the validation side of things? When checking the label and annotation documentation of the OAM (https://github.com/oam-dev/spec/blob/master/metadata.md#label-format) this refers to Kubernetes and does not provide much more specifics. And Kubernetes accepts setting a labels or annotations field without a value. It will just treat it as nil and ignore. This might also be better in this case. Not only is it consistent with how other systems operate (like everything running over the Kubernetes API), it also will be much much easier. The reason is that during deserialisation serde does not differentiate between a field with a nil value or a missing field. So, AFAIK, might need to implement a custom deserialiser that somehow makes that differentiation.

Where does the deployment fail? Would it not make more sense to accept this as a valid Application?

f4z3r avatar Sep 05 '25 15:09 f4z3r