-
Notifications
You must be signed in to change notification settings - Fork 96
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
Nice Work! Would global routes help eliminate path magic string? #2
Comments
@joshbooker Thanks Josh! I'll try your idea to see if we can get rid of the hardcoded/magic string. PS, No, I haven't tested yet whether filters are applied after setting the custom ISwaggerProvider. |
@joshbooker Now determining the route prefix in the ODataSwaggerProvider. This significantly simplified the configuration steps. Thanks for your suggestion! |
Fix is available in this pre-release NuGet package |
That's perfect! One line in swagger.config and done. Great work. You really need to submit this as pull request to webapi odata. As you know they've been very responsive to issue 302 in recent days. If submitted now, your provider code might just make v5.8 |
Must try this with RESTier tomorrow. Thanks again for sharing. |
Richard, I got an email from OData PM Mark Stafford, says they'll look at this next week and update github after holiday. PS You may want to change readme to install nuget prerelease: |
@joshbooker Hey Josh, Ok, thanks for the OData PM update. Sure, I'll change the readme. Thanks! |
Thanks again. PS works great with https://github.com/OData/RESTier too. Happy happy |
Cool! |
@rbeauchamp FYI discussion about adding this to System.Web.OData is ongoing here: |
@joshbooker OK. Thanks for the update. FYI, Item 3) from your comment is not implemented at this time. See my comment in #5. |
@rbeauchamp-lendingtree |
…OdataUpdates Microsoft.AspNet.*.Versioning unit tests added.
First this is great work. I hope WebAPI OData team will work their implementation into swashbuckle like this - out of the box.
OData/WebApi#302
OData/WebApi#520
OData/WebApi#552
I wonder if you can get global ODataRoutes to eliminate the '/odata' magic string:
something like:
var odataRoutes = GlobalConfiguration.Configuration.Routes.Where(a=>a.GetType() == typeof(ODataRoute)).ToList();
if (!odataRoutes.Any()) return;
var route = odataRoutes.FirstOrDefault() as ODataRoute;
var path = "/" + route.RoutePrefix;
c.CustomProvider(defaultProvider => new ODataSwaggerProvider(path, edmModel));
Or better yet, maybe do it in ODataSwaggerProvider so you don't need to pass edm through SwaggerConfig.
PS - side question: have you tested to see whether swashbuckle filters work to post-modify swagger output? CUrious if IOperationFilter works for custom ISwaggerProvider.
Keep up the great work!
The text was updated successfully, but these errors were encountered: