Skip to content

Produce compile-time error on (required) set on an Empty field #146

@alexander-yevsyukov

Description

@alexander-yevsyukov

Such an option set on a field with the type google.protobuf.Empty should not compile because enclosing message could not be built using the generated validation code.

When checking for a filled in value, we compare the value with a default instance of a message, and the result would be always true.

This also should include implicitly required field such as IDs for command messages or entity states.

A similar error should be produced for repeated or map fields with Empty when (required) option is set. Such fields does not make much sense because they'd store just Empty's. But we still need to address this corner case.

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

Status
✅ Done

Relationships

None yet

Development

No branches or pull requests

Issue actions