Skip to content

validate: support assigning validate to MODE_STRUCT_TYPE_MULTI and MODE_UNION_TYPE_MULTI sheets #382

Description

@wenchy

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    validateconfgen: enforce constraints on messages and fields.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions