From d975aeb6144652b527d65074e5f2684cd0babe95 Mon Sep 17 00:00:00 2001 From: Bart Koelman <10324372+bkoelman@users.noreply.github.com> Date: Fri, 1 Aug 2025 17:40:03 +0200 Subject: [PATCH] Change `contentType` parameter in `GetSupportedContentTypes` to nullable --- .../src/ApiExplorer/IApiRequestFormatMetadataProvider.cs | 2 +- .../src/ApiExplorer/IApiResponseTypeMetadataProvider.cs | 2 +- src/Mvc/Mvc.Core/src/Formatters/InputFormatter.cs | 2 +- src/Mvc/Mvc.Core/src/Formatters/OutputFormatter.cs | 2 +- src/Mvc/Mvc.Core/src/PublicAPI.Unshipped.txt | 8 ++++++++ 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Mvc/Mvc.Core/src/ApiExplorer/IApiRequestFormatMetadataProvider.cs b/src/Mvc/Mvc.Core/src/ApiExplorer/IApiRequestFormatMetadataProvider.cs index cfb942053215..50e84006030d 100644 --- a/src/Mvc/Mvc.Core/src/ApiExplorer/IApiRequestFormatMetadataProvider.cs +++ b/src/Mvc/Mvc.Core/src/ApiExplorer/IApiRequestFormatMetadataProvider.cs @@ -25,6 +25,6 @@ public interface IApiRequestFormatMetadataProvider /// /// Content types which are supported by the . IReadOnlyList? GetSupportedContentTypes( - string contentType, + string? contentType, Type objectType); } diff --git a/src/Mvc/Mvc.Core/src/ApiExplorer/IApiResponseTypeMetadataProvider.cs b/src/Mvc/Mvc.Core/src/ApiExplorer/IApiResponseTypeMetadataProvider.cs index c2c05b1746cb..679dbd71cdaa 100644 --- a/src/Mvc/Mvc.Core/src/ApiExplorer/IApiResponseTypeMetadataProvider.cs +++ b/src/Mvc/Mvc.Core/src/ApiExplorer/IApiResponseTypeMetadataProvider.cs @@ -25,6 +25,6 @@ public interface IApiResponseTypeMetadataProvider /// /// Content types which are supported by the . IReadOnlyList? GetSupportedContentTypes( - string contentType, + string? contentType, Type objectType); } diff --git a/src/Mvc/Mvc.Core/src/Formatters/InputFormatter.cs b/src/Mvc/Mvc.Core/src/Formatters/InputFormatter.cs index 2474e63ab177..47a6fa1b5b27 100644 --- a/src/Mvc/Mvc.Core/src/Formatters/InputFormatter.cs +++ b/src/Mvc/Mvc.Core/src/Formatters/InputFormatter.cs @@ -118,7 +118,7 @@ public virtual Task ReadAsync(InputFormatterContext contex public abstract Task ReadRequestBodyAsync(InputFormatterContext context); /// - public virtual IReadOnlyList? GetSupportedContentTypes(string contentType, Type objectType) + public virtual IReadOnlyList? GetSupportedContentTypes(string? contentType, Type objectType) { if (SupportedMediaTypes.Count == 0) { diff --git a/src/Mvc/Mvc.Core/src/Formatters/OutputFormatter.cs b/src/Mvc/Mvc.Core/src/Formatters/OutputFormatter.cs index 362171af2b8c..f14215f6ec28 100644 --- a/src/Mvc/Mvc.Core/src/Formatters/OutputFormatter.cs +++ b/src/Mvc/Mvc.Core/src/Formatters/OutputFormatter.cs @@ -30,7 +30,7 @@ protected virtual bool CanWriteType(Type? type) /// public virtual IReadOnlyList? GetSupportedContentTypes( - string contentType, + string? contentType, Type objectType) { if (SupportedMediaTypes.Count == 0) diff --git a/src/Mvc/Mvc.Core/src/PublicAPI.Unshipped.txt b/src/Mvc/Mvc.Core/src/PublicAPI.Unshipped.txt index 08c1f5142578..1cd6a2b5200c 100644 --- a/src/Mvc/Mvc.Core/src/PublicAPI.Unshipped.txt +++ b/src/Mvc/Mvc.Core/src/PublicAPI.Unshipped.txt @@ -1,8 +1,16 @@ #nullable enable +*REMOVED*Microsoft.AspNetCore.Mvc.ApiExplorer.IApiRequestFormatMetadataProvider.GetSupportedContentTypes(string! contentType, System.Type! objectType) -> System.Collections.Generic.IReadOnlyList? +Microsoft.AspNetCore.Mvc.ApiExplorer.IApiRequestFormatMetadataProvider.GetSupportedContentTypes(string? contentType, System.Type! objectType) -> System.Collections.Generic.IReadOnlyList? Microsoft.AspNetCore.Mvc.ApiExplorer.IApiResponseMetadataProvider.Description.get -> string? +*REMOVED*Microsoft.AspNetCore.Mvc.ApiExplorer.IApiResponseTypeMetadataProvider.GetSupportedContentTypes(string! contentType, System.Type! objectType) -> System.Collections.Generic.IReadOnlyList? +Microsoft.AspNetCore.Mvc.ApiExplorer.IApiResponseTypeMetadataProvider.GetSupportedContentTypes(string? contentType, System.Type! objectType) -> System.Collections.Generic.IReadOnlyList? Microsoft.AspNetCore.Mvc.ProducesAttribute.Description.get -> string? Microsoft.AspNetCore.Mvc.ProducesAttribute.Description.set -> void Microsoft.AspNetCore.Mvc.ProducesDefaultResponseTypeAttribute.Description.get -> string? Microsoft.AspNetCore.Mvc.ProducesDefaultResponseTypeAttribute.Description.set -> void Microsoft.AspNetCore.Mvc.ProducesResponseTypeAttribute.Description.get -> string? Microsoft.AspNetCore.Mvc.ProducesResponseTypeAttribute.Description.set -> void +*REMOVED*virtual Microsoft.AspNetCore.Mvc.Formatters.InputFormatter.GetSupportedContentTypes(string! contentType, System.Type! objectType) -> System.Collections.Generic.IReadOnlyList? +virtual Microsoft.AspNetCore.Mvc.Formatters.InputFormatter.GetSupportedContentTypes(string? contentType, System.Type! objectType) -> System.Collections.Generic.IReadOnlyList? +*REMOVED*virtual Microsoft.AspNetCore.Mvc.Formatters.OutputFormatter.GetSupportedContentTypes(string! contentType, System.Type! objectType) -> System.Collections.Generic.IReadOnlyList? +virtual Microsoft.AspNetCore.Mvc.Formatters.OutputFormatter.GetSupportedContentTypes(string? contentType, System.Type! objectType) -> System.Collections.Generic.IReadOnlyList?