SwaggerUI embedded in node.js app
See original GitHub issueQ&A
- OS: [macOS - 10.13.5]
- Browser: [chrome]
- Version: [66]
- Method of installation: [npm install -S swagger-ui]
- Swagger-UI version: [3.17.0]
- Node version: [8.11.2]
Content & configuration
Following is an extract from my Vue component script section
<script>
import SwaggerUI, { presets } from 'swagger-ui'
...
Following is an extract from my Vue component mounted function:
mounted: function () {
const ui = SwaggerUI({
url: "http://petstore.swagger.io/v2/swagger.json",
dom_id: '#swagger-ui',
layout: "StandaloneLayout",
presets: [presets.apis],
deepLinking: true
})
}
<div id="swagger-ui"/>
How can we help?
Hello, I am trying to embed swagger-ui in my SPA app (node.js, bootstrap, vue.js, bootstrap). When redering my page that includes the component described above, I get numerous warnings:
Warning: Failed prop type: Invalid prop `children` of type `array` supplied to `OperationTag`, expected a single ReactElement.
or
Warning: Failed prop type: Invalid prop `schema` of type `Immutable.Map` supplied to `Model`, expected `OrderedMap`
...
The installation section from the docs is very clear as well as the configuration one. Is there any project or url I could dig into to get a detailed example as well as some help for fixing this error?
The HTML rendering seems also to be pushed to the right (see attached screenshot), any suggestion on how to fix this?
Thanks a lot for your help,
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How to add Swagger UI to an existing Node.js and Express.js ...
In this tutorial, we'll be learning how to add swagger to an existing Node and Express.js. As we already learned in Part 1...
Read more >Adding Swagger To Existing Node.js Project | by Ivan Vasiljevic
A community driven package that adds a middleware to your Express.js application that serves the Swagger UI bound to your Swagger document.
Read more >How to embed Swagger UI into a webpage? - Stack Overflow
The answer depends on whether you have a plain web page you edit directly, or use a framework like Node.js or React. For...
Read more >The Easiest Way To Start Using Swagger in Node.js - Medium
The easiest way to start using swagger in your Node.js and Express API is to make use of Swagger UI Express. It allows...
Read more >Documenting your Express API with Swagger - LogRocket Blog
To connect Swagger to your Node.js application, import swagger-ui-express and swagger- ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@shockey thanks again! I disabled deeplinking and everything is back to normal.
Thanks for your help!
@jbguillois yeah, this is because enabling deep linking (
deepLinking: true
) indicates to Swagger UI that it can have control of the browser’s URL fragment.To fix this, you can either (a) reconfigure your application router to use an actual URL path instead of the fragment (in React Router, this would be moving from
HashRouter
toBrowserRouter
, not sure what it is in Vue), or (b) disable Swagger UI deep linking.