-
Notifications
You must be signed in to change notification settings - Fork 66
feat(ws): fix swagger warnings and only generate json output #424
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
feat(ws): fix swagger warnings and only generate json output #424
Conversation
Signed-off-by: Liav Weiss (EXT-Nokia) <[email protected]>
There was a problem hiding this 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.
There was a problem hiding this 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:

By leveraging the extensions(...)
construct - this does render appropriately in the client:
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
@andyatmiami Regarding the 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. |
Signed-off-by: Liav Weiss (EXT-Nokia) <[email protected]>
c157f10
to
9a0bf3a
Compare
/ok-to-test |
Thanks @liavweiss and @andyatmiami /approve |
[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 |
…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]>
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.
This pr will not fix the "example" warning for this reason:
In
Swagger 2.0
example
should be withx-
example
, the issue is inswaggo/swag
recognize onlyexample()
in the documentation above each function, and it will generateexample:
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.