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

Merged

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.

@github-project-automation github-project-automation bot moved this to Needs Triage in Kubeflow Notebooks Mar 17, 2025
@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
Contributor

@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
Contributor

@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
Contributor

@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.

Copy link
Member

@ederign ederign left a comment

Choose a reason for hiding this comment

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

A minor comment inside but I guess we are good merge this as incremental work. We need this to unblock generation of types on backend.

@google-oss-prow google-oss-prow bot added the lgtm label May 13, 2025
@ederign
Copy link
Member

ederign commented May 13, 2025

/lgtm

@thesuperzapper
Copy link
Member

/approve

Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: thesuperzapper

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

The pull request process is described 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

@thesuperzapper
Copy link
Member

/ok-to-test

@google-oss-prow google-oss-prow bot merged commit 45d778a into kubeflow:notebooks-v2 May 15, 2025
12 checks passed
@github-project-automation github-project-automation bot moved this from Needs Triage to Done in Kubeflow Notebooks May 15, 2025
Noa-limoy pushed a commit to Noa-limoy/notebooks that referenced this pull request May 18, 2025
…paces, and workspacekinds (kubeflow#235)

* Add Swagger Config

Signed-off-by: mohamed-ben-khemis <[email protected]>

* add swag command

Signed-off-by: mohamed-ben-khemis <[email protected]>

* Updated swagger output

Signed-off-by: mohamed-ben-khemis <[email protected]>

* Updated general annotations

Signed-off-by: mohamed-ben-khemis <[email protected]>

* Updated swagger docs version

Signed-off-by: mohamed-ben-khemis <[email protected]>

* updated swagger config

Signed-off-by: mohamed-ben-khemis <[email protected]>

* fix confilicts

Signed-off-by: mohamed-ben-khemis <[email protected]>

* Add GetNamespaces Swagger Docs

Signed-off-by: mohamed-ben-khemis <[email protected]>

* Add Workspaces Swagger Docs

Signed-off-by: mohamed-ben-khemis <[email protected]>

* Add Workspaces Swagger Docs

Signed-off-by: mohamed-ben-khemis <[email protected]>

* Add Workspacekinds Swagger Docs

Signed-off-by: mohamed-ben-khemis <[email protected]>

* fix: prevent Swagger from reading TODO comment by adding a tab

Signed-off-by: mohamed-ben-khemis <[email protected]>

* fix: resolve double api/v1 prefix in route paths

Signed-off-by: mohamed-ben-khemis <[email protected]>

---------

Signed-off-by: mohamed-ben-khemis <[email protected]>
mkoushni pushed a commit to mkoushni/notebooks that referenced this pull request May 28, 2025
…paces, and workspacekinds (kubeflow#235)

* Add Swagger Config

Signed-off-by: mohamed-ben-khemis <[email protected]>

* add swag command

Signed-off-by: mohamed-ben-khemis <[email protected]>

* Updated swagger output

Signed-off-by: mohamed-ben-khemis <[email protected]>

* Updated general annotations

Signed-off-by: mohamed-ben-khemis <[email protected]>

* Updated swagger docs version

Signed-off-by: mohamed-ben-khemis <[email protected]>

* updated swagger config

Signed-off-by: mohamed-ben-khemis <[email protected]>

* fix confilicts

Signed-off-by: mohamed-ben-khemis <[email protected]>

* Add GetNamespaces Swagger Docs

Signed-off-by: mohamed-ben-khemis <[email protected]>

* Add Workspaces Swagger Docs

Signed-off-by: mohamed-ben-khemis <[email protected]>

* Add Workspaces Swagger Docs

Signed-off-by: mohamed-ben-khemis <[email protected]>

* Add Workspacekinds Swagger Docs

Signed-off-by: mohamed-ben-khemis <[email protected]>

* fix: prevent Swagger from reading TODO comment by adding a tab

Signed-off-by: mohamed-ben-khemis <[email protected]>

* fix: resolve double api/v1 prefix in route paths

Signed-off-by: mohamed-ben-khemis <[email protected]>

---------

Signed-off-by: mohamed-ben-khemis <[email protected]>
Signed-off-by: CI Bot <[email protected]>
mkoushni pushed a commit to mkoushni/notebooks that referenced this pull request Jun 4, 2025
…paces, and workspacekinds (kubeflow#235)

* Add Swagger Config

Signed-off-by: mohamed-ben-khemis <[email protected]>

* add swag command

Signed-off-by: mohamed-ben-khemis <[email protected]>

* Updated swagger output

Signed-off-by: mohamed-ben-khemis <[email protected]>

* Updated general annotations

Signed-off-by: mohamed-ben-khemis <[email protected]>

* Updated swagger docs version

Signed-off-by: mohamed-ben-khemis <[email protected]>

* updated swagger config

Signed-off-by: mohamed-ben-khemis <[email protected]>

* fix confilicts

Signed-off-by: mohamed-ben-khemis <[email protected]>

* Add GetNamespaces Swagger Docs

Signed-off-by: mohamed-ben-khemis <[email protected]>

* Add Workspaces Swagger Docs

Signed-off-by: mohamed-ben-khemis <[email protected]>

* Add Workspaces Swagger Docs

Signed-off-by: mohamed-ben-khemis <[email protected]>

* Add Workspacekinds Swagger Docs

Signed-off-by: mohamed-ben-khemis <[email protected]>

* fix: prevent Swagger from reading TODO comment by adding a tab

Signed-off-by: mohamed-ben-khemis <[email protected]>

* fix: resolve double api/v1 prefix in route paths

Signed-off-by: mohamed-ben-khemis <[email protected]>

---------

Signed-off-by: mohamed-ben-khemis <[email protected]>
Signed-off-by: CI Bot <[email protected]>
andyatmiami pushed a commit to andyatmiami/kubeflow-notebooks that referenced this pull request Jun 13, 2025
…paces, and workspacekinds (kubeflow#235)

* Add Swagger Config

Signed-off-by: mohamed-ben-khemis <[email protected]>

* add swag command

Signed-off-by: mohamed-ben-khemis <[email protected]>

* Updated swagger output

Signed-off-by: mohamed-ben-khemis <[email protected]>

* Updated general annotations

Signed-off-by: mohamed-ben-khemis <[email protected]>

* Updated swagger docs version

Signed-off-by: mohamed-ben-khemis <[email protected]>

* updated swagger config

Signed-off-by: mohamed-ben-khemis <[email protected]>

* fix confilicts

Signed-off-by: mohamed-ben-khemis <[email protected]>

* Add GetNamespaces Swagger Docs

Signed-off-by: mohamed-ben-khemis <[email protected]>

* Add Workspaces Swagger Docs

Signed-off-by: mohamed-ben-khemis <[email protected]>

* Add Workspaces Swagger Docs

Signed-off-by: mohamed-ben-khemis <[email protected]>

* Add Workspacekinds Swagger Docs

Signed-off-by: mohamed-ben-khemis <[email protected]>

* fix: prevent Swagger from reading TODO comment by adding a tab

Signed-off-by: mohamed-ben-khemis <[email protected]>

* fix: resolve double api/v1 prefix in route paths

Signed-off-by: mohamed-ben-khemis <[email protected]>

---------

Signed-off-by: mohamed-ben-khemis <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

4 participants