flasgger / flasgger

Easy OpenAPI specs and Swagger UI for your Flask API

Home Page:http://flasgger.pythonanywhere.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OpenAPI client generator docs link?

mrlubos opened this issue · comments

Hey there! I'm one of the maintainers of openapi-ts, a package for turning the generated OpenAPI specs into TypeScript clients. Would you be open to including a section in README on generating clients from OpenAPI specs? FastAPI has a similar section

It's not clear to me how to even get an openapi spec out of flasgger vs. just a ui rendering of the spec. I'm trying to run httpbin locally and export the openapi spec so I can use it to wrap it for typescript use (same use case you specified) and I don't know where to start. httpbin is a flask app that uses this package to host https://httpbin.org. Does anyone have any idea how to get flasgger to output an openapi spec for use in client generation?

commented

@lukevp I can't try right now since I see their website is down, but do you not have a link to the spec in Swagger UI? Can you alternatively try to replace/append a .json to your docs URL?

Nope... I'm more used to Swagger specs that render from the ASP.NET Core swagger tooling, which includes a link in the UI to download the spec. The main homepage for https://httpbin.org is rendered by flasgger and doesn't have a spec definition link. I don't know where you'd add .json in this case since there's no docs url, it's just at https://httpbin.org (https://httpbin.org.json doesn't work because it's considered a separate site?)
I've tried /openapi.json and /openapi.yml...

Actually, I just had an idea to check the network traces, and I saw that it loads the spec from https://httpbin.org/spec.json , so I think I'm unblocked now, but I still think it would make sense to have a url to download the spec directly in the UI.