Skip to content

Validate unset required fields in option values - #804

Open
emcfarlane wants to merge 2 commits into
mainfrom
ed/requiredLiteralFields
Open

emcfarlane wants to merge 2 commits into
mainfrom
ed/requiredLiteralFields

Conversation

@emcfarlane

@emcfarlane emcfarlane commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Adds validation for required fields on options:

message foo { required string a = 1; required string b = 2; }
extend google.protobuf.FileOptions { optional foo f = 20000; }

option (f) = { a: "a" };  // was: accepted; now: missing required fields: b
option (f).a = "a";       // was: accepted; protoc crashes; now: missing required fields: (f).b

This runs on the merged result of the final option value. This differs from protoc, raised an issue.

Ref protocolbuffers/protobuf#31344

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant