Commit Graph

97 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 43e84c4cb1 Corrected to propagate properties from existing items object 2015-07-15 17:17:33 -07:00
Shelby Sanders 33ca826573 Added Swagger fields for items and max/min(Items|Length) 2015-07-07 01:29:33 -07:00
Shelby Sanders ef7e5d403c Corrected accidental duplication of responseMessages from merge 2015-07-03 00:11:05 -07: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
Miroslav Bajtoš ccfd9c42b0 Fix tests broken by fa3035c (#96) 2015-04-27 08:28:44 +02:00
bkniffler fa3035c4bb Fix model description getting lost 2015-04-20 16:04:44 +02:00
Ying Tang 7af616b21a review comments 2015-04-08 17:03:22 -07:00
Ying Tang e93d87375b float additionalProperties and description to top 2015-04-07 11:30:54 -07:00
Ying Tang a91eb2fb04 Convert array to string for summary, note, and description. Fix additionalProperties 2015-04-07 11:21:12 -07:00
Ying Tang 3f8c3b7c04 back out changes of id to URI 2015-04-06 19:57:57 -07:00
Ying Tang b9001a3130 Uri id and $ref, join description 2015-04-06 17:00:32 -07: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
Ying Tang b9df4b6706 remove id fields from required array 2015-04-02 16:29:09 -07:00
Ying Tang 772a48773d remove required from sub-schema 2015-04-01 17:47:57 -07:00
Ying Tang 27e5895aa5 add $ref and remove type for models 2015-03-26 22:23:24 -07:00
gandrianakis 16c54c038e Made API doc of class use the http.path of the class if available, or the name of the class as a fallback 2015-02-17 17:23:32 +02: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
Shelby Sanders 3bd1e4440d Corrected handling of type for operation, including containers 2015-01-09 21:53:37 -08:00
Shelby Sanders 5fcc411c06 Corrected handling for absent settings.additionalProperties 2015-01-09 21:52:57 -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
Samuel Reed fe434e7ee9 Merge pull request #73 from STRML/nickname
Remove model name from nickname, swagger spec understands op context.
2014-12-01 21:29:27 +01:00
Samuel Reed 8147ba5821 Remove model name from nickname, swagger spec understands op context.
This removes the redundancy from paths in swagger-ui such as
`/api/user/user_login`. It will now be displayed simply as
`/api/user/login`.

This is consistent with how `nickname` is used in Swagger examples.

Added tests to route nickname processing.
2014-11-29 12:07:58 +01:00
Miroslav Bajtoš 4e5cbe43f9 model-helper: ignore unknown property types 2014-11-29 12:05:12 +01:00
Shelby Sanders 9de19e851e Merge branch 'master' of github.com:shelbys/loopback-explorer
* 'master' of github.com:shelbys/loopback-explorer:
  added reference to settings for additional properties
2014-11-07 20:47:30 -08:00
Shelby Sanders 4a40f18251 Added support for public in order to hide operations from Swagger 2014-11-07 20:47:20 -08:00
Jake Ayala 657f5e2119 added reference to settings for additional properties 2014-10-28 19:21:47 -07: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š 9a6bd35df7 model-helper: support anonymous object types
Accepts/returns arguments allow anonymous object types, e.g.

    { 'arg': 'kvp', type: { 'name': 'string', 'value': 'string' } }

As of this commit, these types are converted to Swagger type 'object'.
2014-10-16 13:51:53 +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š 060354cff8 models: include model's `description` 2014-10-16 08:47:18 +02:00
Miroslav Bajtoš dc815a8421 Refactor conversion of data types
Refactor the way how loopback types are converted to swagger data types.

 - `modelHelper.LDLPropToSwaggerDataType` is responsible for
   producing a valid Swagger Data Type object from LDL object
   (be it a property, accepts item or returns item).

 - LDLPropToSwaggerDataType picks only fields that are part
   of the swagger spec, everything else is excluded from the result.
   It's up to the caller to add extra fields like `description`.

 - refactor `routeHelper.extendWithType` to accept an additional arg:
   the original LDL object. This way it's possible to copy all
   type-specific fields to the output object and don't add anything
   else.
2014-10-16 08:47:18 +02:00
Miroslav Bajtoš 42dedfcacc Move `convertText` to `typeConverter`
Create a new module `lib/type-converter.js`.

Move `routeHelper.convertText` to this new module.
2014-10-16 08:46:37 +02:00
Krishna Raman 856d34b9d4 Add support for `context` and `res` param types 2014-10-15 09:37:03 -07:00
Miroslav Bajtoš 705776517b Support multi-line array `description` and `notes`
When a string value is expected and the user supplied an array,
convert the value to a single string by joining all array items.
2014-10-13 19:32:09 +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š 4d0e711087 route-helper: include `notes` and `deprecated` 2014-10-13 16:32:12 +02:00
Shelby Sanders 37179f3e61 Pull model description from ctor.settings first 2014-10-13 15:27:15 +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