Commit Graph

100 Commits

Author SHA1 Message Date
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
Shelby Sanders fd30b2d151 Protected against non-Model generation requests 2014-10-07 16:52:27 -07:00
Shelby Sanders 7f4e8b3f87 Corrected merge issues 2014-10-07 15:27:49 -07: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
Raymond Feng 282b70e1e4 Fix how the array of models is iterated
https://github.com/strongloop/loopback-explorer/issues/49
2014-09-19 09:35:11 -07:00
Shelby Sanders 240898e7a5 Added support for scanning accepts params for Model references 2014-09-17 19:02:39 -07:00
Clark Wang acf00f3254 Make sure nested/referenced models in array are mapped to swagger
Signed-off-by: Clark Wang <clark.wangs@gmail.com>
2014-08-29 16:06:05 +08:00
Raymond Feng d083feab36 Make sure nested/referenced models are mapped to swagger 2014-08-28 15:20:03 -07:00
Shelby Sanders 464e37c1c9 Changed addRoute() to honor X-Forwarded-Host 2014-08-25 20:06:31 -07:00
Raymond Feng 0d182939a0 Merge pull request #38 from STRML/form-encoding
Newest Swagger UI requires application/x-www-form-urlencoded.
2014-08-15 23:36:34 -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
Navid Nikpour bda9e5f627 Fixed undefined modelClass when using polymorphic relations 2014-08-10 08:46:24 +02:00
Shelby Sanders 76057a2ba9 Changed to possibly pull model description from ctor.settings 2014-08-06 23:52:59 -07:00
Shelby Sanders 820c51fa7a Corrected generateModelDefinition() to scan for model references nested in other models 2014-08-06 00:31:34 -07:00
Shelby Sanders 5ef5baee06 Corrected prepareDataType() to handle collections and nesting, and changed to always and only use responseMessages 2014-08-06 00:21:48 -07:00
Shelby Sanders 1eddcade09 Corrected generateModelDefinition() to scan for model references in remote returns and errors 2014-08-06 00:20:15 -07:00
Shelby Sanders cf3e6161ef Corrected default for consumes+produces 2014-08-06 00:19:15 -07:00
Raymond Feng bf3a2c9764 Fix the type name for a property if model class is used
See https://github.com/strongloop/loopback-explorer/issues/32
2014-08-04 23:22:41 -07:00
Shelby Sanders c6754baf83 Ported prepareDataType() from old strong-remoting:ext/swagger.js 2014-08-04 20:29:32 -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 689a2f6a86 Merge pull request #29 from strongloop/feature/workaround-lb-issue-432
Set up default consumes/produces media types
2014-08-04 08:37:45 -07:00
Ritchie Martori e30df1de93 Merge pull request #27 from strongloop/fix/array-items-any
Add required swagger 1.2 items property for property type array
2014-08-04 08:34:59 -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
Ritchie Martori f7734fe5b3 Add required swagger 1.2 items property for property type array 2014-07-31 16:33:02 -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 a9ecfecde5 Remove hidden properties from definition. 2014-07-26 12:15:47 -05:00
Raymond Feng 078649f990 Ensure models from relations are included 2014-07-24 13:35:02 -07:00
Miroslav Bajtoš 536fa4c577 model-helper: handle arrays with undefined items 2014-07-22 21:52:25 +02:00
Miroslav Bajtoš a92450eaf0 model-helper: handle array types with no item type 2014-07-22 21:34:42 +02:00
Samuel Reed 84e9486062 Properly convert complex return types.
Attached tests.
2014-07-20 20:04:10 -05:00
Samuel Reed 6319572a55 Fix up loopback.rest() model definition hack.
In its previous form, array return types were being returned simply
as {type: 'array'}, with their `items` definition forgotten.
2014-07-18 17:31:43 -05:00
Samuel Reed 5c130a4b3d Fix debug namespace, express version. 2014-07-11 14:22:18 -04:00
Samuel Reed 4b3785c0b2 Simplify `accepts` and `returns` hacks. 2014-07-11 10:03:58 -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 781ac2bd12 Rename translateKeys to translateDataTypeKeys. 2014-07-10 14:09:57 -05:00
Samuel Reed 3ce35e1431 Refactor route-helper & add tests.
- Uses model-helper to parse types for swagger.
- Separated returns & accepts hacks.
- Documentation fixes
- TODO add param regex
2014-07-10 14:09:57 -05:00
Samuel Reed 77f01670de LDL to Swagger fixes & extensions.
- Supports all three LDL array type specifications.
- Added model-helper tests.
- translate-keys no longer modifies the incoming object.
- Non-primitive types are now correctly converted into a primitive
  with a `format` attribute.
- `id` properties are not assumed to be required if they are generated.
2014-07-10 12:07:19 -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 a4a36f5602 Refactor key translations between LDL & Swagger.
Route.accepts & route.returns can now share these translations.
2014-07-06 09:50:24 -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