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

Fixes #3154: Enable serialize/deserialize navigation property with count without content #3155

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

xuzhg
Copy link
Member

@xuzhg xuzhg commented Dec 19, 2024

Fixes #3154: Enable serialize/deserialize navigation property with count without content

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 5 out of 7 changed files in this pull request and generated 4 comments.

Files not reviewed (2)
  • src/Microsoft.OData.Core/Json/ODataJsonResourceDeserializer.cs: Evaluated as low risk
  • src/Microsoft.OData.Core/Json/ODataJsonResourceSerializer.cs: Evaluated as low risk
Comments suppressed due to low confidence (2)

test/FunctionalTests/Microsoft.OData.Core.Tests/ScenarioTests/Writer/Json/FullPayloadValidateTests.cs:852

  • [nitpick] The term 'Inlinecount' should be changed to 'Count' to maintain consistency with the rest of the codebase. The method name should be 'WritingNestedCountWithoutContentTest'.
public void WritingNestedInlinecountWithoutContentTest()

test/FunctionalTests/Microsoft.OData.Core.Tests/ScenarioTests/Writer/Json/FullPayloadValidateTests.cs:954

  • [nitpick] The term 'Inlinecount' should be changed to 'Count' to maintain consistency with the rest of the codebase. The method name should be 'ReadingNestedCountWithoutContentTest'.
public void ReadingNestedInlinecountWithoutContentTest()

@@ -968,7 +968,7 @@ protected override void WriteDeferredNestedResourceInfo(ODataNestedResourceInfo
Debug.Assert(this.writingResponse, "Deferred links are only supported in response, we should have verified this already.");

// A deferred nested resource info is just the link metadata, no value.
this.jsonResourceSerializer.WriteNavigationLinkMetadata(nestedResourceInfo, this.DuplicatePropertyNameChecker);
this.jsonResourceSerializer.WriteNavigationLinkMetadata(nestedResourceInfo, this.DuplicatePropertyNameChecker, count: true);
Copy link
Preview

Copilot AI Dec 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The count parameter should be set to false when calling WriteNavigationLinkMetadata for deferred nested resource info.

Suggested change
this.jsonResourceSerializer.WriteNavigationLinkMetadata(nestedResourceInfo, this.DuplicatePropertyNameChecker, count: true);
this.jsonResourceSerializer.WriteNavigationLinkMetadata(nestedResourceInfo, this.DuplicatePropertyNameChecker, count: false);

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
@@ -999,7 +999,7 @@ protected override void StartNestedResourceInfoWithContent(ODataNestedResourceIn
}

// Write the nested resource info metadata first. The rest is written by the content resource or resource set.
this.jsonResourceSerializer.WriteNavigationLinkMetadata(nestedResourceInfo, this.DuplicatePropertyNameChecker);
this.jsonResourceSerializer.WriteNavigationLinkMetadata(nestedResourceInfo, this.DuplicatePropertyNameChecker, count: false);
Copy link
Preview

Copilot AI Dec 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The count parameter should be set to true when calling WriteNavigationLinkMetadata for nested resource info with content.

Suggested change
this.jsonResourceSerializer.WriteNavigationLinkMetadata(nestedResourceInfo, this.DuplicatePropertyNameChecker, count: false);
this.jsonResourceSerializer.WriteNavigationLinkMetadata(nestedResourceInfo, this.DuplicatePropertyNameChecker, count: true);

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
@@ -2038,7 +2038,7 @@ protected override Task WriteDeferredNestedResourceInfoAsync(ODataNestedResource
// A deferred nested resource info is just the link metadata, no value.
return this.jsonResourceSerializer.WriteNavigationLinkMetadataAsync(
nestedResourceInfo,
this.DuplicatePropertyNameChecker);
this.DuplicatePropertyNameChecker, count: true);
Copy link
Preview

Copilot AI Dec 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The count parameter should be set to false when calling WriteNavigationLinkMetadataAsync for deferred nested resource info.

Suggested change
this.DuplicatePropertyNameChecker, count: true);
this.DuplicatePropertyNameChecker, count: false);

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
@@ -2078,7 +2078,7 @@ await this.jsonResourceSerializer.WriteNestedResourceInfoContextUrlAsync(innerNe
// Write the nested resource info metadata first. The rest is written by the content resource or resource set.
await this.jsonResourceSerializer.WriteNavigationLinkMetadataAsync(
innerNestedResourceInfo,
this.DuplicatePropertyNameChecker).ConfigureAwait(false);
this.DuplicatePropertyNameChecker, count: false).ConfigureAwait(false);
Copy link
Preview

Copilot AI Dec 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The count parameter should be set to true when calling WriteNavigationLinkMetadataAsync for nested resource info with content.

Suggested change
this.DuplicatePropertyNameChecker, count: false).ConfigureAwait(false);
this.DuplicatePropertyNameChecker, count: true).ConfigureAwait(false);

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
@WanjohiSammy
Copy link
Contributor

Can you confirm why the build pipeline is failing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable serialize/deserialize navigation property with count without content
2 participants