stoicflame / enunciate

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

swagger ui is not working for enunciate versions above `2.16.0` #1196

Closed AlexandrSokolov closed 3 months ago

AlexandrSokolov commented 10 months ago

I've created a demo project: Module Single Module Project

(descrubed in another issue, the custom context root is used)

In pom.xml I configure enunciate version:

    <!-- https://mvnrepository.com/artifact/com.webcohesion.enunciate/enunciate-core-annotations -->
    <!-- https://mvnrepository.com/artifact/com.webcohesion.enunciate/enunciate-maven-plugin -->
    <enunciate.version>2.16.0</enunciate.version>

With that version when I build and run project as: mvn clean spring-boot:run The enunciate docs get generated under http://localhost:8080/custom/context/path/docs/index.html

Swagger ui is accessible via: http://localhost:8080/custom/context/path/docs/ui/index.html

Trying to update enunciate.version to any published versions, inlcuding 2.17.1, causes issues with swagger ui.

I cannot open it and in the browser console I get for swagger-ui-bundle.js:2:

Uncaught SyntaxError: Unexpected number

Checked in different browsers, Google Chrome, Chromium, Firefox. The issues exists everywhere.

I tried all the published versions above 2.16.0, only with 2.16.0 it works.

rzo1 commented 9 months ago

Also experienced this issue today.

mawiesne commented 9 months ago

Can confirm as well. Problem from dev tools (browser):

Uncaught SyntaxError: Unexpected number
swagger-initializer.js:23 Uncaught ReferenceError: SwaggerUIBundle is not defined
    at window.onload (swagger-initializer.js:23:3)
mawiesne commented 9 months ago

Confirmed working with version 2.16.0. All versions above run into this regression.

rzo1 commented 9 months ago

Seems to work with a 2.18.0-SNAPSHOT build from 1058944e1d7e33838dc91cd35e3469d00ce00f3d

stoicflame commented 9 months ago

Thanks y'all. Does anybody have a suggested fix?

I don't think I made any Swagger UI changes in the lastest snapshot, so I'm worried that the issue is still lingering.

rzo1 commented 9 months ago

Swagger was updated in the latest Snapshot: https://github.com/stoicflame/enunciate/commit/27dfbfc9133384027304df1b79a418f8a075ee4b

rzo1 commented 9 months ago

So I checked out the revision before the update e5c3c0aaefc034d31018b753595f85e737b7af3f and did a quick build + tested it with our app. This leads to

Uncaught SyntaxError: Unexpected number
swagger-initializer.js:23 Uncaught ReferenceError: SwaggerUIBundle is not defined
    at window.onload (swagger-initializer.js:23:3)

Next, I went ahead with the most recent commit https://github.com/stoicflame/enunciate/commit/1058944e1d7e33838dc91cd35e3469d00ce00f3d which includes the swagger ui update (https://github.com/stoicflame/enunciate/commit/27dfbfc9133384027304df1b79a418f8a075ee4b) and the issue is gone. The ui is (at least for our app) working as expected.

mrgmatthews commented 6 months ago

Uncaught SyntaxError: Unexpected number (at swagger-ui-bundle.js:2:831005) swagger-initializer.js:23 Uncaught ReferenceError: SwaggerUIBundle is not defined at window.onload (swagger-initializer.js:23:3)

agaengel commented 5 months ago

it would be great to have a release with a working swagger-ui again.

would It be possible to provide a config to provide a own swagger-ui zip to manage the version apart from enunciate ?

stoicflame commented 5 months ago

Yeah it's been awhile. I'll try to put together a new release with the latest fixes and updates.

FYI you actually can configure a "custom" base:

<enucnciate>
  <modules>
    <swagger base="/path/to/swagger-base.zip"/>
stoicflame commented 3 months ago

Enunciate 2.18.0 has been released.

Swagger UI 5.17.14 (the latest) is the version integrated into Enunciate 2.18.0.