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: add more api specs #543

Merged
merged 3 commits into from
Dec 24, 2024
Merged

Conversation

IronCore864
Copy link
Contributor

@IronCore864 IronCore864 commented Dec 23, 2024

Adding more endpoints to the OpenAPI spec.

Refactor

  • Refactor existing endpoint parameter examples and remove them.
  • Refactor existing request body examples, but keep only one.
  • Refactor non-directly used component names as lowercase.
  • Reorder API groups according to pebble help output.

Style updates

  • Similar to hiding the input box for parameters, hide the select drop-down (because one newly added endpoint has an enum).

Newly added specs

  • /v1/system-info. The code is here, and the possible boot-id value is here.
  • /v1/health. The code is here.
  • /v1/changes, code is here.
  • /v1/changes/{id}, both GET and Post. Code: get, post.
  • /v1/services/{name}, not implemented in the code
  • /v1/checks, code.

Sorry for this big PR, but it's only logical::

  • /v1/system-info is more of a miscellaneous endpoint that doesn't belong to any group/tag.
  • Since /v1/health is another public API besides /v1/system-info, I included it as well, only to find out later that /v1/changes belongs to the same group so I included it in the same PR.
  • Since we already have some services and changes spec, to make the services and changes group/tag complete, I included other endpoints of the same group.

@IronCore864 IronCore864 requested a review from dwilding December 23, 2024 07:33
docs/specs/openapi.yaml Outdated Show resolved Hide resolved
docs/specs/openapi.yaml Outdated Show resolved Hide resolved
docs/specs/openapi.yaml Outdated Show resolved Hide resolved
docs/specs/openapi.yaml Outdated Show resolved Hide resolved
docs/specs/openapi.yaml Outdated Show resolved Hide resolved
docs/specs/openapi.yaml Outdated Show resolved Hide resolved
docs/specs/openapi.yaml Outdated Show resolved Hide resolved
docs/specs/openapi.yaml Outdated Show resolved Hide resolved
docs/specs/openapi.yaml Outdated Show resolved Hide resolved
docs/specs/openapi.yaml Outdated Show resolved Hide resolved
docs/specs/openapi.yaml Outdated Show resolved Hide resolved
docs/specs/openapi.yaml Outdated Show resolved Hide resolved
Copy link
Contributor

@dwilding dwilding left a comment

Choose a reason for hiding this comment

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

Thanks! Approving so that you can merge later. I've added specific questions/suggestions (see the comments) and I have a couple more thoughts:

  • For the two unsupported endpoints, I think it's best to exclude them from the doc if possible. To make it easier to navigate around the other endpoints

  • I'm a bit confused about GET /v1/health - Does this return a 200 response for healthy: true and healthy: false? From reading the code, it seems like the response for healthy: false is http.StatusBadGateway (code 502). Maybe I misunderstood, but don't we need two different responses for this endpoint?

@IronCore864
Copy link
Contributor Author

Thanks! Approving so that you can merge later. I've added specific questions/suggestions (see the comments) and I have a couple more thoughts:

  • For the two unsupported endpoints, I think it's best to exclude them from the doc if possible. To make it easier to navigate around the other endpoints

Removed.

  • I'm a bit confused about GET /v1/health - Does this return a 200 response for healthy: true and healthy: false? From reading the code, it seems like the response for healthy: false is http.StatusBadGateway (code 502). Maybe I misunderstood, but don't we need two different responses for this endpoint?

Yes, it's 200 when healthy is true and 502 when false. However, in a discussion with Ben earlier, we agreed to only show responses for 200 and not 4xx/5xx responses, which are shown at the beginning of the doc, so I have only one response/example here.

@IronCore864 IronCore864 marked this pull request as ready for review December 24, 2024 02:43
@IronCore864 IronCore864 merged commit b2c041c into canonical:master Dec 24, 2024
18 checks passed
@IronCore864 IronCore864 deleted the http-api-spec-1 branch December 24, 2024 02:55
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.

2 participants