-
Notifications
You must be signed in to change notification settings - Fork 35
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
Endpoint routing not working with .net 6 preview 6 minial api swagger integration #49
Comments
What happens when you use the webhost expression? |
It should be the same, because at first I tried that. And find it does not work so I switch to minial api style. |
Related comment here that touches on why no F# library (Falco/Giraffe/etc) should expect the minimal API syntax to work for us out of the box. I had a conversation the other day where I touched on it in slightly more detail if you want to hear more as well. |
Any news on this front? swashbuckle is still a missing integration (and painpoint) for all F# web frameworks? can be served by serverside in F# get "v2/swagger.json" generateOpenapiSpecBasedOnRegisteredRoutes() maybe using also this lib to generate it, or more simly json or yaml type providers with a rich default template file for the schema? https://github.com/microsoft/OpenAPI.NET ? |
I have literally no experience with Swashbuckle. I don't deliver formatted APIs professionally. So I am willing to assist anyone who wants to take the lead on this. |
https://github.com/domaindrivendev/Swashbuckle.AspNetCore i think with swashbuckle this would be sufficient (can also be pointed to a different custom endpoint if required),
the not super easy part is how to get a list/description of registered endpoints with verbs, routes and models etc. mainly we would have to generate the corresponding OpenApi spec file (e.g. see) https://editor.swagger.io/, based on registered endpoints/routes in falco (but would/could be nicer if it's general and can be re-used also in Giraffe and Saturn! example: https://petstore.swagger.io/ we just need to generate the correct openapi spec |
there also seems to be this project, which is interesting |
Nice work. Falco definitely uses endpoints. It even produces its own endpoint data source, as per the MSFT specs: Line 19 in e4ac1fa
I'll have a closer look at all of this when I'm back from my holiday. |
!! Thanks @pimbrouwers 👍 🎅 🎄 :) :) enjoy holidays |
You as well!! |
Getting the data source hasn't ever really been the problem here. The problem is in generating the OpenApi spec in a way that plugs in nicely with other ASP.NET Core middleware/libraries/etc. Currently, Swashbuckle builds the OpenAPI description from an ApiDescription, which ASP.NET Core builds itself via a Builder. This builder expects a certain shape of the data returned and so we'd need to either replicate that shape (hard) or provide alternate means of deriving these same shapes (might also be hard). Hope this helps. |
and what also stucks me is getting type information.. as there i need somehow to get a Expression or quotation from a RequestDelegate ...
could only get this up to now .. :D i know it probably looks funny to whom is experienced already 😀 probably the best way would be that the API library has a routing table with IN and OUT types etc.. will def check that builder code 👍 |
it seems methodinfo has to be extracted from if only this could be invoked externally to not rely on MVC only code.. but it's private... private ApiDescription CreateApiDescription(RouteEndpoint routeEndpoint, string httpMethod, MethodInfo methodInfo)
{ |
yeah, that's why the built-in stuff doesn't work for any of the F# frameworks except those that use raw minimal APIs. the frameworks have to develop their own ways of reporting the metadata to the api description providers in order to plug in. it's a sad state of affairs, and will invariably lead to a lot of re-work :( |
is there any way of ending up anywhere if we try re-write it completely without re-using the CreateApiDescription code from swashbuckle? for sure is quite many lines of code but on the other hand the "code is available", so maybe would be worth giving it a try for the F# community (else this whole openapi thing stays stuck forever as it has been for many years already?) Suave is the only one having a working integration atm (as not relying on aspnetcore...) |
seems there is some work on from aspnet for NET7 milestone.. but it might take time.. |
seems there was some progress on NET7 aspnet preview 2, maybe we could start trying it on a branch to see if it does work as expected :) https://devblogs.microsoft.com/dotnet/announcing-dotnet-7-preview-2/ |
Apologies, I haven't been keeping a close enough eye on this. I will create a branch for us. |
Is there anything I can help with? It seems quite complicated, but generating an OpenAPI spec is a big part of getting people onboard with F# at $WORK for a new service |
I am trying falco with swagger. Because recently I read some post that swaggert now support .net 6 endpoint routing start from preview 6. But unfortuatly it is not working with falco endpoint.
Below is the demo code:
The text was updated successfully, but these errors were encountered: