Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exposed more functions in FieldDescriptor and OneofDescriptor. #10102

Merged
merged 4 commits into from
Jun 13, 2022

Conversation

fiboknacky
Copy link
Contributor

@fiboknacky fiboknacky commented Jun 2, 2022

FieldDescriptor

  • Added support for getContainingOneof and getRealContainingOneof.
  • Added support for setting proto3 optional (internal only).
  • Remove the unused private var.

OneofDescriptor

  • Made isSynthetic work.

/**
* @return boolean
*/
public function hasOptionalKeyword()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should keep this function; it is useful.

You can implement it to match the C++ definition: http://google3/third_party/protobuf/descriptor.h;l=2387-2391;rcl=452188950

Copy link
Contributor Author

@fiboknacky fiboknacky Jun 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the C++ implementation needs to rely on many fields and functions that don't exist here yet. I'll leave this function to you. I may get back here once I implement other functions that I need for my feature.

Having said that, IMHO, it's a broken function (for a while). Leaving it like this doesn't provide any good unless we provide the correct implementation soon.

php/src/Google/Protobuf/FieldDescriptor.php Outdated Show resolved Hide resolved
php/src/Google/Protobuf/FieldDescriptor.php Outdated Show resolved Hide resolved
Comment on lines -251 to -252
$json_name = $proto->hasJsonName() ? $proto->getJsonName() :
lcfirst(implode('', array_map('ucwords', explode('_', $proto->getName()))));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is redundant with the if clause below.

@fiboknacky fiboknacky force-pushed the update-fielddescriptor branch 2 times, most recently from af2b22e to 88d57d4 Compare June 9, 2022 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants