Skip to content

Commit

Permalink
add more unit test; fix browser parser
Browse files Browse the repository at this point in the history
  • Loading branch information
AllanZhengYP committed Feb 3, 2020
1 parent 020ff0b commit ab093ce
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/model/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var Operation = require('./operation');
var Shape = require('./shape');
var Paginator = require('./paginator');
var ResourceWaiter = require('./resource_waiter');
var Metadata = require('../../apis/metadata.json');
var metadata = require('../../apis/metadata.json');

var util = require('../util');
var property = util.property;
Expand Down Expand Up @@ -35,7 +35,7 @@ function Api(api, options) {
property(this, 'fullName', api.metadata.serviceFullName);
property(this, 'serviceId', api.metadata.serviceId);
if (serviceIdentifier) {
property(this, 'xmlNoDefaultLists', Metadata[serviceIdentifier].xmlNoDefaultLists, false);
property(this, 'xmlNoDefaultLists', metadata[serviceIdentifier].xmlNoDefaultLists, false);
}

memoizedProperty(this, 'className', function() {
Expand Down
5 changes: 4 additions & 1 deletion lib/xml/browser_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@ function parseStructure(xml, shape) {
getElementByTagName(xml, memberShape.name);
if (xmlChild) {
data[memberName] = parseXml(xmlChild, memberShape);
} else if (!memberShape.flattened && memberShape.type === 'list') {
} else if (
!memberShape.flattened &&
memberShape.type === 'list' &&
!shape.api.xmlNoDefaultLists) {
data[memberName] = memberShape.defaultValue;
}
}
Expand Down
22 changes: 22 additions & 0 deletions test/xml/parser.spec.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ab093ce

Please sign in to comment.