Nested types
Nested types allow you to define messages inside of other messages.
syntax
=
"proto2"
;
message
Film
{
message
Character
{
string
name
=
1
;
int64
birth
=
2
;
}
string
title
=
1
;
string
director
=
2
;
string
producer
=
3
;
optional
string
release_date
=
4
;
repeated
Character
characters
=
5
;
}
In the example above, if Character needs to be used elsewhere it may be imported as follows:
message
OtherFilm
{
repeated
Film.Character
characters
=
1
;
}