Skip to content

Commit 142adda

Browse files
committed
Add fix to add all parsed metadata to cache
1 parent 8203600 commit 142adda

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

lib/CSDLSearch.js

+3
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ function findByType(metadata, typeName) {
9797
if(schema === undefined) {
9898
schema = metadata._options.cache.getSchema(namespace);
9999
if(schema === undefined) {
100+
if(metadata.References === undefined) {
101+
return null;
102+
}
100103
namespace = remapNamespace(metadata.References, namespace);
101104
if(namespace !== undefined) {
102105
schema = metadata._options.cache.getSchema(namespace);

lib/Metadata.js

+3
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ Metadata.prototype.done = function(error) {
3535
callback = callback.bind(this.context);
3636
delete this.context;
3737
}
38+
if(this._options.cache) {
39+
this._options.cache.addMetadata(this);
40+
}
3841
callback(error, this);
3942
}
4043
}

lib/cache/csdlCache.js

+4
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,9 @@ CSDLCache.prototype.getSchema = function(namespace) {
7979
return undefined;
8080
}
8181

82+
CSDLCache.prototype.addMetadata = function(metadata) {
83+
this.metadataCache.push(metadata);
84+
}
85+
8286
module.exports = CSDLCache;
8387
/* vim: set tabstop=2 shiftwidth=2 expandtab: */

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "CSDLParser",
3-
"version": "0.1.4",
3+
"version": "0.1.5",
44
"description": "CSDL Metadata Parser",
55
"main": "./index.js",
66
"scripts": {

0 commit comments

Comments
 (0)