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

Fix issue #2276: should use for @type for serializing record in CSDL JSON #2277

Merged
merged 1 commit into from
Jan 3, 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 @@ -868,7 +868,8 @@ internal override void WriteRecordExpressionElementHeader(IEdmRecordExpression e

if (expression.DeclaredType != null)
{
this.jsonWriter.WriteRequiredProperty("$Type", expression.DeclaredType.FullName());
// The type of a record expression is represented as the @type control information.
this.jsonWriter.WriteRequiredProperty("@type", expression.DeclaredType.FullName());
}
// It MAY contain annotations for itself. It's not supported now.
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1125,7 +1125,7 @@ public void ShouldWriteOutofLineOptionalParameters()
},
""NS.TestFunction(Edm.String, Edm.String, Edm.String)/optionalParamWithDefault"": {
""@Org.OData.Core.V1.OptionalParameter"": {
""$Type"": ""Org.OData.Core.V1.OptionalParameterType"",
""@type"": ""Org.OData.Core.V1.OptionalParameterType"",
""DefaultValue"": ""Smith""
}
}
Expand Down Expand Up @@ -1194,7 +1194,7 @@ public void ShouldWriteOutOfLineOptionalParametersOverwriteInLineOptionalParamet
""$Annotations"": {
""NS.TestFunction(Edm.String)/optionalParamWithDefault"": {
""@Org.OData.Core.V1.OptionalParameter"": {
""$Type"": ""Org.OData.Core.V1.OptionalParameterType"",
""@type"": ""Org.OData.Core.V1.OptionalParameterType"",
""DefaultValue"": ""OutofLineValue""
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2007,7 +2007,7 @@ public void VerifyAnnotationWithRecordExpressionWrittenCorrectly()
// Act & Assert for Json
VisitAndVerifyJson(v => v.VisitVocabularyAnnotation(annotation), @"{
""@Person.Employee"": {
""$Type"": ""NS.Address"",
""@type"": ""NS.Address"",
""Street"": ""148th ave"",
""City"": ""Redmond""
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@
<Compile Remove="Properties\AssemblyInfo.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.assert" Version="2.4.1" />
<PackageReference Include="xunit.core" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\src\Microsoft.OData.Edm\Microsoft.OData.Edm.csproj" />
</ItemGroup>
Expand All @@ -43,12 +53,5 @@
<ItemGroup Condition="'$(TargetFramework)' == 'net452' or '$(TargetFramework)' == 'netcoreapp1.1'">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.2" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
<PackageReference Include="xunit.assert" Version="2.4.1" />
<PackageReference Include="xunit.core" Version="2.4.1" />
</ItemGroup>

</Project>