-
-
Notifications
You must be signed in to change notification settings - Fork 747
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
Added JsonSerializerSettings to refitSettings #80
Conversation
Refits will now use a jsonSerializerSettings object to control how to serialize objects.
Cool. I've been meaning to add this myself.
|
} | ||
|
||
public JsonSerializerSettings SerializerSettings { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Name this property JsonSerializerSettings
, just so it's clearer it won't do anything at all for form posts.
default(T); | ||
} | ||
|
||
public static async Task<ApiException> Create(HttpResponseMessage response) | ||
public static async Task<ApiException> Create(HttpResponseMessage response,JsonSerializerSettings settings) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add another overload here that has the original signature? Otherwise we break API compatibility
I've added some text to the readme and fixed most of the spacing issues. I personally am not sure about why ApiException and RestMethodInfo are public. I think that allowing them to break isn't so bad. They seem like candidates to be private to me. Unless the intent is that people can override RestBuilderImplementation. (Which would be very arduous). |
DefaultSettings is apparently null if never set.
My guess is |
might be beneficial to isolate the settings for calls to a particular API. | ||
When creating a Refit generated live interface, you may optionally pass a | ||
`RefitSettings` that will allow you to specify what serializer settings you | ||
would like. This allows you to have different serializer settings for seperate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"separate"
Great documentation though! 👍
Removed dangerous initializing statement.
👍 Awesome. |
Anything else you guys see as outstanding issues? |
A test that proves it works (and more importantly, will tell us if we accidentally break it in future) 😉 |
My tests make it so the default setting is configured to CamelCase forcing the property to be used or fail.
I added a few unit tests based on the existing ones for the github api. |
I'm into it. Thanks @mburbea! |
Added JsonSerializerSettings to refitSettings
Refits will now use a jsonSerializerSettings object to control how to
serialize objects.
This allows the refit settings to be more finely tuned without abusing global state. That way if I want to set that my Refit for this api uses CamelCase, but for another api uses SnakeCase I don't have to worry about them colliding on each other.