diff --git a/api/payloads/manifest.go b/api/payloads/manifest.go index 3640f9d05..e93dbce10 100644 --- a/api/payloads/manifest.go +++ b/api/payloads/manifest.go @@ -193,7 +193,7 @@ func (m Manifest) Validate() error { func (a ManifestApplication) Validate() error { return validation.ValidateStruct(&a, validation.Field(&a.Name, payload_validation.StrictlyRequired), - validation.Field(&a.DefaultRoute, validation.When(a.RandomRoute, validation.Nil.Error("and random-route may not be used together"))), + validation.Field(&a.DefaultRoute, validation.When(a.RandomRoute && a.DefaultRoute, validation.Nil.Error("and random-route may not be used together"))), validation.Field(&a.DiskQuota, validation.By(validateAmountWithUnit), validation.When(a.AltDiskQuota != nil, validation.Nil.Error("and disk-quota may not be used together"))), validation.Field(&a.AltDiskQuota, validation.By(validateAmountWithUnit)), validation.Field(&a.Instances, validation.Min(0)), diff --git a/api/payloads/manifest_test.go b/api/payloads/manifest_test.go index 316bf8306..d028d989a 100644 --- a/api/payloads/manifest_test.go +++ b/api/payloads/manifest_test.go @@ -198,6 +198,17 @@ var _ = Describe("Manifest payload", func() { Expect(validateErr).To(MatchError("default-route: and random-route may not be used together.")) }) }) + + When("only the random-route flag is set", func() { + BeforeEach(func() { + testManifest.DefaultRoute = false + testManifest.RandomRoute = true + }) + + It("does not return a validation error", func() { + Expect(validateErr).NotTo(HaveOccurred()) + }) + }) }) })