Open API Swagger UI causes JavaScript error and doesn't fully load

I just noticed that the SwaggerFeature is marked as obsolete so I’m trying out the OpenApiFeature but nothing is showing when I open up the Swagger UI now. What am I missing?

I’ve no idea what error you’re seeing from this description.

What exactly isn’t working? Did you navigate to the Swagger UI by clicking on the Swagger UI link on your /metadata page? It’s normally at /swagger-ui/

Is the Swagger UI HTML page being rendered at all or is it a blank page with no HTML output? are there any JS errors is the dev console? Does the /openapi endpoint return json or throw an error?

The Swagger UI is only showing the header.

/openapi returns a large json document.

Looks like we’re getting a javascript error at /swagger-ui

Error Log

Looks like an internal error from the Swagger JS Library when compiling their internal templates with handlebars js, I’ve never seen this error or warning before. Unfortunately the Swagger JS library isn’t something we have control over, if you can provide a repro I can inspect it to see if it’s the result of an earlier exception thrown that we do have some control over.

SelfHost1.zip (with OpenApiFeature)

This example is working without issue:

Since you’ve just swapped the old Swagger Feature with Open API I’d guess that your browser still has the old .js libraries cached which it’s trying to use instead.

Either try a hard refresh (e.g. Shift+F5) or disable your local cache in Web Inspector.

Sure as shoot! That did 'er! Thanks!

1 Like