Skip to content

Odata action name breaks endpoint #689

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

Closed
anranruye opened this issue Nov 3, 2020 · 3 comments
Closed

Odata action name breaks endpoint #689

anranruye opened this issue Nov 3, 2020 · 3 comments

Comments

@anranruye
Copy link

I just transfer to endpoint middleware odata route config with the new release api versioning 5.0.0.

I find that some of my httpget methods don't work. These methods have names like 'GetOrders'. While 'Get' and 'GetOrder' are ok. All other names failed even if work with OdataRoute attribute.

then I try to reproduce this in the OdataSwaggerSample project and it happens. but it doesn't happen in aspnetcore odata sample project without api versioning.

@commonsensesoftware
Copy link
Collaborator

commonsensesoftware commented Nov 3, 2020

Do you have a repro or further details you can share? It sounds like it may be a mismatch in the expected OData conventions (which are out of my control). If you have a particular change in the sample project, I can use that to repro/investigate.

@anranruye
Copy link
Author

anranruye commented Nov 4, 2020

@commonsensesoftware

Base on the AspNetCore SwaggerODataSample project, just change method name 'Get' of the first mehtod in OrdersController (V2 or V3) to 'GetOrders' and run the project. Then this endpoint disappears from api document and doesn't work(report UnsupportedApiVersion error with 400 status code) .

For further research, i remove v1 and v2 controllers from the project and work with the v3 OrdersController.The api explorer can only recognize 'Get' and 'GetOrder' methods even if there is a [ODataRoute] attribute. Changing the first method of OrdersController to 'GetOrder' makes it appear in api document but it doesn't work. The first mehtod which returns entity collection can only work with method name 'Get'.The second method which returns single entity can only work with method names 'Get' and 'GetOrder'.All other method names failed even if there is a [ODataRoute] attribute.When only change the name of one of the two 'Get' methods, UnsupportedApiVersion error with 400 status code is reported. When change two method names or change one name then remove another method, 404 Not Found is reported.

Next step, I remove all api versioning related codes, any mehtod names work correctly with [ODataRoute] attribute. I am sure this is a problem with api versioning libraries rather than odata libraries.

@anranruye
Copy link
Author

Changing UseEndpoints to UseMvc doesn't help.

Another interesting thing, after put v1 or v2 controllers back, 404 not found response changes to UnsupportedApiVersion error with 405 Method Not Allowed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants