Commit Graph

8 Commits

Author SHA1 Message Date
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š 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
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š 4d0e711087 route-helper: include `notes` and `deprecated` 2014-10-13 16:32:12 +02:00
Samuel Reed 84e9486062 Properly convert complex return types.
Attached tests.
2014-07-20 20:04:10 -05:00
Samuel Reed a857fe540f Remove forgotten TODO. 2014-07-11 10:04:14 -04: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