googleapis / googleapis/google-cloud-cpp

Reconsider whether the lack/addition of an explicit optional keyword indicates a change in field type

Open
#13,587 1 comment 0 reactions 0 assignees View on GitHub
cpp: generator cpp: operator type: cleanup
Dominant language
C++
Stars
659
Forks
462
Avg merge
1d 2h
Merged PRs (30d)
89

Description

When comparing the current generation of a proto file to the discovery document being parsed, in `DiscoveryTypeVertex::GetFieldNumber` we interrogate the existence of the `optional` keyword in the .proto file as a criteria as to whether or not we can reuse the field number. As these proto files use proto3 syntax, this check may be superfluous and fields with and without the `optional` keyword may be equivalent. This issue was motivated by protobuf deprecating `has_optional_keyword` in favor of `has_presence`. `has_presence` treats the fields as equivalent.

Contributor guide

Open the contributing guide

Research direction

Start by reading DiscoveryTypeVertex::GetFieldNumber and the comparison between the generated proto file and the discovery document. Check how proto3 fields with and without the optional keyword are treated, and compare that behavior with has_presence. Done means equivalent fields consistently reuse the existing field number when appropriate.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.