Skip to content

Commit

Permalink
Merge pull request #6 from pboyd04/elasticio-modifications
Browse files Browse the repository at this point in the history
Elasticio modifications
  • Loading branch information
pboyd04 committed Jul 6, 2018
2 parents 9b5ba70 + d0bba37 commit 20ee951
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/node_modules
/lib-cov
.idea
4 changes: 2 additions & 2 deletions lib/EntityType.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ function EntityType(xml) {
for(var i = 0; i < propNames.length; i++)
{
var name = propNames[i].value();
if(this[name] !== undefined) {
this[name].IsKey = true;
if(this.Properties[name] !== undefined) {
this.Properties[name].IsKey = true;
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions test/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function schemaTest(schema, assert) {
assert.notEqual(schema.Person, undefined);
assert.equal(schema.Person.constructor.name, 'EntityType');
assert.deepEqual(schema.Person.Annotations, {});
assert.deepEqual(schema.Person.Properties.UserName, {Name: 'UserName', Annotations: {}, Type: 'Edm.String', Nullable: false});
assert.deepEqual(schema.Person.Properties.UserName, {Name: 'UserName', Annotations: {}, Type: 'Edm.String', Nullable: false, IsKey: true});
assert.deepEqual(schema.Person.Properties.FirstName, {Name: 'FirstName', Annotations: {}, Type: 'Edm.String', Nullable: false});
assert.deepEqual(schema.Person.Properties.LastName, {Name: 'LastName', Annotations: {}, Type: 'Edm.String'});
assert.deepEqual(schema.Person.Properties.MiddleName, {Name: 'MiddleName', Annotations: {}, Type: 'Edm.String'});
Expand All @@ -33,19 +33,19 @@ function schemaTest(schema, assert) {
assert.deepEqual(schema.Person.Properties.Features, {Name: 'Features', Annotations: {}, Type: 'Collection(Microsoft.OData.Service.Sample.TrippinInMemory.Models.Feature)', Nullable: false});
assert.deepEqual(schema.Person.Properties.Friends, {Name: 'Friends', Annotations: {}, Type: 'Collection(Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person)'});
assert.deepEqual(schema.Person.Properties.BestFriend, {Name: 'BestFriend', Annotations: {}, Type: 'Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person'});
assert.deepEqual(schema.Person.Properties.Trips, {Name: 'Trips', Annotations: {}, Type: 'Collection(Microsoft.OData.Service.Sample.TrippinInMemory.Models.Trip)'});
assert.deepEqual(schema.Person.Properties.Trips, {Name: 'Trips', Annotations: {}, Type: 'Collection(Microsoft.OData.Service.Sample.TrippinInMemory.Models.Trip)'});

assert.notEqual(schema.Airline, undefined);
assert.equal(schema.Airline.constructor.name, 'EntityType');
assert.deepEqual(schema.Airline.Annotations, {});
assert.deepEqual(schema.Airline.Properties.AirlineCode, {Name: 'AirlineCode', Annotations: {}, Type: 'Edm.String', Nullable: false});
assert.deepEqual(schema.Airline.Properties.AirlineCode, {Name: 'AirlineCode', Annotations: {}, Type: 'Edm.String', Nullable: false, IsKey: true});
assert.deepEqual(schema.Airline.Properties.Name, {Name: 'Name', Annotations: {}, Type: 'Edm.String'});

assert.notEqual(schema.Airport, undefined);
assert.equal(schema.Airport.constructor.name, 'EntityType');
assert.deepEqual(schema.Airport.Annotations, {});
assert.deepEqual(schema.Airport.Properties.Name, {Name: 'Name', Annotations: {}, Type: 'Edm.String'});
assert.deepEqual(schema.Airport.Properties.IcaoCode, {Name: 'IcaoCode', Annotations: {}, Type: 'Edm.String', Nullable: false});
assert.deepEqual(schema.Airport.Properties.IcaoCode, {Name: 'IcaoCode', Annotations: {}, Type: 'Edm.String', Nullable: false, IsKey: true});
assert.deepEqual(schema.Airport.Properties.IataCode, {Name: 'IataCode', Annotations: {}, Type: 'Edm.String'});
assert.deepEqual(schema.Airport.Properties.Location, {Name: 'Location', Annotations: {}, Type: 'Microsoft.OData.Service.Sample.TrippinInMemory.Models.AirportLocation'});

Expand Down Expand Up @@ -104,13 +104,13 @@ function schemaTest(schema, assert) {
assert.deepEqual(schema.ShareTrip.Parameters.userName, {
Name: 'userName',
Annotations: {},
Nullable: false,
Nullable: false,
Unicode: false,
Type: 'Edm.String'});
assert.deepEqual(schema.ShareTrip.Parameters.tripId, {
Name: 'tripId',
Annotations: {},
Nullable: false,
Nullable: false,
Type: 'Edm.Int32'});

assert.notEqual(schema.Container, undefined);
Expand Down

0 comments on commit 20ee951

Please sign in to comment.