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

add descriptions for services, methods, and fields #166

Merged
merged 3 commits into from Feb 14, 2022
Merged

Conversation

jhump
Copy link
Contributor

@jhump jhump commented Feb 14, 2022

The "descriptions" come in the form of proto source -- showing the service, method, and field in source form (though not necessary exactly as was present in the original source file, but close, including options and whatever comments are preserved in the descriptor).

  • Descriptions for the service and method are to the right of the selection drop-downs. They are hidden by default, to minimize the intrusiveness of this change for users that aren't interested in the information. It can be expanded via the arrow next to the service drop-down. Expanding it is "sticky" -- the preference will be remembered across visits.
  • Field descriptions are present in the form of tool-tips on the field names. So hovering over the field name will get you the same proto source for the field, including comments and options if present.

Still to do: descriptions for oneofs, message, and enum types. This could also be done as tool tips over type names and over the oneof name. However, much of the information is redundant -- oneofs and messages don't need to show their full body since all of the fields are already expanded in the web form. Enums could still show their full contents, as that is the only way for a user to see comments and options on particular enum values.

This supersedes #79 and #148.

- service, method are to the right of selection drop-downs and can be hidden
- field descriptions are tool-tips
- TODO: descriptions for oneofs, message, and enum types
@jhump
Copy link
Contributor Author

jhump commented Feb 14, 2022

Examples of what it looks like:


Service and method description

image


Field description in tool-tip

image

@@ -34,8 +80,7 @@

#grpc-request-response li.ui-tabs-tab {
border: 1px solid #ccc;
margin: 0;
margin-right: -1px;
margin: 0 -1px 0 0;
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 and the one below were cleanup suggested by my IDE.

@@ -174,7 +218,7 @@ table#grpc-request-metadata-form {

#grpc-request-form td {
padding: 16px 0 0 16px;
font-size: 13.2px;
font-size: 13px;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ditto, this and the change at the bottom were cleanup suggested by the IDE (due to not all browsers supporting fractional pixels).

<table class="grpc-desc">
<tr>
<td>
<table id="grpc-desc-selects">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I hate adding a nested table. But I played around with the layout quite a lot, and I could not figure out how to preserve the existing look without doing this. I tried floating divs and simpler tables with more divs inside and fewer table cells and no nesting. But I just couldn't figure out how to get the look and layout behavior I was aiming for without this.

@@ -110,8 +110,8 @@ github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/jhump/protoreflect v1.10.3/go.mod h1:7GcYQDdMU/O/BBrl/cX6PNHpXh6cenjd8pneu5yW7Tg=
github.com/jhump/protoreflect v1.10.4-0.20220210001327-6224817bacc5 h1:KIpt99Cgc9Vv3Hjbx/ke8ZQAzcH7AzM7/HxFCumGI7s=
github.com/jhump/protoreflect v1.10.4-0.20220210001327-6224817bacc5/go.mod h1:U7aMIjN0NWq9swDP7xDdoMfRHb35uiuTd3Z9nFXJf5E=
github.com/jhump/protoreflect v1.11.0 h1:bvACHUD1Ua/3VxY4aAMpItKMhhwbimlKFJKsLsVgDjU=
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 version includes a fix for printing methods: without it, comments on option statements were never included.

@jhump jhump merged commit d70ce5c into master Feb 14, 2022
@jhump jhump deleted the jh/comments-options branch February 14, 2022 15:46
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.

None yet

1 participant