-
Notifications
You must be signed in to change notification settings - Fork 709
OData routing causing exception with versioned API endpoints #1122
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
Comments
If you have the world's simplest repro, that would be really useful in troubleshooting; otherwise, I can try to recreate what you've shown so far. |
Sorry, I don't have a repro that I can provide. I'd have to work on putting something together this week when I get some time. |
I've managed to put a simple repro together: https://drive.google.com/drive/folders/1Fj3RF18jn8USoJQcQD5BubsthFD-7kix?usp=drive_link Let me know if you need anything further. |
@commonsensesoftware any chance you've been able to look into this? |
Thanks for the repro. Sorry about the delay. It's hard for me to say exactly what's going on with the route template generation. Without spending a bunch more time on it, I suspect it's a bug in OData. I've seen it before. The first pass is valid, but the second pass somehow has a dirty state and generates the wrong prefix. Honestly, you must conform to the OData routing convention even if you specify Here's your repro with a few modifications that should have it working. I added a few notes as comments also. I hope that helps unblock you. |
Really appreciate you getting back to me on this, I've now managed to get everything working as required. I can see what you mean about conforming to the routing conventions, so now that I know that I can work around it. Thanks again. |
I have inherited a .NET 6 Web API project utilising OData and the Asp.Versioning packages. The versioning functionality was not 100% correct, and now that the project is required for more regular usage, I want to implement the versioning correctly.
The issue I am hitting is this runtime exception:
My controllers look like:
and
My Startup.cs has the following configuration:
and my EDM configuration is as follows:
Right now there is no difference between models for v1 and v2, this is purely to test functionality.
I'm trusting that the above configuration is automatically registered for DI as per the last section on this page: https://github.com/dotnet/aspnet-api-versioning/wiki/OData-Model-Configurations
I feel like there is some small piece of config that I've missed, but struggling to find what that might be.
The text was updated successfully, but these errors were encountered: