-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
WIP: support for generating OpenAPI (Swagger) spec #326
Conversation
FYI: here's the crate I'm working on: https://github.com/bluejekyll/rocket-openapi |
I added the function name to the route configuration so that it can be used for the operationId in OpenAPI. See usage here: https://github.com/bluejekyll/rocket-openapi/blob/master/src/lib.rs#L72 I'm definitely open to other ideas, if you think there's a better way than this. It does kinda suck to introduce a breaking API change... Here's an option I just thought of, and it would be more extensible: Thoughts? |
2e1a16f
to
fa26f63
Compare
This is awesome! I'm incredibly supportive of this initiative. One challenge here is to continue to support manual routing without introducing a lot of overhead. For instance, I think it would be a bit too much to expect every manual route to also be accompanied with a One way to tackle this is to ask the question: what information do you need? What would be required to get flawless documentation? For instance, why do you need the 'get_param_indexes' method to be public? I can't imagine how that's useful, but maybe you can enlighten me. I've given some thought about how we might generate "perfect" documentation from a Rocket application. Thus far, I'm leaning towards a |
There are a few details that we currently don't have access to at runtime. This initial attempt was to see how far I could get with a runtime based solution, driving just off the data already generated by the rocket_codegen tools. In terms of need, here's what I have so far:
Here are the gaps that we still need, and probably require additional and possibly separate code generators:
On top of that there are many other options that can be defined in openapi... but I think these are the required ones.
I think this is a great idea! In terms of Swagger/OpenAPI, many apps host the swagger UI on an endpoint on the webapp for easy browsing. So as long as that would be supported, I think it would be great. |
fa26f63
to
a17b1f5
Compare
a17b1f5
to
c368a71
Compare
Why don't we close this for now, and as I have time to make more progress I'll resubmit. |
I'm working on some stuff to start extracting OpenAPI/Swagger specs from a configured Rocket. This is the first thing I noticed I need access to. I marked it as hidden, as it appears that you want to keep in private in case of API flux.