Commit Graph

37 Commits

Author SHA1 Message Date
Diana Lau 45b51a7205 update README for LTS status 2019-05-03 10:28:36 -04:00
Miroslav Bajtoš 02cfb554ee
Prevent accidental upgrades to swagger-ui v3+ 2019-02-05 10:06:41 +01:00
Miroslav Bajtoš 87dec34709
Update eslint & config to latest major versions 2019-02-05 08:57:18 +01:00
Jonathan Prince 09bf982a21
Fix config.json URL when running from /index.html 2018-09-14 15:51:06 +02:00
Hiran del Castillo fc43ff6e63
[SEMVER-MAJOR] Remove deprecated CORS support
It's the responsibility of the applications using API Explorer
to configure an app-wide CORS middleware.
2018-04-17 15:47:29 +02:00
Miroslav Bajtoš 62a46a0344
feat: rebuild swagger after a model was deleted 2018-04-17 10:12:55 +02:00
Raymond Feng c17252e99a Refresh swagger on remoteMethodAdded
See https://github.com/strongloop/loopback-component-explorer/pull/208
2017-09-15 10:44:45 -07:00
emckean 7042509116
Change Explorer header to use LoopBack
Replace StrongLoop name with LoopBack name for branding purposes.
2017-03-24 10:24:06 +01:00
Richard Pringle b5ad2e06c8 Use new api for disabling a remote method. 2016-09-22 13:36:48 -04:00
Miroslav Bajtoš 6e288a991c Fix tests to not depend on exact EOL chars
Fix the tests to not check for EOL character(s) in the response body,
in order to fix tests failing on Windows.
2016-09-22 14:50:01 +02:00
Miroslav Bajtoš d78f1344e2 Deprecate built-in CORS middleware
Push the responsibility of enabling/configuring CORS back to the
application developer.
2016-09-21 11:08:49 +02:00
jannyHou 96c454226a Redirect get http 301 instead of 303 2016-06-22 11:49:29 -04:00
Supasate Choochaisri 702117dbea Add blank lines to separate error-checking and done logic from other logic
Signed-off-by: Supasate Choochaisri <supasate.c@gmail.com>
2016-05-06 21:48:38 +07:00
Supasate Choochaisri c3fe27a5fe Ignore copyright in dummy swagger-ui test
Signed-off-by: Supasate Choochaisri <supasate.c@gmail.com>
2016-05-06 21:46:02 +07:00
Ryan Graham cb6eafd592
update copyright notices and license 2016-05-05 17:10:55 -07:00
Supasate Choochaisri ff60f8bf91 Add feature to hide disabled remote methods after explorer is initialized
Signed-off-by: Supasate Choochaisri <supasate.c@gmail.com>
2016-04-30 04:08:17 +07:00
Amir Jafarian c923710ce2 Fix linting errors 2016-04-22 17:18:04 -04:00
Amir Jafarian 2987655479 Auto-update by eslint --fix 2016-04-22 17:09:48 -04:00
Raymond Feng 63f446511d Add `swaggerUI` option to enable/disable UI serving 2016-03-08 10:13:08 -08:00
Pradeep Kumar Tippa 2186b69885 Update swaggerObject when a new model was added
Listen for loopback app's event "modelRemoted" to detect when a new
model was added, and re-run "createSwaggerObject" to get an updated
version.
2016-01-05 10:45:11 +01:00
Rand McKinney 8dae3c7330 Rename the module to loopback-component-explorer 2015-09-17 10:54:02 +02:00
Miroslav Bajtoš 42b9f2d7c0 Use loopback-swagger to generate swagger.json 2015-09-03 10:37:09 +02:00
Miroslav Bajtoš e75d8bb353 Merge pull request #117 from hacksparrow/feature/register-self
Register loopback-explorer to app
2015-08-31 10:58:43 +02:00
Hage Yaapa e509dabf21 Register loopback-explorer to app
This patch registers loopback-explorer to the app object with its
options, making its mountPath property available at
app.get('loopback-explorer').
2015-08-28 23:52:04 +05:30
Miroslav Bajtoš 0b17811546 Generate Swagger Spec 2.0 documentation
Notable breaking changes:

- The swagger output is a single object (JSON response) served
  at /explorer/swagger.json

