Giraffe.Swagger icon indicating copy to clipboard operation
Giraffe.Swagger copied to clipboard

Integrate with new Endpoint Routing API

Open dustinmoris opened this issue 7 years ago • 13 comments

See: https://github.com/giraffe-fsharp/Giraffe/issues/310

dustinmoris avatar Dec 20 '18 08:12 dustinmoris

Hi @dustinmoris,

just a quick question. Since dotnet core 3 is released, does it somehow change anything regarding generating Swagger/OpenAPI documentation? As far as I understand, it should be now possible to extract routes (end return types) even for apps not based on MVC routing. Correct? I think this feature would be great for all F# people (I am sick of writing yaml by hand 😄) so do you have any plan how to approach it? Need any help with it?

Dzoukr avatar Oct 08 '19 08:10 Dzoukr

Hi @Dzoukr ,

Swashbuckle (Swagger middleware on aspnet core) will hopefully utilise endpoint routing so we (@dustinmoris ) are in the process of integrating new Endpoint routing system as an initial step here. Once we have endpoint routing in, we should be able to hook in Swashbuckle middleware to generate swagger docs.

One Item that still needs investigation is the swagger override attributes to customise the response although basic docs should come back fine and all this will be tested once Endpoint routing integrated.

gerardtoconnor avatar Oct 08 '19 09:10 gerardtoconnor

@gerardtoconnor I don't think Swashbuckle does integrate with Endpoint Routing though, do you have a source for that?

My understanding is that we are hoping that there will be an emerging need for Endpoint Routing to work with Swashbuckle or a similar tool, but that isn't currently being built, I can't even find an issue for it.

slang25 avatar Oct 08 '19 10:10 slang25

Hi @gerardtoconnor, thanks a lot for explanation!

Dzoukr avatar Oct 08 '19 10:10 Dzoukr

@slang25 https://github.com/domaindrivendev/Swashbuckle.AspNetCore/issues/1306

dustinmoris avatar Oct 08 '19 11:10 dustinmoris

I think the NSwag contributors are having similar discussions regarding the switch to use the endpoint collection. There seems to be no concrete effort tough. This is the only issue I could find https://github.com/RicoSuter/NSwag/issues/2101

WalternativE avatar Oct 08 '19 12:10 WalternativE

@dustinmoris @WalternativE Thanks both 😃 I'll do some digging and try to figure out what's involved.

slang25 avatar Oct 08 '19 12:10 slang25

@slang25 yes you're absolutely right, I thought our motivation for integrating endpoint routing was to allow for this support automatically as was almost there, looking through the docs and code, there is still the dependency on MVC and the plans to use endpoint routing are still only in the design/discussion phase so will be a while still ... makes me think I should perhaps integrate into Token Router in the interim or something to give some sort of automation to this heavily requested feature.

gerardtoconnor avatar Oct 08 '19 12:10 gerardtoconnor

Hello everyone, i hope this is the correct place to ask. I am a trying to integrate Swashbuckle into a SAFE stack application and spend the last few days reading about the big changes for aspnetcore 3 and how endpoint routing will make the interaction of giraffe and swashbuckle possible, but... i have not found any posted solutions or examples for this online, so as i am a bit out of the loop, my questions are:

Did aspnetcore 3.0 enable swashbuckle for giraffe? Did swashbuckle adapt to this accordingly?

I found an example for endpoint routing in #4 but i don't know if this version is possible to use in a SAFE stack or if it works with swashbuckle so i wanted to ask first.

Sorry if my question is stupid and thanks for any answers.

Freymaurer avatar Jul 17 '20 15:07 Freymaurer

Hi, ASP.NET Core 3.0 doesn't enable Swashbuckle for Giraffe yet. We still need to do some extra work. We were hoping that the new endpoint routing could hugely simplify this task, but it seems like there's still quite some work left on the Giraffe front. Please check this thread for more information: https://github.com/giraffe-fsharp/Giraffe/issues/428

dustinmoris avatar Aug 09 '20 14:08 dustinmoris

any good news on this end?

jkone27 avatar Oct 21 '21 12:10 jkone27

This was pretty promising and worth a look at: https://github.com/baronfel/Giraffe.EndpointRouting.OpenAPI

slang25 avatar Oct 21 '21 12:10 slang25

Just as an update, I admittedly don't have the time at the moment to really do any meaningful work on this front but I'm always open and very welcoming of community contributions.

dustinmoris avatar Nov 11 '21 10:11 dustinmoris