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: axum v0.8 support #168

Merged
merged 1 commit into from
Jan 9, 2025
Merged

Conversation

devmaxde
Copy link
Contributor

@devmaxde devmaxde commented Jan 3, 2025

fixes #167

Based on this announcement

Copy link
Collaborator

@JakkuSakura JakkuSakura 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 for the quick update to axum v0.8. I see there are a few changes regarding Sync. Any reason for these? I'm afraid that they may break old code. The rest looks fine

@@ -863,7 +867,7 @@ mod tests {
#[test]
fn test_nesting_with_nondefault_state() {
let _app: ApiRouter = ApiRouter::new()
.nest_api_service("/", ApiRouter::new().with_state(1_isize))
.nest_api_service("/home", ApiRouter::new().with_state(1_isize))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is the change here needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bildschirmfoto 2025-01-03 um 03 54 46

@@ -580,7 +584,7 @@ where
/// to pass on the API documentation from the nested service as well.
pub fn nest_service<T>(mut self, path: &str, svc: T) -> Self
where
T: Service<Request<Body>, Error = Infallible> + Clone + Send + 'static,
T: Service<Request<Body>, Error = Infallible> + Clone + Send + 'static + std::marker::Sync,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why add new Sync trait bound?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tbh. It's what the compiler complained about

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@devmaxde
Copy link
Contributor Author

devmaxde commented Jan 3, 2025

It will break the old code. That's for sure. The reason for this is, that Axum dropped the support for the async—trait.

@JakkuSakura
Copy link
Collaborator

I dug into the axum code. It's not because they dropped async-trait, but they added Sync when they dropped

@devmaxde devmaxde marked this pull request as draft January 3, 2025 02:59
@devmaxde
Copy link
Contributor Author

devmaxde commented Jan 3, 2025

I made it into a Draft to test it on my own Project. I just saw, that there are not that many tests

@JakkuSakura
Copy link
Collaborator

JakkuSakura commented Jan 3, 2025

Could you bump aide to 0.14.0 as it's a breaking change unavoidably?

Other crates under crates/* and examples/* also need to bump version and use latest aide + axum combo

@devmaxde devmaxde force-pushed the axum_compatible branch 2 times, most recently from 3abeb84 to aefb133 Compare January 3, 2025 03:21
@devmaxde
Copy link
Contributor Author

devmaxde commented Jan 3, 2025

To make sure there isn't a misunderstanding. I cant fix the aide-axum-typed-multipart crate, because it hast implemented the change itself. In my Project everything worked fine. But im not a fan of the nest_api_service changes :/

@devmaxde devmaxde marked this pull request as ready for review January 3, 2025 03:24
@JakkuSakura
Copy link
Collaborator

I see. This PR is needed
murar8/axum_typed_multipart#95

@devmaxde
Copy link
Contributor Author

devmaxde commented Jan 3, 2025

I don't think, we should wait for it. I tried implementing it right now, but this package need to update the axum-test-helper package to get the tests to run.

@devmaxde
Copy link
Contributor Author

devmaxde commented Jan 3, 2025

Welp:

murar8/axum_typed_multipart#97

@devmaxde devmaxde changed the title feat: axum v0.8 compatible feat: axum v0.8 support Jan 3, 2025
@devmaxde
Copy link
Contributor Author

devmaxde commented Jan 4, 2025

Question:
Do we want to wait until Axum_typed_mulipart is supported or just merge without it?

@devmaxde
Copy link
Contributor Author

devmaxde commented Jan 6, 2025

The Axum-typed-multipart works now. The Action Fails, due to the missing crates.io entry.
How should I proceed? Proceeding with the lower version and you bump it later or just merge with the correct bumped version

feat: axum-typed-multipart
@JakkuSakura
Copy link
Collaborator

I suggest just wait for a while.

@devmaxde
Copy link
Contributor Author

devmaxde commented Jan 6, 2025

It was a bug. I missed something. I forgot to update the aide version in one of the crates. Thats why it failed to build them from the path. Now with the last "force-push" it should work

@devmaxde devmaxde requested a review from JakkuSakura January 7, 2025 17:51
@jplatte
Copy link
Collaborator

jplatte commented Jan 8, 2025

Dang, I missed this PR! Just posted my own (#170). Let me see where the differences are..

@devmaxde
Copy link
Contributor Author

devmaxde commented Jan 9, 2025

Your GithubAction is failing. Thats one of the differences xD

@jplatte
Copy link
Collaborator

jplatte commented Jan 9, 2025

Yeah, I failed to update a few things in packages we likely want to drop anyways. Have opened a separate PR for that.

Still, we can probably merge this first and get all of the other improvements from my PR in separately. I'll review your changes + the existing comments.

@jplatte jplatte merged commit e2cac60 into tamasfe:master Jan 9, 2025
1 check passed
@jplatte
Copy link
Collaborator

jplatte commented Jan 9, 2025

@JakkuSakura hope you don't mind that I merged this. There's some things I still want to improve about the upgrade, but it seemed like a good first step to get it in.

@jplatte
Copy link
Collaborator

jplatte commented Jan 9, 2025

#170 has now been rebased on top of this.

@JakkuSakura
Copy link
Collaborator

JakkuSakura commented Jan 9, 2025

@jplatte it's ok. I'm just a bit conservative on this kind of PR. It has larger impact to users. With your approval it would be sufficient

@devmaxde devmaxde deleted the axum_compatible branch January 9, 2025 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Breaking changes in Axum 0.8.0
4 participants