mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 07:28:10 +00:00
chore(common): Add sanity checks for protobuf definitions.
This commit is contained in:
parent
9e5d5bd5f9
commit
f71af43874
@ -306,10 +306,20 @@ class Descriptor:
|
||||
comment = ""
|
||||
|
||||
if field.repeated:
|
||||
if field.default_value is not None:
|
||||
raise ValueError("Repeated fields can't have default values.")
|
||||
if field.experimental:
|
||||
raise ValueError("Repeated experimental fields are currently not supported.")
|
||||
flags = "p.FLAG_REPEATED"
|
||||
elif field.required:
|
||||
if field.default_value is not None:
|
||||
raise ValueError("Required fields can't have default values.")
|
||||
if field.experimental:
|
||||
raise ValueError("Required fields can't be experimental.")
|
||||
flags = "p.FLAG_REQUIRED"
|
||||
elif field.experimental:
|
||||
if field.default_value is not None:
|
||||
raise ValueError("Experimental fields can't have default values.")
|
||||
flags = "p.FLAG_EXPERIMENTAL"
|
||||
else:
|
||||
flags = field.default_value
|
||||
|
Loading…
Reference in New Issue
Block a user