-
-
Notifications
You must be signed in to change notification settings - Fork 520
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
feat: support to Rocket-Okapi #1071
Conversation
I think this should be a feature cause not everyone uses OpenAPI. |
4fdd4d5
to
f15dade
Compare
I understand you don't agree @HigherOrderLogic. I agree that not everyone uses OpenApi, but I consider supporting this feature will help increasing adoption of this project (sea-orm) as well as we will enrich integration with rocket tools. As developers we always want to use libraries that help us as much as possible and that are versatile enough to work with other libraries. Other rust project focused on database drivers have already integrated with that tool so maybe we can just consider doing this addition since this will not affect other features but instead will add one additional point in favor of using sea-orm. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @eum602, Welcome and thanks for contributing!! First, I'm not familiar with OpenAPI. But yeah, It's a nice addition to SeaORM ecosystem. I think we need demo the usage of it in an example. Perhaps rocket-example
?
Btw... I wonder do we have OpenAPI support for other common Rust web API? Such as actix, poem, axum ...etc. |
There's Utoipa |
Thanks! @HigherOrderLogic |
Sorry, I don't know about this. I have only used |
Utoipa looks good also. I like the way how they define the different responses in the controller, seems also there is more people involved in this project. On the other hand rocket_okapi supports another format which is rapidoc. I can add an example of using rocket_okapi maybe in a different example with rocket. Or maybe we can agree first which library to use (or both) |
@billy1624 @HigherOrderLogic ... just added some examples and screenshots to show how the integration works at the end. |
Thank you for your contribution all-in-all, will be happy to merge once it is addressed. |
.attach(Db::init()) | ||
.attach(AdHoc::try_on_ignite("Migrations", run_migrations)) | ||
.mount("/", FileServer::from(relative!("/static"))) | ||
.mount( | ||
"/", | ||
routes![new, create, delete, destroy, list, edit, update], | ||
) | ||
.mount( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I think it might make sense we make a new example instead of piggy-backing the original example? may be rocket_okapi_example
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure @tyt2y3 I will fix all observations. Glad to help! :)
@@ -0,0 +1,12 @@ | |||
[package] | |||
name = "sea-orm-rocket-okapi-example" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tyt2y3 I added a new folder to exemplify the usage of rocket_okapi. Hope this is enough otherwise I could make some changes you guys consider to make it better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much for the contribution.
I liked the screenshots.
Great!! 👍 |
PR Info
This PR implements
OpenApiFromRequest
for Connection. By doing this we can use rocket-okapi, a library that implements OpenApi 3.0, in conjunction with SeaOrm.Adds