diff --git a/loader/validate.go b/loader/validate.go index cfaf139f..46cdda79 100644 --- a/loader/validate.go +++ b/loader/validate.go @@ -155,7 +155,7 @@ func checkConsistency(project *types.Project) error { if s.Develop != nil && s.Develop.Watch != nil { for _, watch := range s.Develop.Watch { - if watch.Action != types.WatchActionRebuild && watch.Target == "" { + if watch.Target == "" && watch.Action != types.WatchActionRebuild && watch.Action != types.WatchActionRestart { return fmt.Errorf("services.%s.develop.watch: target is required for non-rebuild actions: %w", s.Name, errdefs.ErrInvalid) } } diff --git a/schema/compose-spec.json b/schema/compose-spec.json index fc50f193..f95a7b9d 100644 --- a/schema/compose-spec.json +++ b/schema/compose-spec.json @@ -500,7 +500,7 @@ "properties": { "ignore": {"type": "array", "items": {"type": "string"}}, "path": {"type": "string"}, - "action": {"type": "string", "enum": ["rebuild", "sync", "sync+restart", "sync+exec"]}, + "action": {"type": "string", "enum": ["rebuild", "sync", "restart", "sync+restart", "sync+exec"]}, "target": {"type": "string"}, "exec": {"$ref": "#/definitions/service_hook"} }, diff --git a/types/develop.go b/types/develop.go index b904d685..8f7c8fa5 100644 --- a/types/develop.go +++ b/types/develop.go @@ -27,6 +27,7 @@ type WatchAction string const ( WatchActionSync WatchAction = "sync" WatchActionRebuild WatchAction = "rebuild" + WatchActionRestart WatchAction = "restart" WatchActionSyncRestart WatchAction = "sync+restart" WatchActionSyncExec WatchAction = "sync+exec" )