Skip to content
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

Merged
merged 12 commits into from
Oct 16, 2022
Merged

feat: support to Rocket-Okapi #1071

merged 12 commits into from
Oct 16, 2022

Conversation

eum602
Copy link
Contributor

@eum602 eum602 commented Sep 25, 2022

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

  • Support to rocket-okapi

@HigherOrderLogic
Copy link
Contributor

I think this should be a feature cause not everyone uses OpenAPI.

@eum602
Copy link
Contributor Author

eum602 commented Sep 25, 2022

I think this should be a feature cause not everyone uses OpenAPI.

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.

Copy link
Member

@billy1624 billy1624 left a 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?

@billy1624
Copy link
Member

Btw... I wonder do we have OpenAPI support for other common Rust web API? Such as actix, poem, axum ...etc.

@HigherOrderLogic
Copy link
Contributor

Btw... I wonder do we have OpenAPI support for other common Rust web API? Such as actix, poem, axum ...etc.

There's Utoipa

@billy1624
Copy link
Member

billy1624 commented Sep 26, 2022

Thanks! @HigherOrderLogic
I saw utoipa can be integrated with Rocket as well. How well is it compared to okapi?

@HigherOrderLogic
Copy link
Contributor

Thanks! @HigherOrderLogic I saw utoipa can be integrated with Rocket as well. How well is it compared to okapi?

Sorry, I don't know about this. I have only used utoipa with axum.

@eum602
Copy link
Contributor Author

eum602 commented Sep 26, 2022

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)

@eum602
Copy link
Contributor Author

eum602 commented Oct 3, 2022

@billy1624 @HigherOrderLogic ... just added some examples and screenshots to show how the integration works at the end.

@tyt2y3
Copy link
Member

tyt2y3 commented Oct 11, 2022

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(
Copy link
Member

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?

Copy link
Contributor Author

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"
Copy link
Contributor Author

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.

Copy link
Member

@tyt2y3 tyt2y3 left a 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.

@tyt2y3 tyt2y3 merged commit 2cdc065 into SeaQL:master Oct 16, 2022
@eum602
Copy link
Contributor Author

eum602 commented Oct 16, 2022

Thank you so much for the contribution. I liked the screenshots.

Great!! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Support to rocket-okapi
4 participants