- Methods with a single return arg without "root:true" flag
  are expected to produce an object response with a single property now,
  i.e. `{ data: arg }`.
  In v1.x, we were treating such arg as if "root:true" was specified.
  The new behaviour matches the actual implementation in strong-remoting.

- The property constraint "length" is translated to "maxLength" now.

- `operationId` includes model name now, because ids must be unique

- X-Forwarded-* headers are no longer processed, Swagger Spec 2.0
  has a way how to specify "use the scheme + host where the doc is served"

- opts.omitProtocolInBaseUrl was removed for the same reasons as
  X-Forwarded-* headers

- The deprecated opts.swaggerDistRoot was removed.
2015-08-21 18:55:32 +02:00
Miroslav Bajtoš 7ee8703ff5 Rework the module to a loopback component
Rework the exported function to conform to the component convention:

    var loopback = require('loopback');
    var explorer = require('loopback-explorer');
    var app = loopback();
    explorer(app, options);

Allow users to mount explorer as a middleware too:

    app.use('/explorer', explorer.routes(app, options));

- drop dependency on express
- drop support for loopback 1.x
- add a new option "mountPath" to specify where to mount the explorer UI
  and swagger metadata
- describe upgrading from v1.x in README
2015-08-10 16:51:03 +02:00
Pradnya Baviskar 297086fb55 Fix explorer tests for different line endings on Windows 2015-02-27 15:20:10 +05:30
Miroslav Bajtoš c6693f8725 Prevent double slash in the resource URLs
SwaggerUI builds resource URL by concatenating basePath + resourcePath.
Since the resource paths are always startign with a slash, if the
basePath ends with a slash too, an incorrect URL is produced.
This was typically happenning when `restApiRoot` was '/'.

This commit modifies the code producing the base path to remove
the trailing slash.
2015-01-09 14:45:46 +01:00
Simon Ho e825c4b49f Allow `uiDirs` to be defined as a String 2014-12-31 13:49:06 -08:00
Miroslav Bajtoš 2ec096a278 Add an option `uiDirs`
The `uiDirs` option allows users to provide their own set of directories
with UI files, e.g. to provide a custom swagger-ui fork and a custom
set of style/font overrides:

    explorer(app, {
      uiDirs: [
        path.resolve(__dirname, 'public'),
        path.resolve(__dirname, 'node_modules', 'swagger-ui')
      ]
    });

The existing option `swaggerDistRoot` is deprecated now.
2014-10-24 19:24:34 +02:00
Samuel Reed 70dddef296 Use express routes instead of modifying remoting.
This completes the migration of swagger processing from strong-remoting
into loopback-explorer.

Added additional usage instructions to README and additional testing.

This commit introduces a change into where resource descriptors
are hosted. They are no longer hosted under /swagger, but instead
under the same path as the Explorer, wherever that may be.
Generally, the resource listing will be available at
/explorer/resources, and api listings under
/explorer/resources/{modelName}.
2014-07-09 18:13:47 -05:00
Samuel Reed 4c0ce42001 Refactoring swagger 1.2 rework.
Added comments, api version, and better Swagger 1.2 compat.
2014-07-05 14:32:00 -05:00
Samuel Reed eb31787fbc Swagger 1.2 compatability. Moved strong-remoting/ext/swagger to this module.
Will now correctly return model schemas.

Moved swagger.js tests to this module.
2014-07-04 17:09:03 -05:00
Miroslav Bajtoš 8b6fc55de8 Use `app.get('restApiRoot')` as default basePath 2014-01-07 16:56:58 +01:00
Miroslav Bajtos 1ca2d2ccad Reorder middleware to fix unit-test failures.
LoopBack REST adapter owns the whole URL space and does not let other
middleware handle same URLs. It's possible to circumvent this measure
by installing the explorer middleware before the REST middleware.
2013-12-09 11:44:46 +01:00
Miroslav Bajtos a33c067ffa Support custom basePath
Recognize the `basePath` passed to swagger extension and use it in
the webpage to construct the correct `discoveryUrl`.
2013-11-29 16:26:16 +01:00
Ritchie Martori f3d6cb9b54 Initial explorer 2013-11-05 11:16:59 -08:00