The event store also validates the provided entity
@@ -121,12 +121,14 @@ func (s *etcdStore) UpdateEvent(ctx context.Context, event *types.Event) error {
return errors.New("event has no check")
}
- // TODO(Simon): We should also validate event.Entity since we also use
- // some properties of Entity below, such as ID
if err := event.Check.Validate(); err != nil {
return err
}
+ if err := event.Entity.Validate(); err != nil {
+ return err
+ }
+
// update the history
// marshal the new event and store it.
eventBytes, err := json.Marshal(event)
