scottie1984 / swagger-ui-express

Adds middleware to your express app to serve the Swagger UI bound to your Swagger document. This acts as living documentation for your API hosted from within your app.
MIT License
1.41k stars 225 forks source link

Feat: Accept multiple Javascript and CSS imports #320

Closed ghost closed 5 months ago

ghost commented 1 year ago

For integrating a Swagger plugin I need to be able to include external Javascript. This works for exactly one because the SwaggerCustomOptions accept exactly one URL for external Javascript via the customJs property. If I want to use a second Swagger plugin or want to include other Javascript code there is no direct way without "hacking".

The constraint to only being able to import one external script, one external css and one inline script can be removed by accepting strings and arrays for the customJs, customJsStr and customCssUrl parameter and mapping them to the correct HTML tags.

I changed that in PR #319

scottie1984 commented 1 year ago

Thanks - have merged it in. Happy to take another PR with an update to the README to show an example.

Utopiah commented 5 months ago

Looks like it's working and documented, could probably close the issue.