-
Notifications
You must be signed in to change notification settings - Fork 712
Microsoft.AspNetCore.OData.Versioning.ApiExplorer 5.0.0 + SwaggerGen does not display ODataController actions #698
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
repo may be found here https://github.com/engenb/AspNetCore.OData.Issues I created two sample proejcts with relevant framework components configured as in my app: each project has the same code - I copy/pasted the project contents from the working to non-working project. steps to reproduce:
some notes from my investigation:
if there's any other information I can provide, I'm happy to help. thanks, @commonsensesoftware |
Thanks for the repro[s]; they will be helpful. I'll start with "there's definitely a combination things all work." I wouldn't ship otherwise. The rules, combinations, and documentation for OData is ... how do I say this tactfully ... not so good. This is more true than ever with the OData support for Endpoint Routing (which is really a dog and pony show under the hood). It has very few sample configurations beyond the most basic of setups. Even the littlest of missteps and things can go sideways. My real bane in supporting OData is the number of significant changes it undergoes. It's often really hard for me to tell whether it's a bug/regression in OData, an expected change in behavior, or a bug in API Versioning - which occasionally does happen (90% of the issues are OData-related these days). I'm an imperfect being and I rewrite imperfect code. I won't be surprised if I've made a mistake somewhere, but it will take some time to investigate (darn that "j-o-b" thing 😉). My top priority is unblocking you. There should some combination that works E2E. This should be evident by the sample project. If you still don't have something working, then 4.1.1 is your best fall back. In addition to Endpoint Routing support, 5.0.0 introduced or changed functionality in accordance to what people have been asking for:
I hope that helps clarify things and at least get you moving in the right direction. |
@engenb Do the following to make your OData controllers and actions work:
//public class FooController : ODataController
public class foosController : ODataController or [ControllerName("foos")]
public class FooController : ODataController or //var foo = builder.EntitySet<Foo>("foos").EntityType;
var foo = builder.EntitySet<Foo>("Foo").EntityType;
//public IActionResult GetFoos() => Ok(Foos);
public IActionResult Get() => Ok(Foos); or [ActionName("Get")]
public IActionResult GetFoos() => Ok(Foos); I mentioned this problem in issues: In conclusion, odata attribute routing is not respected in Microsoft.AspNetCore.OData.Versioning.ApiExplorer 5.0.0, you must (ps: 'GetOrder' can not work in convention routing, only 'Get' can work in convention routing. It seems that 'GetXXX' is only used for getting navigation properties to avoid confliction.) Removing api versioning from your project can make odata attribute routing work correctly, however , Microsoft.AspNetCore.OData has its own bug related to names: @commonsensesoftware Is there any progress with issue #689 and #692 ? |
That's the key - I just needed to make my entity set names pascal-cased and that resolved the issue. Thanks @anranruye ! |
ODataController actions are discovered and produced in swagger json with Microsoft.AspNetCore.OData.Versioning.ApiExplorer 4.1.1 but not with 5.0.0
this is a placeholder issue for now as a create a sample project to demonstrate this.
The text was updated successfully, but these errors were encountered: