Commit Graph

459 Commits

Author SHA1 Message Date
Miroslav Bajtoš ee2d0d4ddb 1.5.0 2014-10-24 19:31:30 +02:00
Miroslav Bajtoš 0daf2d3dc4 Merge pull request #68 from strongloop/feature/custom-swagger-ui
Add options `overridesDist` and `swaggerUiDist`
2014-10-24 19:29:25 +02: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
Miroslav Bajtoš 8c5354cc8c Merge pull request #69 from strongloop/feature/honour-x-forwarded-headers
swagger: honour X-Forwarded-Proto header
2014-10-23 20:16:12 +02: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
Raymond Feng d18d64b41d Merge tag 'v1.4.0'
1.4.0
2014-10-21 15:40:28 -07:00
Raymond Feng ba8fdfdfd6 Merge branch 'release/1.4.0' into production 2014-10-21 15:40:22 -07:00
Raymond Feng 1b288406d1 Bump version 2014-10-21 15:39:26 -07:00
Miroslav Bajtoš 530808312a Merge pull request #61 from strongloop/feature/godaddy-improvements-round-2
GoDaddy improvements - round 2
2014-10-16 18:59:28 +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š d212741638 loopbackStyles: improve spacing in small window
Improve spacing of page elements when the browser window is small.
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š dd27b2428c Merge pull request #65 from strongloop/fix/example
example: use PersistedModel instead of Model
2014-10-16 10:19:40 +02:00
Miroslav Bajtoš 604248ec17 example: use PersistedModel instead of Model
Use `PersistedModel` as a base for the Product model to ensure
it has some methods to inspect in the explorer.
2014-10-16 10:17:47 +02:00
Miroslav Bajtoš 0f5ab45c0b Merge pull request #64 from strongloop/feature/property-constraints
Preserve property type constraints
2014-10-16 08:58:37 +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š d1084950a9 Merge pull request #62 from strongloop/run-tests-agains-loopback-2x
package: update devDependencies
2014-10-14 18:35:22 +02:00
Miroslav Bajtoš c31c89a29a package: update devDependencies
- loopback 1.x to ^2.4.1
 - mocha ~1.20.1 to ^1.21.5
 - supertest ~0.13.0 to ~0.14.0
2014-10-14 14:15:17 +02:00
Miroslav Bajtoš 347e1f045e gitignore: add .idea, *.tgz, *.iml 2014-10-14 08:19:12 +02:00
Miroslav Bajtoš 909bc563b9 Merge pull request #59 from strongloop/feature/support-array-descriptions
Support multi-line array `description` and `notes`
2014-10-13 19:39:27 +02: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š 72f36b56bf Merge pull request #58 from strongloop/godaddy-improvements-1
Godaddy improvements - round 1
2014-10-13 18:46:57 +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š 65be2833a2 Merge tag 'v1.3.0'
1.3.0
2014-10-08 19:23:36 +02:00
Miroslav Bajtoš c95366eb4c Merge branch 'release/1.3.0' into production 2014-10-08 19:23:15 +02:00
Miroslav Bajtoš 546a122eaa 1.3.0 2014-10-08 19:22:45 +02:00
Miroslav Bajtoš 8aa8184c6b Merge pull request #53 from strongloop/feature/add-cors
swagger: allow cross-origin requests
2014-10-08 19:19:53 +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
Miroslav Bajtoš 520b0b91d9 Merge pull request #55 from STRML/sortEndpoints
Sort endpoints by letter.
2014-10-07 14:18:19 +02:00
Samuel Reed 0a35cdb4af Sort endpoints by letter.
Merged from swagger-ui's index.html.

Previously, endpoints were sorted in the order they were defined.
2014-10-07 13:56:30 +02:00
Miroslav Bajtoš 174aff7fbe Merge pull request #56 from STRML/syntaxHighlighting
Add syntax highlighting styles & highlight threshold.
2014-10-07 13:52:43 +02:00
Samuel Reed ad68695009 Add syntax highlighting styles & highlight threshold.
Previously, highlighting classes were being added to the DOM but had no CSS
so the user just saw black - a lot of CPU usage for nothing.

These styles now attractively and minimally style resposes so long as
they are below a certain threshold, as well as model schemas.

The highlightSizeThreshold fixes the long hang users would
see when large responses were returned.
2014-10-07 11:07:41 +02:00
Ryan Graham 64c25a8c3c Add contribution guidelines
Uses https://cla.strongloop.com
2014-10-01 17:55:03 -07:00
Shelby Sanders 2d6f7aebe8 Added padding to content well in order to counteract changes in SwaggerUI 2014-09-29 19:43:56 -07:00
Raymond Feng eaf16b9aa8 Merge tag 'v1.2.11'
1.2.11
2014-09-22 09:05:36 -07:00
Raymond Feng 76f719c3e8 Merge branch 'release/1.2.11' into production 2014-09-22 09:05:32 -07:00
Raymond Feng b488fa3c25 Bump version 2014-09-22 09:04:47 -07:00