rynam0 / ember-swagger-ui Goto Github PK
View Code? Open in Web Editor NEWAn Ember addon for quickly and easily adding a swagger-ui to your Ember App.
Home Page: http://rynam0.github.io/ember-swagger-ui/
License: MIT License
An Ember addon for quickly and easily adding a swagger-ui to your Ember App.
Home Page: http://rynam0.github.io/ember-swagger-ui/
License: MIT License
Test coverage is needed. The auto-generated "it renders" tests are not enough.
swagger-ui depends on jquery-1.8.0 due to its dependency on the jquery.ba-bbq plugin. This plugin makes use of jquery APIs that have been removed in jquery-1.9+ (
Is there a way to re-render the swagger-ui component based on changing the swagger.json url or in-memory swagger JSON object? I'm trying to make a single swagger-ui page that can point to different swagger JSON specifications.
Is there a way to re-call _initSwaggerUi
when the controller's url or JSON swagger object changes? At least I think that's what I'm asking. Here's an example of something I'm interested in.
// app/controllers/some-swagger-controller
export default Ember.Controller.extend({
// value that will be passed to the swagger-ui component
swaggerUrl: 'https://petstore.swagger.io/v2/swagger.json',
actions: {
updateUrl(newUrl) {
this.set('swaggerUrl', newUrl);
}
}
})
Configuration options documented on the swagger-ui repo should be made available to consuming apps by the component.
It seems consuming apps will want to be able to create their own elements inside the component (custom header, footer, etc.) Currently the default layout (swagger-ui/dist/index.html) is used as the component template and a yield has not been added.
The OAuth flow isn't currently working.
The dialog is written to document.body by swagger-oauth.js and therefore does not get the correct styling. This also means that the element won't get torn down w/ the component.
The dialog also tries to redirect to o2c.html. Will have to investigate how this can be supported (would it be enough for the addon to simply make this file available?)
Is there any way we can eliminate the bower dependency? It is obsolete and Ember no longer uses it.
Getting ENOENT due to missing resources hardcoded in ember-swagger-ui's build. For example, these fonts do not exist in swagger-ui 2.1.4.
The folder structure seems to be the same, so maybe the lib can do something like cp path/to/fonts/* dist/fonts/
?
Doesn't work with ember 2.10.0
Uncaught TypeError: Cannot create property 'default' on boolean 'true'
at new module.exports (vendor.js:84168)
at vendor.js:81201
at arrayEach (vendor.js:91925)
at Object.forEach (vendor.js:93258)
at vendor.js:81180
at vendor.js:93140
at baseForOwn (vendor.js:92345)
at vendor.js:93105
at Object.forEach (vendor.js:93259)
at module.exports.SwaggerClient.buildFromSpec (vendor.js:81174)
https://github.com/deanmraz/ember-swagger-demo
https://github.com/deanmraz/ember-swagger-demo/blob/master/app/templates/index.hbs
@rynam0 I was hoping you can point me in the right direction to fix this. Let me know if you have any suggestions.
First off, I'm really happy to discover this addon. swagger-ui leaves something to be desired in SPA-land. This is a handy integration I didn't want to bootstrap myself. Thank you!
I'm having trouble with swagger-ui.js#L69-L73:
// and remove href links that will also attempt to route us out of our known ember routes
let anchors = that.$('#resources_container a');
if (anchors) {
anchors.removeAttr('href');
}
This makes external links unclickable. Can't have the whole world in my Ember app :). I'm missing its original intent. I've deleted it in my fork, but I don't think that's the answer. Could you explain your code comment more?
Can you restore links? Or warn if they'll route you outside the app? Or make it configurable? (Not that swagger-ui needs yet another input param.)
I'm getting Uncaught TypeError: Cannot read property 'type' of undefined
on a fresh install of the ember-swagger-ui addon. The top of the console error log points to bower_components/swagger-ui/dist/swagger-ui.js:253.
Here are the steps I took.
ember new ember-swag
cd ember-swag
# update bower.json file
# ember to 2.2.0
# ember-data to 2.2.0
# jquery to 2.1.x
bower install # update dependencies
ember install ember-swagger-ui
npm install
# update security policy in config/environment
ember s
# navigate to localhost:4200
Security Policy
contentSecurityPolicy: {
'default-src': "'none'",
'script-src': "'self' 'unsafe-inline' 'unsafe-eval' use.typekit.net",
'font-src': "'self' data: use.typekit.net",
'connect-src': "'self' *",
'img-src': "'self' www.facebook.com p.typekit.net",
'style-src': "'self' 'unsafe-inline' use.typekit.net"
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.