Skip to content

Commit 2e4fab1

Browse files
Update docs
1 parent 1bd9e04 commit 2e4fab1

File tree

2 files changed

+35
-33
lines changed

2 files changed

+35
-33
lines changed

karma.start.js

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -160,41 +160,43 @@ beforeEach(function () {
160160
},
161161

162162

163-
//Experimental mechanisum for loading jsonApi related/relationships data
164-
__findRelated : function (relationName) {
165-
var hasReferenceData = false;
163+
// Experimental mechanisum for loading jsonApi related/relationships data
164+
// This is now built into data objects
165+
166+
//__findRelated : function (relationName) {
167+
// var hasReferenceData = false;
166168

167-
if (DSUtils.get(item, JSONAPIMETATAG + '.isJsonApiReference') === false) {
169+
// if (DSUtils.get(item, JSONAPIMETATAG + '.isJsonApiReference') === false) {
168170

169-
if (this[relationName]) {
170-
DSUtils.forEach(this[relationName], function (item) {
171-
if (DSUtils.get(item, JSONAPIMETATAG + '.isJsonApiReference')) {
172-
hasReferenceData = true;
173-
// Exit the for loop early
174-
return false;
175-
}
176-
});
177-
} else {
178-
throw new Error('findRelated failed, Relationship name:' + relationName + ' does not exist.')
179-
}
171+
// if (this[relationName]) {
172+
// DSUtils.forEach(this[relationName], function (item) {
173+
// if (DSUtils.get(item, JSONAPIMETATAG + '.isJsonApiReference')) {
174+
// hasReferenceData = true;
175+
// // Exit the for loop early
176+
// return false;
177+
// }
178+
// });
179+
// } else {
180+
// throw new Error('findRelated failed, Relationship name:' + relationName + ' does not exist.')
181+
// }
180182

181-
if (hasReferenceData === true || this[relationName] == undefined) {
182-
// Get relted link for relationship
183-
var relationshipUrl = DSUtils.get(this, [JSONAPIMETATAG, 'relationships', relationName, 'related'].join('.'));
183+
// if (hasReferenceData === true || this[relationName] == undefined) {
184+
// // Get relted link for relationship
185+
// var relationshipUrl = DSUtils.get(this, [JSONAPIMETATAG, 'relationships', relationName, 'related'].join('.'));
184186

185-
if (relationshipUrl) {
186-
return Post.findAll({ containerid: this.Id }, { bypassCache: true, jsonApi: { jsonApiPath: relationshipUrl } });
187-
}
188-
}
187+
// if (relationshipUrl) {
188+
// return Post.findAll({ containerid: this.Id }, { bypassCache: true, jsonApi: { jsonApiPath: relationshipUrl } });
189+
// }
190+
// }
189191

190-
return DSUtils.Promise.resolve(this[relationName]);
191-
} else {
192-
// This is it self a model reference and so we should get the self link first.
193-
// NOTE : We could load self link and then relationship transparently but not sure that this would be what a developer would want.
194-
// probably still better to jut throw an error for now!
195-
throw Error("findRelated failed, this is a mode reference load via self link instead.")
196-
}
197-
}
192+
// return DSUtils.Promise.resolve(this[relationName]);
193+
// } else {
194+
// // This is it self a model reference and so we should get the self link first.
195+
// // NOTE : We could load self link and then relationship transparently but not sure that this would be what a developer would want.
196+
// // probably still better to jut throw an error for now!
197+
// throw Error("findRelated failed, this is a mode reference load via self link instead.")
198+
// }
199+
//}
198200
}
199201
});
200202

readme.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ See the [Project Wiki](https://github.com/BlairAllegroTech/js-data-jsonapi/wiki)
1717
|When deserializing JsonApi data add 'ParentIds' so that js-data **belongsTo** relationships can work|code complete, some tests|
1818
|When deserializing JsonApi data add **'LocalKey/LocalKeys'** or **'ForeignKeys'** depending on js-data configurations so that js-data **hasOne** and **hasMany** relationships can work|code complete, some tests|
1919
|Add metadata to indicate if an object is a jsonApi reference, indicating that it is partially populated only|code complete, some tests|
20-
|Transparently request full objects when requested from js-data cache and object is a jsonApi reference only, e.g. Not fully populated| Started|
21-
|Store hyperlinking data within metadata of stored data|Started|
22-
|Use metadata hyperlinks to request related data from JsonApi data store|Started|
20+
|Transparently request full objects when requested from js-data cache and object is a jsonApi reference only, e.g. Not fully populated| code complete, some tests|
21+
|Store hyperlinking data within metadata of stored data|code complete, some tests|
22+
|Use metadata hyperlinks to request related data from JsonApi data store|code complete, some tests|
2323
|Use metadata hyperlinks to add new items to relationships|Not started|
2424

2525
### Known Issues

0 commit comments

Comments
 (0)