Skip to content

Commit

Permalink
Add fix to add all parsed metadata to cache
Browse files Browse the repository at this point in the history
  • Loading branch information
pboyd04 committed Nov 28, 2016
1 parent 8203600 commit 142adda
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/CSDLSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ function findByType(metadata, typeName) {
if(schema === undefined) {
schema = metadata._options.cache.getSchema(namespace);
if(schema === undefined) {
if(metadata.References === undefined) {
return null;
}
namespace = remapNamespace(metadata.References, namespace);
if(namespace !== undefined) {
schema = metadata._options.cache.getSchema(namespace);
Expand Down
3 changes: 3 additions & 0 deletions lib/Metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ Metadata.prototype.done = function(error) {
callback = callback.bind(this.context);
delete this.context;
}
if(this._options.cache) {
this._options.cache.addMetadata(this);
}
callback(error, this);
}
}
Expand Down
4 changes: 4 additions & 0 deletions lib/cache/csdlCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,9 @@ CSDLCache.prototype.getSchema = function(namespace) {
return undefined;
}

CSDLCache.prototype.addMetadata = function(metadata) {
this.metadataCache.push(metadata);
}

module.exports = CSDLCache;
/* vim: set tabstop=2 shiftwidth=2 expandtab: */
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "CSDLParser",
"version": "0.1.4",
"version": "0.1.5",
"description": "CSDL Metadata Parser",
"main": "./index.js",
"scripts": {
Expand Down

0 comments on commit 142adda

Please sign in to comment.