aspnet-api-versioning icon indicating copy to clipboard operation
aspnet-api-versioning copied to clipboard

Functions not working (404) with explicit routing conventions

Open pil0t opened this issue 4 years ago • 2 comments
trafficstars

Hello, I have a custom routing convention, and it worked perfectly fine with .net 3.1, but during migration to .net 5 I faced with error.

Simple steps to reproduce:

In the MapVersionedODataRoute (https://github.com/microsoft/aspnet-api-versioning/blob/beed143f753dc0e5d4b6a1abcd27ff9873e9d0c6/samples/aspnetcore/SwaggerODataSample/Startup.cs#L78) I have changed to:

                var routingConventions = VersionedODataRoutingConventions.CreateDefault();
                endpoints.MapVersionedODataRoute( "odata", "api/v{version:apiVersion}",
                    modelBuilder.GetEdmModels(),
                    new DefaultODataPathHandler(),
                    routingConventions );

Almost everything works fine after this, except functions - they return 404. Is this a bug or expected behavior?

in my case I adding extra item to routingConventions but it does not affect behavior, with or without adding extra item - still 404.

pil0t avatar Feb 07 '21 09:02 pil0t

This is hard to tell. API Versioning doesn't officially support OData on .NET 5 because OData doesn't officially support it either. OData has some pre-releases, but I don't have capacity to chase them. OData 8.0 (last I checked) introduces a whole new set of breaking changes I have to refactor to. I don't have a time table for it.

All that said, you might be able to get things to work, but there's no guarantees. I'm not sure which combination of packages you are using are, but if most things are working, I wouldn't be surprised if it wasn't on the OData side.

Unfortunately, I don't have a better answer than that for the time being.

commonsensesoftware avatar Apr 01 '21 05:04 commonsensesoftware

Did you ever solve this? There are a number of test cases and the OpenAPI/Swagger example demonstrate the use of numerous OData functions. You custom convention shouldn't be affecting that, but you should be able to try it without it first to confirm the basic stuff works. If you're still trying to use .NET 5.0, I'm afraid that still isn't officially supported. It looks like the OData team may have their release out soon, which will enable to me to start a new major version.

commonsensesoftware avatar Jun 24 '21 06:06 commonsensesoftware

This thread appears to have ended.

6.0 has been released and contains a ton of fixes and new features, including support for OData 8x. and .NET 6.0. In all likelihood, upgrading to that path will produce better results for you. If that doesn't work or you've got some updates to share, I'm happy to reopen the issue and investigate further.

commonsensesoftware avatar Aug 24 '22 01:08 commonsensesoftware