Skip to content

Conversation

liavweiss
Copy link

This fix has no GitHub issue and will fix this:
While you put our swagger yaml into https://editor.swagger.io/, you will get a few warnings popping up.
image

This pr will not fix the "example" warning for this reason:
In Swagger 2.0 example should be with x- example, the issue is in swaggo/swag recognize only example() in the documentation above each function, and it will generate example: in the yaml file.

Bottom line:
It works fine in Swagger UI, but causes errors in Swagger Editor, and I dont think it's a blocker in our project.

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.

Maybe slightly out of scope - but I feel we should change our Makefile to also leverage --outputTypes

I would suggest we go with: go,json - I see no reason to write out both json + yaml - and at least in the Swagger world - JSON feels like the more natural format to me... but could easily be talked into go,yaml with no further debate...

We probably don't really need the .go output - but I like the idea of having it should we ever need/want to mess with stuff programmatically.

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.

This is certainly an open discussion on whether or not we'd want to do this (and/or how important it is to adhere to Swagger 2.0 spec) - but if we really want to resolve the warnings about the example attribute - it seems we can do it as such:

image

By leveraging the extensions(...) construct - this does render appropriately in the client:
image

image

So, if I make a global search-and-replace on your branch - substituting example( with extensions(x-example=) - that then allows the generated JSON to "be clean" in the Swagger Editor

@liavweiss
Copy link
Author

@andyatmiami Regarding the x-example, you are right (Im sorry I don't know how I missed that) - will be fixed.

Regarding the swagg init output: I’ll drop the YAML output - since the tooling (including the auto type generation) works fine with JSON and we’re not relying on YAML for anything specific.
We can add it in the future if necessary.

@google-oss-prow google-oss-prow bot added size/L and removed size/M labels Jun 19, 2025
@liavweiss liavweiss force-pushed the bugfix-swagger/RHOAIENG-26425 branch from c157f10 to 9a0bf3a Compare June 19, 2025 11:18
@google-oss-prow google-oss-prow bot added size/XXL and removed size/L labels Jun 19, 2025
@andyatmiami
Copy link
Contributor

/ok-to-test

@andyatmiami
Copy link
Contributor

/lgtm

Verified now that the generated swagger.json file reports no errors when pasted into Swagger Editor

image

@google-oss-prow google-oss-prow bot added the lgtm label Jun 20, 2025
@thesuperzapper thesuperzapper changed the title feat(ws): Clean and fix swagger warnings and errors feat(ws): fix swagger warnings and only generate json output Jun 26, 2025
@thesuperzapper
Copy link
Member

Thanks @liavweiss and @andyatmiami

/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

@google-oss-prow google-oss-prow bot merged commit fcb5fc5 into kubeflow:notebooks-v2 Jun 26, 2025
14 checks passed
@github-project-automation github-project-automation bot moved this from Needs Triage to Done in Kubeflow Notebooks Jun 26, 2025
@liavweiss liavweiss deleted the bugfix-swagger/RHOAIENG-26425 branch August 28, 2025 12:22
bhaktinarvekar pushed a commit to bhaktinarvekar/notebooks that referenced this pull request Sep 14, 2025
…w#424)

* feat(ws): Clean and fix swagger warnings and errors

Signed-off-by: Liav Weiss (EXT-Nokia) <[email protected]>

* feat(ws): Clean and fix swagger warnings and errors

Signed-off-by: Liav Weiss (EXT-Nokia) <[email protected]>

---------

Signed-off-by: Liav Weiss (EXT-Nokia) <[email protected]>
Co-authored-by: Liav Weiss (EXT-Nokia) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants