Skip to content

Commit fb4a8d9

Browse files
committed
0.9.7.1: Adding ignoreNoEdit as workaround
1 parent f118e8f commit fb4a8d9

File tree

3 files changed

+28
-7
lines changed

3 files changed

+28
-7
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ This extension for Keystone is intended to create a REST API very easy. Also is
1616
+ rest {Boolean}
1717

1818
+ restOptions {String} 'list show create update delete'
19+
20+
+ restDescription {String}
1921

2022
- List Object
2123
+ restHooks {Object}
@@ -80,6 +82,13 @@ This extension for Keystone is intended to create a REST API very easy. Also is
8082

8183
### Changelog
8284

85+
___0.9.7.1___
86+
- Added ignoreNoEdit to Create to avoid awful errors for now
87+
88+
___0.9.7___
89+
- restDescription field to specify the Description of the REST Endpoint
90+
- Use of keystone Name to create the Header of the Blueprint API Document
91+
8392
___0.9.6___
8493
- Added attributes to Model Definition in the Documentation
8594
- Added Support for Select Field on API Generation
@@ -90,6 +99,14 @@ ___0.9.5___
9099

91100
### TODO
92101
- The "update" and "create" method must use the Keystone UpdateHandler (Done)
102+
- Implement a way to set Options for UpdateHandler
103+
104+
```javascript
105+
restOptions: {
106+
ignoreNoedit: true
107+
}
108+
```
109+
93110
- New Tests based on the changes.
94111

95112
## Authors

index.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ function KeystoneRest() {
346346
*/
347347
var _addList = function (Model, middleware, selected, relationships) {
348348
// Create Docs
349-
_createDocumentation('show', Model);
349+
_createDocumentation('list', Model);
350350

351351
// Get a list of items
352352
self.routes.push({
@@ -482,7 +482,7 @@ function KeystoneRest() {
482482

483483
var _addShow = function (Model, middleware, selected, findBy) {
484484
// Create Docs
485-
_createDocumentation('list', Model);
485+
_createDocumentation('show', Model);
486486

487487
var collectionName = Model.collection.name.toLowerCase();
488488
var paramName = Model.modelName.toLowerCase();
@@ -552,11 +552,15 @@ function KeystoneRest() {
552552
_flattenRelationships(Model, req.body);
553553

554554
var md = new Model();
555-
555+
var options = {
556+
flashErrors: false,
557+
ignoreNoedit: true
558+
};
559+
556560
// Get the UpdateHandler from Keystone and process the Request
557-
md.getUpdateHandler(req).process(req.body, {
558-
flashErrors: false
559-
}, function (err, item) {
561+
md.getUpdateHandler(req).process(req.body, options, function (err, item) {
562+
console.error(err);
563+
console.info(item);
560564
if (err) {
561565
return _sendError(err, req, res, next);
562566
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "keystone-rest-api",
3-
"version": "0.9.6",
3+
"version": "0.9.7.1",
44
"description": "Creates a powerful Rest API based on Keystone Lists",
55
"main": "index.js",
66
"repository": {

0 commit comments

Comments
 (0)