From d2456c6605f269df8c1b559b17f7432d0a37fabf Mon Sep 17 00:00:00 2001 From: devsjc <47188100+devsjc@users.noreply.github.com> Date: Thu, 26 Mar 2026 11:34:18 +0000 Subject: [PATCH] fix(proto): Modify timestamp validation --- proto/ocf/dp/dp-data.messages.proto | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/proto/ocf/dp/dp-data.messages.proto b/proto/ocf/dp/dp-data.messages.proto index 65c84d7..1b0fa0b 100644 --- a/proto/ocf/dp/dp-data.messages.proto +++ b/proto/ocf/dp/dp-data.messages.proto @@ -25,11 +25,16 @@ message Forecaster { message TimeWindow { /* The start of the time window, inclusive. - * Cannot be more than 7 days before end_timestamp_utc. + * Cannot be more than 7 days before end_timestamp_utc, nor more than 1 month in the future. */ google.protobuf.Timestamp start_timestamp_utc = 1 [ (buf.validate.field).required = true, - (buf.validate.field).timestamp = { gt: { seconds: 112000000}, lt_now: true } + (buf.validate.field).timestamp = { gt: { seconds: 112000000} }, + (buf.validate.field).cel = { + id: "timestamp_not_too_far_in_future" + message: "start_timestamp_utc cannot be more than 30 days in the future" + expression: "this <= now + duration('720h')" + } ]; /* The end of the time window, inclusive. * Cannot be more than 7 days after start_timestamp_utc. @@ -139,7 +144,12 @@ message GetForecastAtTimestampRequest { * If not specified, the current time will be used. */ optional google.protobuf.Timestamp timestamp_utc = 3 [ - (buf.validate.field).timestamp = { gt: { seconds: 112000000} } + (buf.validate.field).timestamp = { gt: { seconds: 112000000} }, + (buf.validate.field).cel = { + id: "timestamp_not_too_far_in_future" + message: "timestamp_utc cannot be more than 30 days in the future" + expression: "this <= now + duration('720h')" + } ]; Forecaster forecaster = 4 [ (buf.validate.field).required = true