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 #580 #978

Open
wants to merge 1 commit into
base: release-8.x
Choose a base branch
from
Open

fixes #580 #978

wants to merge 1 commit into from

Conversation

mirgil
Copy link

@mirgil mirgil commented Jul 2, 2023

No description provided.

@mirgil
Copy link
Author

mirgil commented Jul 2, 2023

@mirgil please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@microsoft-github-policy-service agree

@@ -39,7 +39,9 @@ public override JsonConverter CreateConverter(Type type, JsonSerializerOptions o

if (generaticType == typeof(PageResult<>))
{
return (JsonConverter)Activator.CreateInstance(typeof(PageResultConverter<>).MakeGenericType(new Type[] { entityType }));
return (JsonConverter)Activator.CreateInstance(
Copy link
Member

Choose a reason for hiding this comment

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

do the same thing for Newtonsoft.JSON.OData project class?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hey @mirgil. Did you see Sam's comment here? @xuzhg Can you point the contributor to the class in the Netwtonsoft project where they need to apply a similar change?

Copy link
Member

@mikepizzo mikepizzo left a comment

Choose a reason for hiding this comment

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

I believe the protocol expects these to be lower camel case. If so, changing this would be non-compliant.

@mirgil
Copy link
Author

mirgil commented Aug 6, 2023

I believe the protocol expects these to be lower camel case. If so, changing this would be non-compliant.

Which protocol?
Serialization should be done according to the JsonSerializerOptions.PropertyNamingPolicy.
If no policy is defined, the original property (name and case) should be used.

@gathogojr
Copy link
Contributor

I believe the protocol expects these to be lower camel case. If so, changing this would be non-compliant.

@mikepizzo I might be wrong but I think that the PageResultValueConverter is applicable in non-EDM scenarios - I don't think the items, nextpagelink and count property names used currently have anything to do with OData standard. @xuzhg can correct me if I'm wrong. Be that as it may, this PR has no tests to validate the changes.

Thank you @mirgil for you contribution. Could you please add tests to validate the changes?

@wachugamaina
Copy link

Please provide a description of the problem and how this fixes it in the pr description.

public override PageResult<TEntity> Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
Contract.Assert(false, "PageResult{TEntity} should never be deserialized into");
throw new NotImplementedException();
}

private string GetConvertedName(string name)
{
if (_namingPolicy == null)

Choose a reason for hiding this comment

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

        if (_namingPolicy == null)
        {
            return name;
        }

       return _namingPolicy.ConvertName(name);

@wachugamaina
Copy link

Could we have some tests for the new functionality ?

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.

5 participants