Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

"Unable to render this definition" error solutions not working #8586

Unanswered
celinehaddad asked this question in Q&A
Discussion options

Hey swagger team,

I need some help with implementing swagger-ui-react in my Next.js app. I found this issue thread #8245 to solve my initial error message ("SyntaxError: Cannot use import statement outside a module") but I tried this solution and I get this error:

Screen Shot 2023年04月21日 at 10 53 34 PM

I also noticed that when I change the spec file (was testing json and yml formats if it would behave differently- it doesn't), the spec file didn't change from json to yml based on what I specified..it just kept the first file I tried & I verified this in my console.log. SO, I tried a different solution I found in that issue thread to dynamically import swagger-ui-react, and that solved the "spec file not changing to what I define" issue. But, I still get the same exact error message as pictured above.

My spec file specifies "openapi": "3.0.2" at the top. I tested changing it to "3.0.1" & tested adding "swagger": "2.0" above the openapi version as well, but none of this worked & I still get that error message. I tested this out at https://editor.swagger.io/ & the UI of my openapi spec file renders perfectly.

Not sure what I need to do to get this working as my openapi spec meets the requirements of the error message. Any ideas?

You must be logged in to vote

Replies: 1 comment 6 replies

Comment options

Have you managed yo overcome this error?
I'm facing a similar one, and yet cannot find a solution to it

You must be logged in to vote
6 replies
Comment options

same here

Comment options

same here!

Comment options

As above

Comment options

Same here!!

Comment options

Also here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

AltStyle によって変換されたページ (->オリジナル) /