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 1 commit
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
Next Next commit
Create type annotation only with type name
  • Loading branch information
xuzhg committed Feb 11, 2022
commit 9eb27ece859c17cc0017a6fc5309888f23c8a464
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 @@ -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