From bda72af583f72d6936d773cdc856cc1212e92b25 Mon Sep 17 00:00:00 2001 From: Xavier Date: Fri, 11 Apr 2025 10:41:20 -0700 Subject: [PATCH 1/3] Update Microsoft.AspNetCore.OData package reference to support v 9.2.1 --- .../OData/ODataAdvancedExample/ODataAdvancedExample.csproj | 4 ++++ .../OData/ODataBasicExample/ODataBasicExample.csproj | 4 ++++ .../ODataConventionsExample/ODataConventionsExample.csproj | 4 ++++ .../OData/ODataOpenApiExample/ODataOpenApiExample.csproj | 4 ++++ .../SomeODataOpenApiExample/SomeODataOpenApiExample.csproj | 4 ++++ .../Conventions/ODataAttributeVisitor.cs | 2 +- .../Asp.Versioning.OData.ApiExplorer.csproj | 4 ++-- .../src/Asp.Versioning.OData/Asp.Versioning.OData.csproj | 6 +++--- .../OData/ODataApplicationModelProvider.cs | 2 +- .../ApiExplorer/ODataApiDescriptionProviderTest.cs | 4 ++-- .../ApplicationModels/DefaultApiControllerFilter.cs | 4 ++-- .../Conventions/ODataAttributeVisitor.cs | 4 ++-- 12 files changed, 33 insertions(+), 13 deletions(-) diff --git a/examples/AspNetCore/OData/ODataAdvancedExample/ODataAdvancedExample.csproj b/examples/AspNetCore/OData/ODataAdvancedExample/ODataAdvancedExample.csproj index ecccb3a9..f990c588 100644 --- a/examples/AspNetCore/OData/ODataAdvancedExample/ODataAdvancedExample.csproj +++ b/examples/AspNetCore/OData/ODataAdvancedExample/ODataAdvancedExample.csproj @@ -4,4 +4,8 @@ + + + + \ No newline at end of file diff --git a/examples/AspNetCore/OData/ODataBasicExample/ODataBasicExample.csproj b/examples/AspNetCore/OData/ODataBasicExample/ODataBasicExample.csproj index 6bdc8cef..389b3dc6 100644 --- a/examples/AspNetCore/OData/ODataBasicExample/ODataBasicExample.csproj +++ b/examples/AspNetCore/OData/ODataBasicExample/ODataBasicExample.csproj @@ -4,4 +4,8 @@ + + + + \ No newline at end of file diff --git a/examples/AspNetCore/OData/ODataConventionsExample/ODataConventionsExample.csproj b/examples/AspNetCore/OData/ODataConventionsExample/ODataConventionsExample.csproj index ecccb3a9..f990c588 100644 --- a/examples/AspNetCore/OData/ODataConventionsExample/ODataConventionsExample.csproj +++ b/examples/AspNetCore/OData/ODataConventionsExample/ODataConventionsExample.csproj @@ -4,4 +4,8 @@ + + + + \ No newline at end of file diff --git a/examples/AspNetCore/OData/ODataOpenApiExample/ODataOpenApiExample.csproj b/examples/AspNetCore/OData/ODataOpenApiExample/ODataOpenApiExample.csproj index 3bffcf5e..af705328 100644 --- a/examples/AspNetCore/OData/ODataOpenApiExample/ODataOpenApiExample.csproj +++ b/examples/AspNetCore/OData/ODataOpenApiExample/ODataOpenApiExample.csproj @@ -12,4 +12,8 @@ + + + + \ No newline at end of file diff --git a/examples/AspNetCore/OData/SomeODataOpenApiExample/SomeODataOpenApiExample.csproj b/examples/AspNetCore/OData/SomeODataOpenApiExample/SomeODataOpenApiExample.csproj index 3bffcf5e..af705328 100644 --- a/examples/AspNetCore/OData/SomeODataOpenApiExample/SomeODataOpenApiExample.csproj +++ b/examples/AspNetCore/OData/SomeODataOpenApiExample/SomeODataOpenApiExample.csproj @@ -12,4 +12,8 @@ + + + + \ No newline at end of file diff --git a/src/AspNet/OData/src/Asp.Versioning.WebApi.OData.ApiExplorer/Conventions/ODataAttributeVisitor.cs b/src/AspNet/OData/src/Asp.Versioning.WebApi.OData.ApiExplorer/Conventions/ODataAttributeVisitor.cs index 1c1a2f49..410f48ff 100644 --- a/src/AspNet/OData/src/Asp.Versioning.WebApi.OData.ApiExplorer/Conventions/ODataAttributeVisitor.cs +++ b/src/AspNet/OData/src/Asp.Versioning.WebApi.OData.ApiExplorer/Conventions/ODataAttributeVisitor.cs @@ -13,6 +13,6 @@ private void VisitAction( HttpActionDescriptor action ) var attributes = new List( controller.GetCustomAttributes( inherit: true ) ); attributes.AddRange( action.GetCustomAttributes( inherit: true ) ); - VisitEnableQuery( attributes ); + VisitEnableQuery( attributes.ToArray() ); } } \ No newline at end of file diff --git a/src/AspNetCore/OData/src/Asp.Versioning.OData.ApiExplorer/Asp.Versioning.OData.ApiExplorer.csproj b/src/AspNetCore/OData/src/Asp.Versioning.OData.ApiExplorer/Asp.Versioning.OData.ApiExplorer.csproj index c78ccdc9..a443fa16 100644 --- a/src/AspNetCore/OData/src/Asp.Versioning.OData.ApiExplorer/Asp.Versioning.OData.ApiExplorer.csproj +++ b/src/AspNetCore/OData/src/Asp.Versioning.OData.ApiExplorer/Asp.Versioning.OData.ApiExplorer.csproj @@ -1,8 +1,8 @@  - 8.1.0 - 8.1.0.0 + 8.2.0 + 8.2.0.0 $(DefaultTargetFramework) Asp.Versioning ASP.NET Core API Versioning API Explorer for OData v4.0 diff --git a/src/AspNetCore/OData/src/Asp.Versioning.OData/Asp.Versioning.OData.csproj b/src/AspNetCore/OData/src/Asp.Versioning.OData/Asp.Versioning.OData.csproj index cec744b0..1e87e465 100644 --- a/src/AspNetCore/OData/src/Asp.Versioning.OData/Asp.Versioning.OData.csproj +++ b/src/AspNetCore/OData/src/Asp.Versioning.OData/Asp.Versioning.OData.csproj @@ -1,8 +1,8 @@  - 8.1.0 - 8.1.0.0 + 8.2.0 + 8.2.0.0 $(DefaultTargetFramework) Asp.Versioning ASP.NET Core API Versioning with OData v4.0 @@ -15,7 +15,7 @@ - + diff --git a/src/AspNetCore/OData/src/Asp.Versioning.OData/OData/ODataApplicationModelProvider.cs b/src/AspNetCore/OData/src/Asp.Versioning.OData/OData/ODataApplicationModelProvider.cs index 402da34d..9ef71b7b 100644 --- a/src/AspNetCore/OData/src/Asp.Versioning.OData/OData/ODataApplicationModelProvider.cs +++ b/src/AspNetCore/OData/src/Asp.Versioning.OData/OData/ODataApplicationModelProvider.cs @@ -141,7 +141,7 @@ private static return (metadataControllers, supported, deprecated); } - private static ControllerModel? SelectBestMetadataController( IReadOnlyList controllers ) + private static ControllerModel? SelectBestMetadataController( List controllers ) { // note: there should be at least 2 metadata controllers, but there could be 3+ // if a developer defines their own custom controller. ultimately, there can be diff --git a/src/AspNetCore/OData/test/Asp.Versioning.OData.ApiExplorer.Tests/ApiExplorer/ODataApiDescriptionProviderTest.cs b/src/AspNetCore/OData/test/Asp.Versioning.OData.ApiExplorer.Tests/ApiExplorer/ODataApiDescriptionProviderTest.cs index 511513b4..532abb00 100644 --- a/src/AspNetCore/OData/test/Asp.Versioning.OData.ApiExplorer.Tests/ApiExplorer/ODataApiDescriptionProviderTest.cs +++ b/src/AspNetCore/OData/test/Asp.Versioning.OData.ApiExplorer.Tests/ApiExplorer/ODataApiDescriptionProviderTest.cs @@ -256,9 +256,9 @@ private static void AssertQueryOptionWithoutOData( ApiDescription description, s parameter.ModelMetadata.Description.Should().EndWith( suffix + '.' ); } - private void PrintGroup( IReadOnlyList items ) + private void PrintGroup( ApiDescription[] items ) { - for ( var i = 0; i < items.Count; i++ ) + for ( var i = 0; i < items.Length; i++ ) { var item = items[i]; console.WriteLine( $"[{item.GroupName}] {item.HttpMethod} {item.RelativePath}" ); diff --git a/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/ApplicationModels/DefaultApiControllerFilter.cs b/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/ApplicationModels/DefaultApiControllerFilter.cs index e8d851be..a8a1d46e 100644 --- a/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/ApplicationModels/DefaultApiControllerFilter.cs +++ b/src/AspNetCore/WebApi/src/Asp.Versioning.Mvc/ApplicationModels/DefaultApiControllerFilter.cs @@ -10,7 +10,7 @@ namespace Asp.Versioning.ApplicationModels; [CLSCompliant( false )] public sealed class DefaultApiControllerFilter : IApiControllerFilter { - private readonly IReadOnlyList specifications; + private readonly List specifications; /// /// Initializes a new instance of the class. @@ -19,7 +19,7 @@ public sealed class DefaultApiControllerFilter : IApiControllerFilter /// specifications used by the filter /// to identify API controllers. public DefaultApiControllerFilter( IEnumerable specifications ) => - this.specifications = specifications.ToArray(); + this.specifications = specifications.ToList(); /// public IList Apply( IList controllers ) diff --git a/src/Common/src/Common.OData.ApiExplorer/Conventions/ODataAttributeVisitor.cs b/src/Common/src/Common.OData.ApiExplorer/Conventions/ODataAttributeVisitor.cs index 7cb50224..fd973fe6 100644 --- a/src/Common/src/Common.OData.ApiExplorer/Conventions/ODataAttributeVisitor.cs +++ b/src/Common/src/Common.OData.ApiExplorer/Conventions/ODataAttributeVisitor.cs @@ -76,11 +76,11 @@ private void VisitModel( IEdmStructuredType modelType ) VisitMaxTop( querySettings ); } - private void VisitEnableQuery( IReadOnlyList attributes ) + private void VisitEnableQuery( EnableQueryAttribute[] attributes ) { var @default = new EnableQueryAttribute(); - for ( var i = 0; i < attributes.Count; i++ ) + for ( var i = 0; i < attributes.Length; i++ ) { var attribute = attributes[i]; From 393387bc8cfaf33d95a9efbe6f666abe7e18f408 Mon Sep 17 00:00:00 2001 From: Xavier Date: Fri, 11 Apr 2025 10:44:48 -0700 Subject: [PATCH 2/3] Remove direct reference to Odata 9.2.1 --- .../OData/ODataAdvancedExample/ODataAdvancedExample.csproj | 4 ---- .../OData/ODataBasicExample/ODataBasicExample.csproj | 4 ---- .../ODataConventionsExample/ODataConventionsExample.csproj | 4 ---- .../OData/ODataOpenApiExample/ODataOpenApiExample.csproj | 4 ---- .../SomeODataOpenApiExample/SomeODataOpenApiExample.csproj | 4 ---- 5 files changed, 20 deletions(-) diff --git a/examples/AspNetCore/OData/ODataAdvancedExample/ODataAdvancedExample.csproj b/examples/AspNetCore/OData/ODataAdvancedExample/ODataAdvancedExample.csproj index f990c588..ecccb3a9 100644 --- a/examples/AspNetCore/OData/ODataAdvancedExample/ODataAdvancedExample.csproj +++ b/examples/AspNetCore/OData/ODataAdvancedExample/ODataAdvancedExample.csproj @@ -4,8 +4,4 @@ - - - - \ No newline at end of file diff --git a/examples/AspNetCore/OData/ODataBasicExample/ODataBasicExample.csproj b/examples/AspNetCore/OData/ODataBasicExample/ODataBasicExample.csproj index 389b3dc6..6bdc8cef 100644 --- a/examples/AspNetCore/OData/ODataBasicExample/ODataBasicExample.csproj +++ b/examples/AspNetCore/OData/ODataBasicExample/ODataBasicExample.csproj @@ -4,8 +4,4 @@ - - - - \ No newline at end of file diff --git a/examples/AspNetCore/OData/ODataConventionsExample/ODataConventionsExample.csproj b/examples/AspNetCore/OData/ODataConventionsExample/ODataConventionsExample.csproj index f990c588..ecccb3a9 100644 --- a/examples/AspNetCore/OData/ODataConventionsExample/ODataConventionsExample.csproj +++ b/examples/AspNetCore/OData/ODataConventionsExample/ODataConventionsExample.csproj @@ -4,8 +4,4 @@ - - - - \ No newline at end of file diff --git a/examples/AspNetCore/OData/ODataOpenApiExample/ODataOpenApiExample.csproj b/examples/AspNetCore/OData/ODataOpenApiExample/ODataOpenApiExample.csproj index af705328..3bffcf5e 100644 --- a/examples/AspNetCore/OData/ODataOpenApiExample/ODataOpenApiExample.csproj +++ b/examples/AspNetCore/OData/ODataOpenApiExample/ODataOpenApiExample.csproj @@ -12,8 +12,4 @@ - - - - \ No newline at end of file diff --git a/examples/AspNetCore/OData/SomeODataOpenApiExample/SomeODataOpenApiExample.csproj b/examples/AspNetCore/OData/SomeODataOpenApiExample/SomeODataOpenApiExample.csproj index af705328..3bffcf5e 100644 --- a/examples/AspNetCore/OData/SomeODataOpenApiExample/SomeODataOpenApiExample.csproj +++ b/examples/AspNetCore/OData/SomeODataOpenApiExample/SomeODataOpenApiExample.csproj @@ -12,8 +12,4 @@ - - - - \ No newline at end of file From 7ab3370d0e3d2eab36abed51a8975ef57419845f Mon Sep 17 00:00:00 2001 From: Xavier Date: Fri, 11 Apr 2025 13:29:45 -0700 Subject: [PATCH 3/3] Update the readme text. --- examples/AspNetCore/OData/Directory.Build.props | 2 +- .../OData/src/Asp.Versioning.OData.ApiExplorer/ReleaseNotes.txt | 2 +- .../OData/src/Asp.Versioning.OData/Asp.Versioning.OData.csproj | 2 +- src/AspNetCore/OData/src/Asp.Versioning.OData/ReleaseNotes.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/AspNetCore/OData/Directory.Build.props b/examples/AspNetCore/OData/Directory.Build.props index 302bad37..0c6cf639 100644 --- a/examples/AspNetCore/OData/Directory.Build.props +++ b/examples/AspNetCore/OData/Directory.Build.props @@ -4,7 +4,7 @@ - + \ No newline at end of file diff --git a/src/AspNetCore/OData/src/Asp.Versioning.OData.ApiExplorer/ReleaseNotes.txt b/src/AspNetCore/OData/src/Asp.Versioning.OData.ApiExplorer/ReleaseNotes.txt index 5f282702..b5318606 100644 --- a/src/AspNetCore/OData/src/Asp.Versioning.OData.ApiExplorer/ReleaseNotes.txt +++ b/src/AspNetCore/OData/src/Asp.Versioning.OData.ApiExplorer/ReleaseNotes.txt @@ -1 +1 @@ - \ No newline at end of file +Support OData 9.0 ([#1103](https://github.com/dotnet/aspnet-api-versioning/issues/1103)) \ No newline at end of file diff --git a/src/AspNetCore/OData/src/Asp.Versioning.OData/Asp.Versioning.OData.csproj b/src/AspNetCore/OData/src/Asp.Versioning.OData/Asp.Versioning.OData.csproj index 1e87e465..e69c80d7 100644 --- a/src/AspNetCore/OData/src/Asp.Versioning.OData/Asp.Versioning.OData.csproj +++ b/src/AspNetCore/OData/src/Asp.Versioning.OData/Asp.Versioning.OData.csproj @@ -15,7 +15,7 @@ - + diff --git a/src/AspNetCore/OData/src/Asp.Versioning.OData/ReleaseNotes.txt b/src/AspNetCore/OData/src/Asp.Versioning.OData/ReleaseNotes.txt index 5f282702..b5318606 100644 --- a/src/AspNetCore/OData/src/Asp.Versioning.OData/ReleaseNotes.txt +++ b/src/AspNetCore/OData/src/Asp.Versioning.OData/ReleaseNotes.txt @@ -1 +1 @@ - \ No newline at end of file +Support OData 9.0 ([#1103](https://github.com/dotnet/aspnet-api-versioning/issues/1103)) \ No newline at end of file