Based on #378
Should add MessageProp (like FieldProp) to tableau.proto:
|
message FieldProp { |
|
// Usage: {range:"1,10" refer:"Item.ID"} |
|
|
|
// Different interpretations of range: |
|
// - number: value range |
|
// - string: count of utf-8 code point |
|
// |
|
// Format: "1,10", "1,~", "~,10". |
|
string range = 1; |
message MessageProp {
// Protovalidate message-level constraints. The value is a text-format
// representation of buf.validate.MessageConstraints.
//
// See https://github.com/bufbuild/protovalidate.
string validate = 1;
}
Extract and assign to option (buf.validate.message).
For example:
| Tree |
Tree note |
{validate:"cel:{id:\"tree.id_required\" message:\"id must not be default\" expression:\"this.id!=0\"}"} |
| Number |
Name |
Type |
| 1 |
ID |
uint32 |
| 2 |
Num |
int32 |
|
|
|
| Pet |
Pet note |
|
| Number |
Name |
Type |
| 1 |
Kind |
int32 |
| 2 |
Tip |
[]string |
Based on #378
Should add
MessageProp(like FieldProp) to tableau.proto:tableau/proto/tableau/protobuf/tableau.proto
Lines 268 to 276 in fe37408
Extract and assign to
option (buf.validate.message).For example: