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

Adding to JsonNetSerializer ctor accepting JsonSerializer #120

Merged
merged 6 commits into from
Jul 5, 2017

Conversation

abatishchev
Copy link
Member

@abatishchev abatishchev commented Jun 23, 2017

Addresses #119.

  • Adding to JsonNetSerializer ctor accepting JsonSerializer
  • Removing the beta prefix from nuget version
  • Replacing xml docs on methods with <inheritdoc />
  • Soring usings in tests

@abatishchev abatishchev changed the title Json ser ctor Adding to JsonNetSerializer ctor accepting JsonSerializer Jun 23, 2017
@abatishchev abatishchev added this to the 3.0 milestone Jun 23, 2017
@abatishchev abatishchev requested a review from nbarbettini June 23, 2017 18:57
@abatishchev abatishchev self-assigned this Jun 23, 2017
Copy link
Contributor

@nbarbettini nbarbettini left a comment

Choose a reason for hiding this comment

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

LGTM

@abatishchev
Copy link
Member Author

@PureKrome will this work for you?

/// <inheritdoc />
public string Serialize(object obj)
{
return JObject.FromObject(obj, _serializer).ToString(Formatting.None);
Copy link
Contributor

Choose a reason for hiding this comment

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

Would the Formatting.None override any formatting settings in the _serializer ?

Copy link
Member Author

Choose a reason for hiding this comment

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

IDK. Can you please try with your settings and see whether it works?

Copy link
Member Author

Choose a reason for hiding this comment

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

@PureKrome ping

Copy link
Contributor

Choose a reason for hiding this comment

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

Appols - RL > everything else right now. I'll give it a crack, tonight. watch this space :)

Copy link
Contributor

Choose a reason for hiding this comment

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

@abatishchev I feel like the formatting is ignored during the FromObject stage. And unfortunately, needs to be applied to the ToString() stage.

so ...

return JObject.FromObject(obj, _serializer).ToString(_serializer.Formatting);

BUT! because of me checking out that overload in the ToString() .. there's also a converters input param... which means this is also valid.

return JObject.FromObject(obj, _serializer).ToString(_serializer.Formatting, _serializer.Converters.ToArray());

This is me testing various permutations over the last 30-60 mins.
I've also ref'd these:

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh . that said ...

I couldn't find an online token decoder that RESPECTED the json formatting which was encoded into the JWT. All the online decoders I think formatted the json nicely for me (which makes all of this testing, hardish)

Copy link
Member Author

Choose a reason for hiding this comment

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

Check it out now

Copy link
Contributor

Choose a reason for hiding this comment

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

This LGTM 👍 I'm hoping the additions are actually worth it to other people 😊

Copy link
Member Author

Choose a reason for hiding this comment

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

One can only hope :-D

_serializer = serializer ?? throw new ArgumentNullException(nameof(serializer));
}

/// <inheritdoc />
Copy link
Contributor

Choose a reason for hiding this comment

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

TIL: inheritdoc 👍

@abatishchev abatishchev merged commit d639be2 into master Jul 5, 2017
@abatishchev abatishchev deleted the json-ser-ctor branch July 5, 2017 00:59
@abatishchev
Copy link
Member Author

Pushed to NuGet as 3.0.0

@abatishchev
Copy link
Member Author

abatishchev commented Jul 5, 2017

@nbarbettini do you know how it happened that nuget dependency on json.net is now 10.0.2? Thought it's 6.0.4 (the one that the latest WebApi and MVC have).

@PureKrome
Copy link
Contributor

it's been v9 and v10 for a bit....

@nbarbettini
Copy link
Contributor

I set it to 10.0.2 in #72, but it looks like it was already there before (in the old project file).

@abatishchev
Copy link
Member Author

It seems that v3 always targeted v10 while v2 targets v6

@nbarbettini
Copy link
Contributor

I think it was here? dd35710#diff-091a88bfcd5c1e8f92f4596998c71e86 (at least 9 -> 10)

@abatishchev
Copy link
Member Author

I just might forget. IIRC we were discussing building against the latest version. So it got propagated into the nuspec automatically. But I'd still require not more than 6.0.4 go give people more choices, do not force 10.0 without real need.

@abatishchev
Copy link
Member Author

Folks, do you know how binary reference the latest but nuget reference the lowest?

@nbarbettini
Copy link
Contributor

Folks, do you know how binary reference the latest but nuget reference the lowest?

I don't know how to do it in .NET Standard, sorry.

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

Successfully merging this pull request may close these issues.

3 participants