Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create type annotation only with type name #2622

Merged
merged 2 commits into from
Feb 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ private void InitializeProperties(IEnumerable<string> updatableProperties)
}
}

private bool IsIgnoredProperty(bool isTypeDataContract, PropertyInfo propertyInfo)
private static bool IsIgnoredProperty(bool isTypeDataContract, PropertyInfo propertyInfo)
{
//This is for Ignoring the property that matches below criteria
//1. Its marked as NotMapped
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@ internal static void AddTypeNameAnnotationAsNeeded(ODataPrimitiveValue primitive
typeName = primitiveType.FullName();
}

primitive.TypeAnnotation = new ODataTypeAnnotation(typeName);
if (typeName != null)
{
primitive.TypeAnnotation = new ODataTypeAnnotation(typeName);
}
}

internal static ODataPrimitiveValue CreatePrimitive(object value, IEdmPrimitiveTypeReference primitiveType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ public async Task SerializationTests()
@"""string3"":""}t@xt{""," +
@"""string4"":""[t@xt'',,][']other::]mo}{retext""," +
@"""number10"":10," +
@"""[email protected]"":""#decimal""," +
@"""number10point5"":10.5," +
@"""number10e25"":1E+26," +
@"""boolean_true"":true," +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ public async Task PatchOpenComplexTypeProperty()
response = await Client.SendAsync(request);
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
content = await response.Content.ReadAsObject<JObject>();
Assert.Equal(6, content.Count); // @odata.context + 3 declared properties + 1 dynamic properties + 1 new dynamic properties
Assert.Equal(7, content.Count); // @odata.context + 3 declared properties + 2 dynamic properties + 1 new dynamic properties
Assert.Equal("NewCity", content["City"]); // updated
Assert.Equal("1 Microsoft Way", content["Street"]);
Assert.Equal("US", content["CountryCode"]);
Expand Down Expand Up @@ -529,7 +529,7 @@ public async Task PutOpenComplexTypeProperty()
response = await Client.SendAsync(request);
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
content = await response.Content.ReadAsObject<JObject>();
Assert.Equal(5, content.Count); // @odata.context + 3 declared properties + 1 new dynamic properties
Assert.Equal(6, content.Count); // @odata.context + 3 declared properties + 2 new dynamic properties
Assert.Equal("NewCity", content["City"]); // updated
Assert.Equal("NewStreet", content["Street"]); // updated
Assert.Equal("US", content["CountryCode"]);
Expand Down