stoicflame / enunciate

Build-time enhancement tool for Java-based Web services projects
http://enunciate.webcohesion.com/
Other
480 stars 200 forks source link

Swagger UI defaulting to openapi.json now or Petstore #1185

Closed jdimeo closed 1 month ago

jdimeo commented 9 months ago

Hello! When I updated to the latest release, the Swagger UI still tries to load swagger.json but the generated file is now apparently openapi.json, leading to an error. When I updated to the latest Swagger UI, it loads Petstore, and neither swagger.json or openapi.json.

I looked through the docs but couldn't figure out where to specify the url in the Swagger initial config to point it to the correct file. Am I missing something? thanks!

stoicflame commented 9 months ago

Hi. Thanks for the report.

I'm not seeing what you're seeing. The latest release clearly references opanapi.json and not swagger.json. I've also confirmed this with the enunciate-sample app.

Maybe your project is configured with a custom swagger base that overrides the default one Enunciate uses?

jdimeo commented 9 months ago

thank you! Yes. I'm using the latest UI from Swagger since the built in one is still 2.x (right?) Is there any way to configure this when using a different base? I'm lost on how to get it to stop using Petstore

jdimeo commented 9 months ago

Wait, since that code you linked references swagger-initializer.js I think that is newer than 2.x ? so maybe it's just the docs that are out of date? image

jdimeo commented 9 months ago

OK sorry for the spam, but I think we can distill this down to two requests:

Thank you so much!

fhm84 commented 8 months ago

@stoicflame sorry, I missed to link my PR to this ticket. Here a PR for updating swagger-ui to (latest) version v5.9.1: https://github.com/stoicflame/enunciate/pull/1189

stoicflame commented 1 month ago

Okay at 47e93bd3ec22f5bb7e2e3e3871e8ee2450308cb9 I updated to the latest Swagger UI (5.17.14).

It's not viable for Enunciate to maintain support for both the "old" swagger.json and the (new) openapi.json at the same time. If you need to maintain the old Swagger UI you can revert to an older Enunciate version.

However, at f7c3d8c4a2bd89f55af8cf089683b4862e67abbf I did overwrite swagger-initializer.js with an Enunciate-specific one so that custom Swagger bases will still be integrated into the Enunciate-generated file structure.

stoicflame commented 3 weeks ago

Enunciate 2.18.0 has been released.

jdimeo commented 3 weeks ago

Thank you so much @stoicflame ! I always brag about how nice it is to build REST APIs in Java and Enunciate scraping Javadocs is a big part of that.