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

docs(robot-server): Update GET /health response examples #14005

Merged
merged 2 commits into from
Nov 21, 2023

Conversation

SyntaxColoring
Copy link
Contributor

Overview

The HTTP API docs were showing an incomplete example for GET /health. (@y3rsh thanks for catching this.)

Test Plan

Run make -C robot-server dev and view https://localhost:31950/redoc#tag/Health/operation/get_health_health_get.

Changelog

  • Fix some fields, especially robot_type, not being shown in our GET /health example response on ReDoc. Before, after.
    • ReDoc normally keeps this stuff up to date automatically. The problem was that our Python code overrode the examples for the whole model instead of just for specific fields. This changes it to only override the examples for specific fields, so unmentioned fields will have their examples autogenerated, like we want.
  • Update the example values for name and robot_serial to show how they can be different. Otherwise, leave the existing example values in place.

Review requests

  • Are there any apparent downsides to defining the examples field-by-field like this?
  • There are a lot of other old endpoints that theoretically have this same problem. Searching robot-server for schema_extra is a good starting point. Do we want to ticket that, or just let it lie?

Risk assessment

Low.

@SyntaxColoring SyntaxColoring added robot-svcs Falls under the purview of the Robot Services squad (formerly CPX, Core Platform Experience). robot server Affects the `robot-server` project labels Nov 16, 2023
@SyntaxColoring SyntaxColoring requested review from ecormany and a team November 16, 2023 19:44
@SyntaxColoring SyntaxColoring requested a review from a team as a code owner November 16, 2023 19:44
Copy link
Contributor

@ecormany ecormany left a comment

Choose a reason for hiding this comment

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

Tested in the sandbox for this branch. Generally looks good, although I see this in the links entry at the bottom of the example:

  "links": {
    "apiLog": "/logs/api.log",
    "serialLog": "/logs/serial.log",
    "serverLog": "string",
    "oddLog": "string",
    "apiSpec": "/openapi.json",
    "systemTime": "/system/time"
  }
  1. Should there be an actual value for serverLog?
  2. Should oddLog be hidden or have a null value because this example is for an OT-2?

@SyntaxColoring
Copy link
Contributor Author

Should there be an actual value for serverLog?

Yes, thank you. Fixed for serverLog and oddLog.

Should oddLog be hidden or have a null value because this example is for an OT-2?

Yeahhh maybe. A downside of doing field-level examples like this is that the example sort of becomes an amalgamation. I think that's okay-ish in principle because it demonstrates all the fields that could exist, even if they won't necessarily exist together, but I acknowledge it's potentially confusing.

I'm going to leave it non-null for now.

Copy link
Contributor

@ecormany ecormany left a comment

Choose a reason for hiding this comment

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

Looks good with the new additions.

We can clear up the oddLog on OT-2 confusion later with either:

  • better documentation
  • rational behavior if you try to query the file at that path (valid blank file or a simple JSON object that says "OT-2 doesn't have a touchscreen" or what have you)

@SyntaxColoring SyntaxColoring merged commit a582169 into edge Nov 21, 2023
7 checks passed
@SyntaxColoring SyntaxColoring deleted the field_level_examples branch November 21, 2023 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
robot server Affects the `robot-server` project robot-svcs Falls under the purview of the Robot Services squad (formerly CPX, Core Platform Experience).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants