Load swagger ui from `swagger-ui` package instead.

Added option `swaggerDistRoot` for specific file overrides.

Conflicts:
	README.md
	example/simple.js
	index.js
	package.json
	public/css/screen.css
	public/images/logo_small.png
	public/index.html
	public/lib/loadSwaggerUI.js
This commit is contained in:
Samuel Reed 2014-07-04 14:28:47 -05:00 committed by Shelby Sanders
parent 28d293b6f9
commit 86d79584f9
9 changed files with 18 additions and 1680 deletions

View File

@ -96,3 +96,16 @@ Options are passed to `explorer(app, options)`.
> Default: Read from package.json
> Sets your API version. If not present, will read from your app's package.json.
=======
> Set the base path for swagger resources.
> Default: `app.get('restAPIRoot')` or `/swagger/resources`.
`swaggerDistRoot`: **String**
> Set a path within your application for overriding Swagger UI files.
> If present, will search `swaggerDistRoot` first when attempting to load Swagger UI, allowing
you to pick and choose overrides.
> See [index.html](public/index.html), where you may want to begin your overrides.
> The rest of the UI is provided by [Swagger UI](https://github.com/wordnik/swagger-ui).

View File

@ -1,4 +1,4 @@
'use strict';
'use strict';
/*!
* Adds dynamically-updated docs as /explorer
*/
@ -8,7 +8,7 @@ var urlJoin = require('./lib/url-join');
var _defaults = require('lodash.defaults');
var express = require('express');
var swagger = require('./lib/swagger');
var SWAGGER_UI_ROOT = path.join(__dirname, 'node_modules',
var SWAGGER_UI_ROOT = path.join(__dirname, 'node_modules',
'swagger-ui', 'dist');
var STATIC_ROOT = path.join(__dirname, 'public');
@ -61,4 +61,4 @@ function explorer(loopbackApplication, options) {
app.use(express.static(SWAGGER_UI_ROOT));
return app;
}
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 770 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

View File

@ -4,8 +4,8 @@
/*global SwaggerUi, log, ApiKeyAuthorization, hljs, window, $ */
$(function() {
$.getJSON('config.json', function(config) {
log(config);
loadSwaggerUi(config);
log(config);
loadSwaggerUi(config);
});
var accessToken;