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

Swagger UI latest version support (3.17.3) #7966

Closed
abhinav910 opened this issue Jul 13, 2018 · 50 comments · Fixed by #10567
Closed

Swagger UI latest version support (3.17.3) #7966

abhinav910 opened this issue Jul 13, 2018 · 50 comments · Fixed by #10567
Labels
area: enhancement 🔧 $$ bug-bounty $$ https://www.jhipster.tech/bug-bounties/ status: good first issue $300 https://www.jhipster.tech/bug-bounties/
Milestone

Comments

@abhinav910
Copy link

Overview of the feature request

Swagger UI very old version (2.2.10) is used which does not provide the support for Open API

Motivation for or Use Case

Open API support

@pascalgrimaud
Copy link
Member

I don't remember well why we didn't upgrade but there was a reason.

Ping @cbornet as I'm pretty sure you know the answer :-)

@gmarziou
Copy link
Contributor

gmarziou commented Jul 13, 2018

Even if we updated swagger-ui to 3.17.3, I doubt you would get openapi support because it's not yet supported by Springfox.

@cbornet
Copy link
Member

cbornet commented Jul 13, 2018

Indeed, Springfox doesn’t support OpenAPI yet. We didn’t migrate to the new UI at the time because there was no easy way to pass the auth token. It seems there are solutions now. But do we want to move to the new UI ? I’m not sure I prefer it over the current one 😄

@deepu105
Copy link
Member

deepu105 commented Jul 13, 2018 via email

@PierreBesson
Copy link
Contributor

I am against migrating to swagger UI 3. The UI is awful and does not bring any new features (that I know of). I would rather move to ReDoc to provide API documentation (but the interactive querying is not possible yet).

In the end, we have something that work really well for now. So I'm not so keen on changing things and risk making things worse.

@jdubois
Copy link
Member

jdubois commented Jul 16, 2018

Following @PierreBesson advice, I'm closing the ticket

@jdubois jdubois closed this as completed Jul 16, 2018
@abhinav910
Copy link
Author

I guess @deepu105 already did some work for Swagger UI v3. The current UI does not provide the support for Open API json but v3 UI provides the support. I have checked both the version.

I thought jhispter always provide the support for latest version of components. My two cents.

@deepu105
Copy link
Member

@abhinav910 as @cbornet highlighted even if we update the UI lib it still wouldn't work since spring fox doesn't support it yet. I think we can do the upgrade once spring fox supports openAPI. Personally, I don't have any issue with the new UI, but it does lack some features compared to the old one.

And we would never support something just coz its new, it needs to be justified as well, in most cases new is better but sadly in this case, new UI doesn't even have some features from the old one

@cbornet
Copy link
Member

cbornet commented Jul 16, 2018

@abhinav910 Swagger UI is "just" the front-end part. The lib that generates the OpenAPI/Swagger spec is Springfox and it currently doesn't generate OAIv3 specs (see springfox/springfox#2124). As soon as springfox supports OAI, be sure that JHipster will do the upgrade. But for now there's no rush.
Also note that the "API first" option already works with OAIv3 specs.

@jdubois jdubois added this to the 5.2.0 milestone Aug 13, 2018
@deepu105 deepu105 reopened this Aug 23, 2018
@deepu105
Copy link
Member

I guess its time to do this as we have started to get the deprecation warning during yarn install

warning swagger-ui@2.2.10: No longer maintained, please upgrade to swagger-ui@3.

@PierreBesson
Copy link
Contributor

Personally, I still dislike Swagger UI v3. I would prefer to migrate to Redoc: https://github.com/Rebilly/ReDoc
Sadly it doesn't yet feature a "try it out" button.

@jdubois
Copy link
Member

jdubois commented Aug 24, 2018

@PierreBesson Redoc indeed looks cool, I didn't know about it. @cbornet you're the boss here, what do you think is best?

@deepu105
Copy link
Member

deepu105 commented Aug 24, 2018 via email

@cbornet
Copy link
Member

cbornet commented Aug 24, 2018

Yes, it's probably time to migrate. See swagger-api/swagger-ui#2915 (comment) for how to pass the auth token to swagger-ui.

@PierreBesson
Copy link
Contributor

OK let's do it. But we need to take the occasion to try to better integrate the swagger ui into the app (as an angular/react component). And we should make it optional to include it into the front-end assets.

@jdubois
Copy link
Member

jdubois commented Aug 24, 2018

Yes totally agree! @PierreBesson are you willing to do it? Who is interested?

@jdubois jdubois added the $100 https://www.jhipster.tech/bug-bounties/ label Aug 29, 2018
@jdubois
Copy link
Member

