You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2023/01/20 10:39:32 UTC

[GitHub] [skywalking-banyandb] hanahmily commented on a diff in pull request #241: fix metadata register bug.

hanahmily commented on code in PR #241:
URL: https://github.com/apache/skywalking-banyandb/pull/241#discussion_r1082346928


##########
api/proto/banyandb/database/v1/schema.proto:
##########
@@ -88,25 +89,25 @@ enum CompressionMethod {
 // FieldSpec is the specification of field
 message FieldSpec {
   // name is the identity of a field
-  string name = 1;
+  string name = 1 [(validate.rules).string.min_len = 1];
   // field_type denotes the type of field value
-  FieldType field_type = 2;
+  FieldType field_type = 2 [(validate.rules).enum.defined_only = true];
   // encoding_method indicates how to encode data during writing
-  EncodingMethod encoding_method = 3;
+  EncodingMethod encoding_method = 3 [(validate.rules).enum.defined_only = true];
   // compression_method indicates how to compress data during writing
-  CompressionMethod compression_method = 4;
+  CompressionMethod compression_method = 4 [(validate.rules).enum.defined_only = true];
 }
 
 // Measure intends to store data point
 message Measure {
   // metadata is the identity of a measure
-  common.v1.Metadata metadata = 1;
+  common.v1.Metadata metadata = 1 [(validate.rules).message.required = true];
   // tag_families are for filter measures
-  repeated TagFamilySpec tag_families = 2;
+  repeated TagFamilySpec tag_families = 2 [(validate.rules).repeated.min_items = 1];
   // fields denote measure values
   repeated FieldSpec fields = 3;
   // entity indicates which tags will be to generate a series and shard a measure
-  Entity entity = 4;
+  Entity entity = 4 [(validate.rules).message.required = true];
   // interval indicates how frequently to send a data point
   // valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h", "d".
   string interval = 5;

Review Comment:
   RegExp might work, but I never like such expressions that are a bit tricky. How about validating it in the metadata model by `timestamp.ParseDuration`?
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org