Skip to content

feat(ws): complete api swagger documentation across workspaces, namespaces, and workspacekinds #235

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

Open
wants to merge 13 commits into
base: notebooks-v2
Choose a base branch
from

Conversation

Mohamed-ben-khemis
Copy link

Closes #46

Summary

This PR continues the Swagger integration by adding complete Swagger documentation for all API endpoints.

Changes Implemented

  • Complete API Documentation: Added Swagger annotations for:
    • Health Check endpoint
    • Namespaces endpoint
    • Workspaces (list, get, create, delete) endpoints
    • WorkspaceKinds (list, get) endpoints
  • Structured and Consistent Annotations: Ensured proper formatting using tab-indented docstrings to comply with gofmt.
  • Documentation Output: Swagger JSON/YAML is generated consistently and served via /api/v1/swagger/index.html.

Notes

  • Builds on top of the previous Swagger setup PR (#206).
  • This brings full API coverage to the Swagger UI and facilitates interactive testing and easier onboarding for developers.

Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign kimwnasptd for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Mohamed-ben-khemis Mohamed-ben-khemis changed the title Complete API Swagger Documentation Across Workspaces, Namespaces, and WorkspaceKinds feat(ws): complete api swagger documentation across workspaces, namespaces, and workspacekinds Mar 17, 2025
@ederign
Copy link
Member

ederign commented Mar 17, 2025

/assign @ederign

Copy link

@andyatmiami andyatmiami left a comment

Choose a reason for hiding this comment

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

workspace-kinds is not a valid URL segment - will result in 404. value should be workspacekinds

  • additionally api/v1 segment appears 2x

image

vs.

$ curl --request GET   --url http://localhost:4000/api/v1/workspacekinds -I
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Content-Type: application/json
Date: Fri, 02 May 2025 20:36:32 GMT
Transfer-Encoding: chunked

Copy link

@andyatmiami: changing LGTM is restricted to collaborators

In response to this:

workspace-kinds is not a valid URL segment - will result in 404. value should be workspacekinds

image

vs.

$ curl --request GET   --url http://localhost:4000/api/v1/workspacekinds -I
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Content-Type: application/json
Date: Fri, 02 May 2025 20:36:32 GMT
Transfer-Encoding: chunked

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link

@andyatmiami andyatmiami left a comment

Choose a reason for hiding this comment

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

Looks like the workspaces path is mangled... api/v1 appears 2x

image

vs.

$ curl --request GET   --url http://localhost:4000/api/v1/workspaces -I
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Content-Type: application/json
Date: Fri, 02 May 2025 20:39:51 GMT
Transfer-Encoding: chunked

Copy link

@andyatmiami: changing LGTM is restricted to collaborators

In response to this:

Looks like the workspaces path is manged... api/v1 appears 2x

image

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Signed-off-by: mohamed-ben-khemis <[email protected]>
Signed-off-by: mohamed-ben-khemis <[email protected]>
Signed-off-by: mohamed-ben-khemis <[email protected]>
Signed-off-by: mohamed-ben-khemis <[email protected]>
Signed-off-by: mohamed-ben-khemis <[email protected]>
Signed-off-by: mohamed-ben-khemis <[email protected]>
Signed-off-by: mohamed-ben-khemis <[email protected]>
Signed-off-by: mohamed-ben-khemis <[email protected]>
Signed-off-by: mohamed-ben-khemis <[email protected]>
Signed-off-by: mohamed-ben-khemis <[email protected]>
Signed-off-by: mohamed-ben-khemis <[email protected]>
@Mohamed-ben-khemis
Copy link
Author

Looks like the workspaces path is mangled... api/v1 appears 2x

image

vs.

$ curl --request GET   --url http://localhost:4000/api/v1/workspaces -I
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Content-Type: application/json
Date: Fri, 02 May 2025 20:39:51 GMT
Transfer-Encoding: chunked

Hi @andyatmiami, thanks for testing it out! 🙏

I’ve pushed a tiny update that resolves both of the problems you spotted:

Removed the hyphen in the WorkspaceKinds route (changed workspace‑kinds → workspacekinds) so it no longer 404s (Swagger treats path segments literally).

Eliminated the duplicate /api/v1 prefix by relying solely on swagger.SwaggerInfo.BasePath = "/api/v1" in docs.go, and dropping /api/v1 from each @router annotation.

Copy link

@andyatmiami andyatmiami left a comment

Choose a reason for hiding this comment

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

Verified all endpoints are operational within the Swagger UI.

image image image image image image image image image

Copy link

@andyatmiami: changing LGTM is restricted to collaborators

In response to this:

Verified all endpoints are operational within the Swagger UI.

image image image image image image image image image

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Needs Triage
Development

Successfully merging this pull request may close these issues.

3 participants