Upgrading Refit 16 to 17
Breaking16.4.0 → 17.0.0Breaking6Platform2Changed4Other8
6 breaking changes and 2 platform requirement changes.
- Code that uses reflection-based clients must now add the Refit.Reflection package, or switch to generated clients.
- Dependency injection setup for reflection-based clients now needs an extra package.
- Default JSON handling is stricter and different from before, so APIs with other wire formats need explicit configuration.
- JSON options no longer work implicitly; you must supply generated metadata or register reflection support.
Refit publishes an official migration guide for version 17. It covers more than the release notes do.
Refit 17 migration guide ↗Target frameworks requirement changed in 17.0.0: .NETFramework4.6.2, .NETFramework4.7, .NETFramework4.7.1, .NETFramework4.7.2, .NETFramework4.8, .NETFramework4.8.1, net10.0, net11.0, net8.0, net9.0 → .NETFramework4.7, .NETFramework4.7.1, .NETFramework4.7.2, .NETFramework4.8, .NETFramework4.8.1, net10.0, net11.0.
Moves reactiveui.primitives 9.0.0 → 10.0.0, system.net.http.json 10.0.13 → 10.0.15, system.net.serversentevents 10.0.13 → 10.0.15, system.text.json 10.0.13 → 10.0.15. Your build may pick other versions.
What you must change
RestService.ForRequestBuilder.ForTypeRestService.ForGeneratedRefit.ReflectionAddRefitClientAddKeyedRefitClientRefit.HttpClientFactory.ReflectionRefit.HttpClientFactoryJsonElementRefit.ReflectionIParameterAttributeProviderGetFieldNameForPropertynet462net8.0net9.0API changes
Generated by DepDelta from published .NET assemblies. Not mixed with prose notes.
- removed:
class ObjectToInferredTypesConverter extends JsonConverter<object> - removed:
class RestMethodParameterInfo - removed:
class RestMethodParameterProperty - removed:
ctor ObjectToInferredTypesConverter() - removed:
ctor RestMethodInfo(string Name, Type HostingType, MethodInfo MethodInfo, string RelativePath, Type ReturnType) - removed:
ctor RestMethodParameterInfo(bool isObjectPropertyParameter, ParameterInfo parameterInfo) - removed:
ctor RestMethodParameterInfo(string name, ParameterInfo parameterInfo) - removed:
ctor RestMethodParameterProperty(string name, IReadOnlyList<PropertyInfo> propertyChain) - removed:
ctor RestMethodParameterProperty(string name, PropertyInfo propertyInfo) - removed:
method IHttpContentSerializer.GetFieldNameForProperty(PropertyInfo propertyInfo): string - removed:
method JsonContentSerializer.GetFieldNameForProperty(PropertyInfo propertyInfo): string - removed:
method ObjectToInferredTypesConverter.Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options): object - removed:
method ObjectToInferredTypesConverter.Write(Utf8JsonWriter writer, object value, JsonSerializerOptions options): void - removed:
method RestMethodInfo.<Clone>$(): RestMethodInfo - removed:
method RestMethodInfo.Deconstruct(out string Name, out Type HostingType, out MethodInfo MethodInfo, out string RelativePath, out Type ReturnType): void - removed:
method RestMethodInfo.Equals(RestMethodInfo other): bool - removed:
method RestMethodInfo.Equals(object obj): bool - removed:
method RestMethodInfo.GetHashCode(): int - removed:
method RestMethodInfo.ToString(): string - removed:
method SystemTextJsonContentSerializer.GetFieldNameForProperty(PropertyInfo propertyInfo): string - removed:
property FormField.ExplicitName: string { get; } - removed:
property RestMethodInfo.HostingType: Type { get; set; } - removed:
property RestMethodInfo.MethodInfo: MethodInfo { get; set; } - removed:
property RestMethodInfo.Name: string { get; set; } - removed:
property RestMethodInfo.RelativePath: string { get; set; } - removed:
property RestMethodInfo.ReturnType: Type { get; set; } - removed:
property RestMethodParameterInfo.IsObjectPropertyParameter: bool { get; set; } - removed:
property RestMethodParameterInfo.Name: string { get; set; } - removed:
property RestMethodParameterInfo.ParameterInfo: ParameterInfo { get; set; } - removed:
property RestMethodParameterInfo.ParameterProperties: List<RestMethodParameterProperty> { get; set; } - removed:
property RestMethodParameterInfo.Type: ParameterType { get; set; } - removed:
property RestMethodParameterProperty.Name: string { get; set; } - removed:
property RestMethodParameterProperty.PropertyChain: IReadOnlyList<PropertyInfo> { get; set; } - removed:
property RestMethodParameterProperty.PropertyInfo: PropertyInfo { get; set; } - removed:
sealed class RestMethodInfo implements IEquatable<RestMethodInfo> - removed:
static class RequestBuilder - removed:
static method RequestBuilder.ForType(Type refitInterfaceType): IRequestBuilder - removed:
static method RequestBuilder.ForType(Type refitInterfaceType, RefitSettings settings): IRequestBuilder - removed:
static method RequestBuilder.ForType<T>(): IRequestBuilder<T> - removed:
static method RequestBuilder.ForType<T>(RefitSettings settings): IRequestBuilder<T> - removed:
static method RestMethodInfo.op_Equality(RestMethodInfo left, RestMethodInfo right): bool - removed:
static method RestMethodInfo.op_Inequality(RestMethodInfo left, RestMethodInfo right): bool - removed:
static method RestService.For(Type refitInterfaceType, HttpClient client): object - removed:
static method RestService.For(Type refitInterfaceType, HttpClient client, IRequestBuilder builder): object - removed:
static method RestService.For(Type refitInterfaceType, HttpClient client, RefitSettings settings): object - removed:
static method RestService.For(Type refitInterfaceType, string hostUrl): object - removed:
static method RestService.For(Type refitInterfaceType, string hostUrl, RefitSettings settings): object - removed:
static method RestService.For<T>(HttpClient client): T - removed:
static method RestService.For<T>(HttpClient client, IRequestBuilder<T> builder): T - removed:
static method RestService.For<T>(HttpClient client, RefitSettings settings): T - removed:
static method RestService.For<T>(string hostUrl): T - removed:
static method RestService.For<T>(string hostUrl, RefitSettings settings): T - changed:
ctor FormField(Func<TBody, object> getter, string clrName, string explicitName, string prefixSegment, string format, CollectionFormat? collectionFormat, bool serializeNull) → ctor FormField(Func<TBody, object> getter, string clrName, FormFieldNames names, string prefixSegment, string format, CollectionFormat? collectionFormat, bool serializeNull) - changed:
method DefaultUrlParameterFormatter.Format(object value, ICustomAttributeProvider attributeProvider, Type type): string → method DefaultUrlParameterFormatter.Format(object value, IParameterAttributeProvider attributeProvider, Type type): string - changed:
method FormField.ResolveFieldName(IUrlParameterKeyFormatter urlParameterKeyFormatter): string → method FormField.ResolveFieldName(IUrlParameterKeyFormatter urlParameterKeyFormatter, ContentSerializerNameStyle nameStyle): string - changed:
method IUrlParameterFormatter.Format(object value, ICustomAttributeProvider attributeProvider, Type type): string → method IUrlParameterFormatter.Format(object value, IParameterAttributeProvider attributeProvider, Type type): string - changed:
sealed class GeneratedParameterAttributeProvider implements ICustomAttributeProvider → sealed class GeneratedParameterAttributeProvider implements IParameterAttributeProvider - changed:
sealed class GeneratedSingleTypeParameterAttributeProvider implements ICustomAttributeProvider → sealed class GeneratedSingleTypeParameterAttributeProvider implements IParameterAttributeProvider - changed:
sealed class SystemTextJsonContentSerializer implements IHttpContentSerializer, IJsonTypeInfoContentSerializer, IStreamingContentSerializer, ISynchronousContentDeserializer, ISynchronousContentSerializer → sealed class SystemTextJsonContentSerializer implements IContentSerializerNameStyle, IHttpContentSerializer, IJsonTypeInfoContentSerializer, IStreamingContentSerializer, ISynchronousContentDeserializer, ISynchronousContentSerializer - changed:
static method GeneratedRequestRunner.AddFormattedCollectionProperty(ref GeneratedQueryStringBuilder builder, RefitSettings settings, IEnumerable values, string key, CollectionFormat collectionFormat, bool preEncoded, ValueTuple<Type, ICustomAttributeProvider, Type> formatting): void → static method GeneratedRequestRunner.AddFormattedCollectionProperty(ref GeneratedQueryStringBuilder builder, RefitSettings settings, IEnumerable values, string key, CollectionFormat collectionFormat, bool preEncoded, ValueTuple<Type, IParameterAttributeProvider, Type> formatting): void - changed:
static method GeneratedRequestRunner.FormatUrlParameter(RefitSettings settings, object value, ICustomAttributeProvider attributeProvider, Type type): string → static method GeneratedRequestRunner.FormatUrlParameter(RefitSettings settings, object value, IParameterAttributeProvider attributeProvider, Type type): string - changed:
static method GeneratedRequestRunner.RoundTripEscapePath(string value, RefitSettings settings, ICustomAttributeProvider attributeProvider, Type type): string → static method GeneratedRequestRunner.RoundTripEscapePath(string value, RefitSettings settings, IParameterAttributeProvider attributeProvider, Type type): string - added:
ctor FormFieldNames(string ExplicitName, string JsonName, string NewtonsoftName, string XmlName) - added:
enum ContentSerializerNameStyle - added:
interface IContentSerializerNameStyle - added:
interface IParameterAttributeProvider - added:
member ContentSerializerNameStyle.Newtonsoft - added:
member ContentSerializerNameStyle.SystemTextJson - added:
member ContentSerializerNameStyle.Xml - added:
method FormFieldNames.Deconstruct(out string ExplicitName, out string JsonName, out string NewtonsoftName, out string XmlName): void - added:
method FormFieldNames.Equals(FormFieldNames other): bool - added:
method FormFieldNames.Equals(object obj): bool - added:
method FormFieldNames.ForStyle(ContentSerializerNameStyle nameStyle): string - added:
method FormFieldNames.GetHashCode(): int - added:
method FormFieldNames.ToString(): string - added:
method IParameterAttributeProvider.GetCustomAttributes(Type attributeType, bool inherit): object[] - added:
method IParameterAttributeProvider.GetCustomAttributes(bool inherit): object[] - added:
method IParameterAttributeProvider.IsDefined(Type attributeType, bool inherit): bool - added:
property FormField.Names: FormFieldNames { get; } - added:
property FormFieldNames.ExplicitName: string { get; set; } - added:
property FormFieldNames.JsonName: string { get; set; } - added:
property FormFieldNames.NewtonsoftName: string { get; set; } - added:
property FormFieldNames.XmlName: string { get; set; } - added:
property IContentSerializerNameStyle.NameStyle: ContentSerializerNameStyle { get; } - added:
property SystemTextJsonContentSerializer.NameStyle: ContentSerializerNameStyle { get; } - added:
static method FormFieldNames.op_Equality(FormFieldNames left, FormFieldNames right): bool - added:
static method FormFieldNames.op_Inequality(FormFieldNames left, FormFieldNames right): bool - added:
static method GeneratedRequestRunner.BuildFormKey(RefitSettings settings, string clrName, string explicitName, string jsonName, string newtonsoftName, string xmlName, string prefixSegment): string - added:
struct FormFieldNames implements IEquatable<FormFieldNames>