Skip to content

Commit

Permalink
fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ElizabethOkerio committed May 27, 2022
1 parent c282be8 commit fd8bb85
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ private IEnumerable<IEdmStructuralProperty> ComputeDeclaredKey()
}
else
{
throw new ArgumentNullException();
key.Add(new UnresolvedProperty(this, keyProperty.PropertyName, this.Location));
}
}
structuralProperty = new EdmStructuralPropertyAlias(structuralProperty.DeclaringType, structuralProperty.Name, structuralProperty.Type, keyProperty.Alias, keyPropertySegments);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ internal override void WritePropertyRefElement(IEdmStructuralProperty property)
{
// Key properties without a key alias are represented as strings containing the property name.
// Key properties with a key alias are represented as objects with one member whose name is the key alias and whose value is a string containing the path to the property.
// TODO: It seems the second one is not supported.
IEdmStructuralPropertyAlias prop = property as IEdmStructuralPropertyAlias;
if (prop == null)
{
Expand Down
3 changes: 2 additions & 1 deletion src/Microsoft.OData.Edm/Schema/EdmEntityType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ public void AddKeys(IEnumerable<IEdmStructuralProperty> keyProperties)
}
else
{
throw new ArgumentNullException();
string message = "The structural property only be of type entity or complex";
throw new InvalidOperationException(message);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1880,6 +1880,10 @@ public void ReadJsonKeyAlias()
""$Type"": ""Edm.Date""
}
},
""ExampleComplexObject"": {
""$Kind"":""ComplexType"",
""Name"":{}
},
""Container"": {
""$Kind"": ""EntityContainer"",
""Products"": {
Expand Down

0 comments on commit fd8bb85

Please sign in to comment.