Commit Graph

40 Commits

Author SHA1 Message Date
cndreiter c47d8c9189 Add `opts.host` to customize host of resource URLs 2015-08-04 15:48:49 +02:00
Shelby Sanders 1294b53f5c Merge remote-tracking branch 'upstream/master' into validate_param_enum
* upstream/master: (53 commits)
  1.8.0
  Add opts.omitProtocolInBaseUrl
  Fix tests broken by fa3035c (#96)
  Fix model description getting lost
  1.7.2
  Allow submitting token input with empty value to remove token.
  Fix duplicate stylesheet issue
  Fix explorer tests for different line endings on Windows
  1.7.1
  Remove unused external font "Droid Sans".
  1.7.0
  Made API doc of class use the http.path of the class if available, or the name of the class as a fallback
  v1.6.4
  Prevent double slash in the resource URLs
  v1.6.3
  Allow `uiDirs` to be defined as a String
  Fix bad CLA URL in CONTRIBUTING.md
  Add X-UA-Compatible tag
  v1.6.2
  Move 200 response to `type` on the operation object. See #75.
  ...
2015-07-02 11:19:18 -07:00
Shelby Sanders 1bf7c27a56 Merge remote-tracking branch 'upstream/master' into validate_param_enum 2015-07-02 11:03:27 -07:00
Miroslav Bajtoš 5462ce9aac Add opts.omitProtocolInBaseUrl 2015-06-23 16:36:19 +02:00
Ying Tang 1dbc9cf113 propertyName, not property 2015-04-05 17:04:30 -07:00
Ying Tang e22b826bca fix resource listing and remove id from each property 2015-04-05 16:51:15 -07:00
Shelby Sanders 24146313ec Changed Swagger() to omit resources with no content 2015-02-07 22:59:00 -08:00
Shelby Sanders 3ca1f45a77 Added event emission for swaggerResources to support customization 2015-02-07 14:40:15 -08:00
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
Samuel Reed 28a5a2619a Move 200 response to `type` on the operation object. See #75. 2014-12-12 13:48:58 +01:00
Ryan Graham 6b5a016c59 Use full lodash instead of lodash components
This change trims 134 modules from the dependency tree, many of which
were duplicate depdencies between the 4 lodash.function modules used
and their sub-dependencies.

Before:
$ npm ls | wc -l
     494
$ du -sch node_modules/lodash*
 432K   node_modules/lodash.assign
 660K   node_modules/lodash.clonedeep
  96K   node_modules/lodash.defaults
 980K  node_modules/lodash.pick
 2.1M  total

After:
$ npm ls | wc -l
     360
$ du -sch node_modules/lodash*
964K   node_modules/lodash
964K   total
2014-12-02 19:14:58 -08:00
Shelby Sanders 4a40f18251 Added support for public in order to hide operations from Swagger 2014-11-07 20:47:20 -08:00
Miroslav Bajtoš a4179e454a swagger: honour X-Forwarded-Proto header
Improve the algorithm building `baseUrl` to honour `X-Forwarded-Proto`
header when it is present.
2014-10-22 11:10:15 +02:00
Miroslav Bajtoš 6fb81c279b Add integration tests for included models
Add tests verifying that Swagger docs include model description for
recursively nested references to Models and Arrays of Models in
properties, modelTo and modelThrough relations, accepts,
returns and errors.

Fix bugs discovered along the way.
2014-10-16 14:43:59 +02:00
Miroslav Bajtoš d05dcb71df route-helper: add `responseMessages`
Add a default "success" response message, the status code is 200 or 204
depending on whether the method returns any data.

Append any error messages as specified in the `errors` property
of method's remoting metadata.

Move the description of operation's return type to the "success"
response message.

Include error message models in the API models.
2014-10-16 14:04:02 +02:00
Miroslav Bajtoš aa7cb0b118 swagger: include models from accepts/returns args
Models not attached to the app are included too.
2014-10-16 10:34:41 +02:00
Miroslav Bajtoš 2decdcc234 swagger: Deprecate `opts.swaggerVersion`
Users of loopback-explorer should not override the swagger version,
as it's the explorer who decides what version of the Swagger Spec
it implements.
2014-10-16 10:34:41 +02:00
Miroslav Bajtoš 6838087a5c swagger: use X-Forwarded-Host for basePath 2014-10-16 10:34:41 +02:00
Miroslav Bajtoš be36f11629 Use `1.0.0` as the default app version.
Change the default version number returned when the version number
cannot be read from `package.json` in CWD.
2014-10-13 17:30:19 +02:00
Miroslav Bajtoš 622f6176f3 Extend `consumes` and `produces` metadata
- Include XML content-types for both input and output
 - Include JSONP (javascript) content-types for output
2014-10-13 17:29:37 +02:00
Miroslav Bajtoš f645c6db0d swagger: allow cross-origin requests
Add CORS middleware to the swagger app.

Add a configuration option allowing developers to disable CORS.
2014-10-08 07:57:50 +02:00
Shelby Sanders 8563dd0463 Merge remote-tracking branch 'upstream/master'
* upstream/master:
  Sort endpoints by letter.
  Add syntax highlighting styles & highlight threshold.
  Add contribution guidelines
  Bump version
  Fix how the array of models is iterated
  Bump version
  Make sure nested/referenced models in array are mapped to swagger
  Make sure nested/referenced models are mapped to swagger
  Bump version
  Newest Swagger UI requires application/x-www-form-urlencoded.
  Use `dist` property from swagger-ui package.
  Fixed undefined modelClass when using polymorphic relations
  Bump version
  Fix the type name for a property if model class is used

Conflicts:
	lib/model-helper.js
	lib/swagger.js
	public/css/loopbackStyles.css
2014-10-07 11:57:15 -07:00
Shelby Sanders 464e37c1c9 Changed addRoute() to honor X-Forwarded-Host 2014-08-25 20:06:31 -07:00
Samuel Reed d98a7877d4 Newest Swagger UI requires application/x-www-form-urlencoded.
UI will fail to POST if this consumes type is not specified.
2014-08-12 12:45:38 -04:00
Shelby Sanders cf3e6161ef Corrected default for consumes+produces 2014-08-06 00:19:15 -07:00
Shelby Sanders 28d293b6f9 Merge remote-tracking branch 'upstream/master'
* upstream/master:
  Bump version
  Set up default consumes/produces media types
  Fix the default opts
  Add required swagger 1.2 items property for property type array
  Allow passing a custom protocol.

Conflicts:
	lib/swagger.js
2014-08-04 18:20:59 -07:00
Shelby Sanders 3dc7de6881 Ported extensions for more Swagger 1.2 metadata, returns+errors as responseMessages, consumes+produces, and X-Forwarded-Proto for reverse-proxying from HTTPS to HTTP 2014-08-04 18:19:09 -07:00
Raymond Feng 0aa476a682 Set up default consumes/produces media types
See:

https://github.com/strongloop/loopback/issues/432
https://github.com/wordnik/swagger-js/issues/107
2014-08-03 21:48:16 -07:00
Raymond Feng df459ffc8b Fix the default opts 2014-07-31 16:47:47 -07:00
Raymond Feng 3c8f3b1dd0 Merge branch 'protocol' of github.com:STRML/loopback-explorer into STRML-protocol 2014-07-31 16:45:32 -07:00
Geoffroy f6970db749 res.send deprecated - updated to res.status
Used to get warning: 'express deprecated res.send(status, body): Use
res.status(status).send(body) instead
node_modules/loopback-explorer/lib/swagger.js:105:9'
2014-07-28 17:40:08 -05:00
Samuel Reed 32f0f5e37d Allow passing a custom protocol.
This allows swagger definitions to work properly when the API is behind
an SSL terminator.
2014-07-27 21:44:14 -05:00
Samuel Reed 5c130a4b3d Fix debug namespace, express version. 2014-07-11 14:22:18 -04:00
Samuel Reed 75713f16f2 Add url-join so path.join() doesn't break windows 2014-07-10 14:09:57 -05: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
Raymond Feng d34304afc3 Make sure body parameter is shown. 2014-07-05 10:21:06 -07:00
Samuel Reed 67bb10b6a4 Some swagger 1.2 migration cleanup.
- Added array items definition.
- Ignored body when specified via arg.http.source.
2014-07-05 10:54:19 -05:00
Raymond Feng 2f8506c81b Fix api resource path and type ref to models. 2014-07-05 00:30:26 -07: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