-
Notifications
You must be signed in to change notification settings - Fork 501
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
[Proposal] Update API template #7709
Conversation
Updates the API template to allow for more dynamic formatting. Signed-off-by: Naarcha-AWS <[email protected]>
Thank you for submitting your PR. The PR states are In progress (or Draft) -> Tech review -> Doc review -> Editorial review -> Merged. Before you submit your PR for doc review, make sure the content is technically accurate. If you need help finding a tech reviewer, tag a maintainer. When you're ready for doc review, tag the assignee of this PR. The doc reviewer may push edits to the PR directly or leave comments and editorial suggestions for you to address (let us know in a comment if you have a preference). The doc reviewer will arrange for an editorial review. |
Overall, I don't see much value in doing this. This will require changing many files and is clear as is.
Don't particularly have an opinion on this one but I think it breaks the flow when this is in the middle.
Data type is a standard CS concept. Boolean is a data type https://en.wikipedia.org/wiki/Boolean_data_type.
"Options" is not standard language. There is no mention of the word "options" at the provided link. Maybe, to clarify further, we can name this "Request body fields".
Options imply the ability to change. There are no options that users can change in the response. The response contains the fields that come from the server.
We already have some pages that have multiple examples. For example, https://opensearch.org/docs/latest/api-reference/index-apis/force-merge/. We normally clarify the example type in the heading like "Example request: Force merge multiple indexes". These are self-explanatory, I think. Changing from H4 to H2 will make them visible in the right navigation, which is not ideal, given that if you clarify the example type within the header, the header becomes long. |
As a general note, most of the APIs on our site do not use the template. Here are some examples:
Discussing this while the majority of the API content gaps I'm closing are still in review makes sense to me. Whether we change the template or not, we'll still have to go through and standardize to the template across the board. Responding to your other comments:
That's fine by me.
Noted, does "Response body fields?" work for you?
This is the change I feel most passionately about. Its a bad user experience to bury the examples/example responses under a header that's inaccessible from the right nav. For an example of this, see the Force Merge page. Not only does a header for the example requests not exist, but I have to scroll all the way down to see a copyable example. Having the examples directly accessible in the right navigation allows me to use the reference how I see fit. Instead of scrolling, I can click on the example that most pertains to me from the right nav and copy it immediately, like on the https://opensearch.org/docs/latest/api-reference/render-template/ page. Furthermore, the example request and example response should have a clearer delineation between the two. Using Force Merge again, the response blends in with the examples, so it's not immediately clear that I'm looking at a Response Body visually. As far as the header length is concerned, we shouldn't be making headers that are sentence-length anyways, even as H4-level headers. Giving both the Example request and Example response an H2 Header removes the need to prepend the H4 header with "Example response:" greatly reducing the length of the header to begin with. There are multiple ways I'm okay changing this though:
Thoughts? Both of those solutions solve the usability issue I described. |
@Naarcha-AWS "Response body fields" works for me and matches "Request body fields". I'm also fine with the example you gave in the Render Template API. Less of a fan of the Multi-search API. I like "Example request" (singular) and "Example response" and the various types within the "Example request". This separates them a little more. Note that implementing this for all API pages is not a simple find/replace and is best done with a regex and a script. |
BTW, this probably should have been an issue and not a PR 😄 |
Signed-off-by: Naarcha-AWS <[email protected]>
Signed-off-by: Naarcha-AWS <[email protected]>
Signed-off-by: Naarcha-AWS <[email protected]>
@kolchfa-aws: I implemented the changes we agreed on. Let me know if there's anything else you would like to adjust or discuss. |
@Naarcha-AWS Please revert Type back to Data type. As explained, "data type" is a common CS concept and should be kept as is to avoid confusion. https://en.wikipedia.org/wiki/Data_type |
Also, I see you switched the "Example response" and "Response fields" sections. I think this is worse than the current order because when users see an example request, they expect that the example response is right after. Then they can explore the response fields in the "Response fields" section. |
I don't personally think it makes much of a difference, although I find it a little odd to see the response fields after as opposed to before. That being said, ok switching this back. |
Signed-off-by: Naarcha-AWS <[email protected]>
Signed-off-by: Naarcha-AWS <[email protected]>
@kolchfa-aws: Fixed the order and added back Data Type, per your request. Once you sign off, I can go ahead and make sure the pages follow the template |
If there are multiple example requests, there should be an intro sentence before the first h3 to avoid stacked headings. Do you want to provide that intro sentence so it's standardized? I think we should change all API files to follow the new template in this PR to ensure consistency. |
Is it worth doing now, or should we wait until after we have full coverage? I'm in favor of waiting until we have full coverage, unless the changes are minimal. |
I would just change the heading level 4 in Example request/Example response headings to heading level 2. The other changes provide minimal value and require more work. Just changing a heading level is trivial. |
Something along the lines, "The following example request shows _____"? |
Signed-off-by: Naarcha-AWS <[email protected]>
Signed-off-by: Archer <[email protected]>
Signed-off-by: Archer <[email protected]>
Signed-off-by: Archer <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* [Proposal] Update API template Updates the API template to allow for more dynamic formatting. Signed-off-by: Naarcha-AWS <[email protected]> * Apply suggestions from code review Signed-off-by: Naarcha-AWS <[email protected]> * Update API_TEMPLATE.md Signed-off-by: Naarcha-AWS <[email protected]> * Apply suggestions from code review Signed-off-by: Naarcha-AWS <[email protected]> * Apply suggestions from code review Signed-off-by: Naarcha-AWS <[email protected]> * Update API_TEMPLATE.md Signed-off-by: Naarcha-AWS <[email protected]> * Add H3 level examples. Signed-off-by: Naarcha-AWS <[email protected]> * Make APIs conform to template Signed-off-by: Archer <[email protected]> * Fix cluster API templates Signed-off-by: Archer <[email protected]> * Fix link Signed-off-by: Archer <[email protected]> --------- Signed-off-by: Naarcha-AWS <[email protected]> Signed-off-by: Archer <[email protected]> (cherry picked from commit 279237d) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* [Proposal] Update API template Updates the API template to allow for more dynamic formatting. Signed-off-by: Naarcha-AWS <[email protected]> * Apply suggestions from code review Signed-off-by: Naarcha-AWS <[email protected]> * Update API_TEMPLATE.md Signed-off-by: Naarcha-AWS <[email protected]> * Apply suggestions from code review Signed-off-by: Naarcha-AWS <[email protected]> * Apply suggestions from code review Signed-off-by: Naarcha-AWS <[email protected]> * Update API_TEMPLATE.md Signed-off-by: Naarcha-AWS <[email protected]> * Add H3 level examples. Signed-off-by: Naarcha-AWS <[email protected]> * Make APIs conform to template Signed-off-by: Archer <[email protected]> * Fix cluster API templates Signed-off-by: Archer <[email protected]> * Fix link Signed-off-by: Archer <[email protected]> --------- Signed-off-by: Naarcha-AWS <[email protected]> Signed-off-by: Archer <[email protected]> Signed-off-by: Sander van de Geijn <[email protected]>
As I've closing the additional API content gaps, there are a few scenarios I've encountered that the current API template does not account for, such as multiple examples or when additional complex descriptions are required such as the Rollover API. Therefore, I would like to propose the following changes to the API template:
Version
All.
Checklist
For more information on following Developer Certificate of Origin and signing off your commits, please check here.