Skip to content

Protobuf Practice

Edit the schema and the descriptor checks run as you type. Continue when everything passes.

Progress

Exercise 8: Schema-Level Validation

8. Schema-Level Validation

Context
Types stop at string; they cannot say which strings are valid. protovalidate puts those rules in the schema as options, so every language enforces the same ones.
Task

Import buf/validate/validate.proto, require email to be a valid email address, and require age to be at least 18.

schema.proto
Valid Schema
syntax = "proto3";

package practice;

// Signup is submitted when a new account is created
message Signup {
  string email = 1;
  uint32 age = 2;
}
Evaluation checks
Imports 'buf/validate/validate.proto'.
Field 'email' requires a valid email address.
Field 'age' must be at least 18.

Exercise Incomplete

Checks remaining above