Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add timestamp.valid #114

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,6 @@ message TimestampGTNowWithin {
within: {seconds: 3600}
}];
}
message TimestampValid {
google.protobuf.Timestamp val = 1 [(buf.validate.field).timestamp.valid = true];
}
5 changes: 5 additions & 0 deletions proto/protovalidate/buf/validate/validate.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3697,4 +3697,9 @@ message TimestampRules {
id: "timestamp.within",
expression: "this < now-rules.within || this > now+rules.within ? 'value must be within %s of now'.format([rules.within]) : ''"
}];

// `valid` specifies that this field, of the `google.protobuf.Timestamp` type, must adhere to the documented specification:
// * the `seconds` field must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.
// * the `nanos` field must be from 0 to 999,999,999 inclusive.
bool valid = 10;
}
154 changes: 110 additions & 44 deletions tools/internal/gen/buf/validate/conformance/cases/wkt_timestamp.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading