-
Notifications
You must be signed in to change notification settings - Fork 2
/
demo.proto
73 lines (68 loc) · 2.99 KB
/
demo.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
syntax = "proto3";
// Implements types for the Bufsteam demo.
package bufstream.demo.v1;
// We import extensions.proto to use a custom option that allows us to associate
// a message with a specific subject.
//
// See the [buf.build/bufbuild/confluent](https://buf.build/bufbuild/confluent) module
// for the full documentation.
import "buf/confluent/v1/extensions.proto";
// This imports protovalidate custom options.
//
// See [github.com/bufbuild/protovaliate](https://github.com/bufbuild/protovalidate)
// for more details.
import "buf/validate/validate.proto";
// An event where an email address was updated for a given user.
//
// This represents the schema of data sent to the `email-updated-value` subject.
message EmailUpdated {
// We define the association between the EmailUpdated message and the `email-updated-value`
// subject using the
// [`buf.confluent.v1.subject`](https://buf.build/bufbuild/confluent/docs/main:buf.confluent.v1#buf.confluent.v1.Subject)
// custom option.
option (buf.confluent.v1.subject) = {
// The user-specified name for the Confluent Schema Registry instance within the BSR.
//
// Instances are managed within BSR admin settings.
instance_name: "bufstream-demo"
// The subject's name as determined by the subject naming strategy.
//
// See
// [Confuent's documentation](https://docs.confluent.io/platform/current/schema-registry/fundamentals/serdes-develop/index.html#subject-name-strategy)
// for more details.
// The default subject name strategy is TopicNameStrategy, which appends either `-key` or
// `-value` to a Kafka topic's name to create the subject name.
name: "email-updated-value"
};
// The ID of the user associated with this email address update.
string id = 1 [
// This must be a UUID as defined by RFC 4122.
//
// You can validate that this field is an ID using the
// [protovalidate](https://github.com/bufbuild/protovalidate) framework.
//
// See [StringRules](https://buf.build/bufbuild/protovalidate/docs/main:buf.validate#buf.validate.StringRules)
// for all possible builtin string validations.
(buf.validate.field).string.uuid = true
];
// The old email address.
string old_email_address = 2 [
// This must be a valid email address.
(buf.validate.field).string.email = true,
// This option says that empty values of this field are allowed, and to
// only enforce the email validation if this field is non-empty.
(buf.validate.field).ignore = IGNORE_IF_UNPOPULATED,
// When data quality enforcement is enabled, debug_redact fields can be optionally redacted
// on a per-topic basis when records are read by producers.
//
// This is generally used for sensitive fields.
debug_redact = true
];
// The new email address.
string new_email_address = 3 [
// This field is required. It will never be empty.
(buf.validate.field).required = true,
// This must be a valid email address.
(buf.validate.field).string.email = true
];
}