jdubois commented Aug 29, 2018

I'm adding a bug bounty on this ticket as I think it's important, and there's a significant amount of work

@deepu105
Copy link
Member

deepu105 commented Aug 29, 2018 via email

@murdos
Copy link
Contributor

murdos commented Nov 22, 2018

Have you considered using the springfox-swagger-ui maven dependency?
It still uses Swagger UI 2.x, but it will follow Springfox lifecyle and ability to handle OpenAPI.
And it should ease our task by not maintaining our own Swagger UI, no?

@deepu105
Copy link
Member

deepu105 commented Nov 22, 2018 via email

@deepu105 deepu105 modified the milestones: 5.2.0, 6.0.0 Mar 7, 2019
@DanielFran
Copy link
Member

@cbornet It seems that support for oas-3 is pratically done in https://github.com/springfox/springfox/tree/feature/2022/oas-3-support

@cbornet
Copy link
Member

cbornet commented Mar 9, 2019

Yes. That's for the backend part and will be part of Springfox 3. This issue is about swagger UI for which we can already migrate.

@cbornet
Copy link
Member

cbornet commented Aug 5, 2019

Also some configs of the swagger-ui needs to be retreived from the Springfox endpoints. See the current index.html about that.

@ecostanzi
Copy link
Contributor

ecostanzi commented Aug 5, 2019

I'd like to tackle this issue, any heads up on where to start?

You can take a look at this jhipster module: https://github.com/intesys/generator-jhipster-apiutils. Among other things it upgrades swagger UI to version 3 (see the index.js) and does some of the things that are required to work with springfox endpoints. However, this module has few things that are missing / have to be fixed: 1) It works only with JWT 2) uses jquery.

@flostadler
Copy link

Ok, thanks! I will give it a go

@DanielFran
Copy link
Member

And seems like Springfox 3.0 might be out soon: springfox/springfox#3070

@cbornet
Copy link
Member

cbornet commented Aug 6, 2019

Dilip is asking for help. Don't hesitate to participate. Springfox is a very well-written lib. You learn a lot by contributing to it.

@Hawkurane
Copy link
Contributor

Is anyone working on this? I would like to have a go at it :)
I have the UI displaying but am still working on passing the token to the swagger ui

@pascalgrimaud
Copy link
Member

go, it was opened for too long

@Hawkurane
Copy link
Contributor

@ecostanzi I've still submitted my branch as a PR so if you find anything interesting in my code we could try share point of views?

@ecostanzi
Copy link
Contributor

@Hawkurane let's focus on one PR (#10567) so that the reviewers know where to look at.

I'd keep PR #10567 (and close #10570) for the frontend part, since it already works for both frontends and fetches the list of specs from swagger resources.

Let's discuss here: #10567 (comment) wether to customize springfox configuration in jhipster-framework (jhipster/jhipster#425) or by using a new template in the generator. In the first case we'll have to keep both PRs open. WDYT?

@Hawkurane
Copy link
Contributor

Sure, let's do that. I've closed my front part PR :)

@jdubois jdubois added $300 https://www.jhipster.tech/bug-bounties/ and removed $200 https://www.jhipster.tech/bug-bounties/ labels Dec 3, 2019
@deepu105
Copy link
Member

We really need this as GitHub is now always giving a moderate sev security vulnerability for Swagger UI

image

@PierreBesson
Copy link
Contributor

PierreBesson commented Dec 16, 2019

Which is complete bullshit 😠 as using swagger ui v2 does not constitute a security vulnerability.
[EDIT] Apparently there are some vulnerabilities logged on swagger ui v2, https://snyk.io/test/npm/swagger-ui/2.2.10
But I fail to see how they can be meaningfully exploited as only the admin user will have the proper authentication to make requests to the backend.

@deepu105
Copy link
Member

deepu105 commented Dec 16, 2019 via email

@pascalgrimaud
Copy link
Member

@ecostanzi : don't forget to claim the bounty, it's well deserved

@DanielFran
Copy link
Member

DanielFran commented Dec 19, 2019

@econstanzi PR jhipster/jhipster#425 is still needed?

@pascalgrimaud
Copy link
Member

As I don't need it during my test, I don't think so @DanielFran

@ecostanzi
Copy link
Contributor

@DanielFran I think we can closed it, we postponed openapi security definitions for v7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: enhancement 🔧 $$ bug-bounty $$ https://www.jhipster.tech/bug-bounties/ status: good first issue $300 https://www.jhipster.tech/bug-bounties/
Projects
None yet
Development

Successfully merging a pull request may close this issue.